run waits for the agent’s reply, and send doesn’t. That decides which one you use:
On the CLI,
send --watch waits too.
In the examples, agents is boxd.machines.agents, as in the overview.
One task
run does a whole task in one call. It starts a session, sends the task, waits until the agent is done, returns the reply, and closes the session.
reason says how the turn ended:
The CLI prints the reply to stdout and progress to stderr. It exits 0 when the turn ended
done, and 1 otherwise.
If the agent leaves a long command running when it ends its turn, such as a build, run still returns and nothing is killed. The session closes by itself once the command is done.
Several messages
For a conversation, start the session yourself.run with session then sends a message into it and waits for the reply. The session remembers what was said, so each message can build on the ones before it.
Send without waiting
send hands the agent a message and returns at once. The agent does the work in the machine, with or without you.
Step in while the agent works
You don’t have to wait until a turn is done. While it runs, you can correct the agent, line up more work, or stop it.- A message with
when: "now"is taken into account before the turn ends. Both Claude Code and Codex can do this. If no turn is running, it starts one. - A plain message leaves the running turn alone.
sendreturns adeliverythat says what became of it:started,queuedorjoined. - An interrupt ends the turn as
interrupted. The session stays open, and a message that was waiting starts the next turn. An interrupt can also drop the waiting messages, or stop one turn by its number. See the reference.