Agent tool links
An agent’s machine is thin: it runs the agent and nothing else. The agent runs its tools in
another machine of its project, its tools machine (a Devbox has the usual
development tools installed): the code in /workspace, the shells, the
builds, git and rg are there, while the agent itself, its config, its sign-ins and
its model keys stay in the agent’s machine. For an agent whose commands run there too,
something in the code (a poisoned README, a build script) then can’t rewrite the agent’s
settings or read what it holds, because none of it is on the machine where the code runs.
Preview
Mistral Vibe, Claude Code, Codex and pi run both their commands and their files on the tools machine, so a poisoned build script they run can’t reach their settings and sign-ins. It is a preview: tell us what breaks.
On the canvas
The agent attaches its tools itself (below); ask it in its chat to work on a machine. The canvas shows where they run: a work link from the agent’s card to its tools machine, with dots travelling it while tools run. When the agent attaches itself, the move takes effect at once, in the turn it is in: its next command runs on the new machine. A move you make on the canvas waits for the turn to end. Either way its conversation goes on, and it knows where its tools run now.
A machine serves one agent at a time, and a tools machine has no tools machine of its own.
From inside the agent’s machine
The agent (or you, in its terminal) attaches with space-env tools, to any machine of its
project (a machine of another project isn’t found), as on the canvas. Every machine it was attached to becomes one of its targets, which status
lists.
space-env tools status # where the tools run, the link, the targets
space-env tools attach web-1 # from the agent's next command on
space-env tools detachattach and detach return once the move is done: the link is up and the files are
there. A command the agent still runs (a server in the background, say) finishes first;
one that goes on makes the move fail, so nothing runs half on one machine and half on the
other. If the move fails, the tools stay where they were and status says so.
Codex moves after the turn it is in instead; --now cancels that turn rather than waiting
for it.
space-env on the tools machine
In the agent’s commands on its tools machine, space-env acts as the agent for what is
about the agent, and as that machine for what is about the machine:
| Acts as | Commands |
|---|---|
| The agent | whoami’s agent, send, receive, waiting, notify, agents, machines, tools, artifact, share, credential, topic, publish, subscribe, schedule, bucket, git-credential |
| The machine | services, meta, wakelock, status, web-portal, gateway, resize, fork, forks, checkpoints |
So a space-env send from there comes from agent:<name>, the agent’s own credentials are
the ones it reads, and space-env services lists the tools machine’s services. One
exception in meta: the keys under agent/ are what the agent says of itself, so meta set
and meta unset of those (agent/status, agent/status_text) write them on the agent,
and the tools machine’s card never shows an agent’s status. The
files an artifact put or bucket put there uploads go over the link too, out from the
agent’s machine.
--as-agent and --as-machine override either way; space-env whoami there names both.
A Codex agent brings its tools back with space-env tools detach from there, after its
turn.
Each link connection forwards the agent machine’s guest API socket to the tools machine,
root only, for as long as the connection lasts, and the agent’s commands there are told
where it is. If that forward is down (a tools machine that
hasn’t been restarted since this came in), a command about the agent fails with “the
agent’s link is down” instead of acting as the machine. space-env tools detach works
even then: the tools machine lets go of the agent itself, and the agent’s tools move back to
its own machine after its turn.
Codex on the tools machine
Codex runs its tools through a Codex of the tools machine (codex exec-server), in the
same version as the agent’s. The tools machine needs no Codex or Node of its own: while the
agent is Codex, space-env tools attach brings the agent machine’s own Codex binary there,
to /var/lib/space-env/tools/codex-<version>, and runs it from there. That happens once per
Codex version (some 300 MB over the link, a few seconds); a newer version replaces the older
copy. Nothing goes on the tools machine’s PATH, and a Codex you installed there yourself
is not used.
If Codex can’t be brought there (the tools machine’s disk is full, say), space-env tools attach refuses the machine and leaves the tools where they were, saying why. A machine
attached through the region API gets Codex the same way: if that fails the chat says why
the agent doesn’t start, and the agent tries again.
MCP servers of the tools machine
A machine can offer MCP servers to the agent that works on it: a language server, a
database tool, anything that speaks MCP over stdio. It names each one in its
metadata, under mcp/<name>: the command that serves it there, its
arguments, and a line that says what it is for.
space-env meta set 'mcp/notes={"command":"notes-mcp","args":["--stdio"],"about":"The project notes: search and read them."}'An agent attached to that machine gets the server in its next session, as <machine>_<name>
(here web-1_notes). What the agent sees is not the server’s own tool list but two tools:
tool_searchfinds the server’s tools by words and answers each one’s name, description and arguments; an empty query lists them all.tool_executeruns one by its name.
The server is not started for a session that doesn’t use it. The first tool_search or
tool_execute starts the command on the tools machine, over the link, which resumes the
machine if it is suspended. If the machine is suspended again later, the next call starts the server
anew. The value is metadata, so it is at most 256 characters and every machine of the
project can read it: no keys or passwords in the command.
Mistral Vibe, Claude Code and Codex take these servers; pi has no MCP client.
How it works
The two machines have no network to each other. The host they run on links them over
vsock: the agent’s machine connects to port 5300 of the host, and the host passes the
connection to the tools machine it is attached to, without reading it. In the tools
machine, the tool-link service hands each connection to its sshd, for the agent’s key
only, and ends everything that agent started there when it detaches. The agent works on
the tools machine’s files through that ssh connection (sshfs), at their own paths: its
/workspace, and what is in its /root (an app in /root/canvas, say), but the
dot-files there, which stay the agent’s own (its config and sessions). So the agent’s file
tools (Mistral Vibe’s read, write and edit, Claude Code’s Read and Write) see the same
files as its commands. Elsewhere (/etc, /opt, a new file directly in /root) only
its commands reach the tools machine. Mistral Vibe’s
commands run there through its bash tool’s shell (space-env tools shell), Claude Code’s
through its shell prefix (space-env tools exec), pi’s (its bash tool and ! commands)
through the same shell, which an extension gives it while it is attached, each in the
directory the agent is in;
such a command gets the tools machine’s own environment (its login profile), not
variables the agent set for it in its own machine. Codex’s commands and file edits run in
codex exec-server on the tools machine, started over the same connection (Codex’s
environments.toml, which the agent’s machine writes while attached), with no
environment of its own machine to fall back on.
A link in use keeps both machines running; an idle one doesn’t, even while the agent keeps it open, so between turns both may be suspended, and the next turn resumes the tools machine. If the link drops in the middle of a command, the command fails with a message and is not run again.
When the agent starts and its tools machine can’t (your organization’s running CPUs or memory are used up, say), or doesn’t answer for three minutes, the agent doesn’t wait for it: its tools link is dropped and it starts with its tools on its own machine. Its chat says why, with a link to the quota alert, and you get a notification. Attach the tools machine again once it can start.