Background processes
Bash runs a command and waits for it to finish. Some work does not fit that model, such as a development server, a watcher, or a build that runs for minutes. The builtin/process tool starts such a command in the background and lets the agent check on it in later turns.
Enable the tool
Section titled “Enable the tool”builtin/process is off by default. Select it explicitly in the agent’s tools.use.
{ "agents": { "dev": { "model": "local", "tools": { "use": [ "builtin/read_file", "builtin/bash", "builtin/process" ] } } }}Process and Bash are separate tools with separate permission rules. Allowing one does not allow the other. Hooks and approval rules apply to each call the same way they apply to other tools.
Bash can also start a job. builtin/bash with run_in_background: true starts the command through builtin/process, and the start passes that tool’s rules, hooks, and approval. If builtin/process is not selected, the command runs in the foreground instead.
Actions
Section titled “Actions”The tool takes one flat object per call, with an action field. Each call runs one action.
| Action | Fields | Result |
|---|---|---|
start |
command, optional label, optional cwd relative to the session, optional env_refs, optional timeout in milliseconds, optional shell (bash or powershell) |
An opaque job ID, returned once the shell has started. Without timeout the job has no deadline. |
list |
None | One line per job, or No background jobs.. |
status |
id |
The job’s state, its exit details, and its output size. |
output |
id, optional cursor and max_bytes |
A page of recent output, then the next cursor and the job’s state. |
stop |
id |
Stops the job and returns its final state. |
The tool also reads timeout_ms as timeout, and process_id, shell_id, or bash_id as id. A field that another action uses is dropped with a note. A missing required field is rejected with an example call, such as {"action":"output","id":"<id>"}.
The agent refers to a process only by the ID that start returns. It never uses an operating-system process ID.
A successful start means the shell was launched. It does not mean the program is ready. Use output to check for a ready message.
States
Section titled “States”| State | Meaning |
|---|---|
starting |
Raw has reserved the process and is launching it. |
running |
The process is running. |
stopping |
A stop was requested and the process is shutting down. |
exited |
The process exited with code 0. |
failed |
The process exited with a nonzero code. |
stopped |
The process was stopped by a request. |
timed_out |
The process reached its timeout deadline. |
lost |
The host that owned the process stopped without cleaning up. |
stop is idempotent. Stopping a process that has already finished returns its final state.
Output
Section titled “Output”- Each process keeps up to 1 MiB of its most recent output. Stdout and stderr are labeled.
- A page returns up to 64 KiB.
max_bytesasks for a smaller page. - The result of
outputends with[next cursor: N]and the job’s state, such as[running]or[exited · exit 0]. Pass that cursor ascursorto read on. - Cursors are byte positions in the output. Each response reports the earliest available position and the next cursor.
- When old output has been dropped, a cursor that points before it resumes at the earliest retained output, and the response says so.
- A page that is too small to hold the next UTF-8 character returns an error rather than a cursor that cannot advance.
Limits
Section titled “Limits”| Scope | Limit |
|---|---|
| Live processes per session | 8 |
| Live processes per host | 32 |
| Finished records kept per session | 100 |
Ownership and lifetime
Section titled “Ownership and lifetime”The host that runs the session owns the process supervisor. That host is the CLI, the dashboard server, or an ACP connection.
- A process started successfully keeps running after the turn that started it ends. It also keeps running if you close the browser tab.
- A start that is cancelled before Raw confirms it is stopped.
- A process ends on its own, at its deadline, on
stop, when its session is deleted, or when its host shuts down. - On macOS and Linux, shutdown stops the process group with
TERM, thenKILLif needed. Processes that detached from the group are not covered by this guarantee. - If the host crashes, Raw marks its processes as
lostthe next time it looks at them. Raw does not signal or reattach to a process from a dead host, and it does not restart a command.
Managed processes work on macOS, Linux and Windows. On Windows, a job runs Git Bash like the bash tool, or PowerShell with "shell": "powershell" on start. Each job runs inside a Windows job object: stop, a deadline and shutdown end the whole process tree at once, and when the command exits, every process it left running is stopped too. Raw builds the program that creates the job object with the .NET Framework compiler that ships with Windows. Without that compiler, stop uses taskkill /T, which misses processes whose parent has already exited, and a command that exits on its own leaves the processes it started running. Without Git Bash, a Bash start fails with bash_unavailable.
In the dashboard
Section titled “In the dashboard”The dashboard’s Commands section lists foreground Bash commands and background processes together. You can read a process’s output there and stop it, even while a model turn is running. Stopping from the dashboard goes through the same policy and approval checks as a model call.
Related
Section titled “Related”- Tools covers the other built-in tools and tool rules.
- Configuration reference lists the agent fields.