Skip to main content
The bash tool is how the agent runs commands on the computer. Each call executes bash -c <command> in a non-login shell; to run somewhere else, cd inside the command. exec is a single request/response; the streamed exec delivers the same run as it happens.
Exec on a paused computer resumes it first, and it stays running (and billed) afterwards. See lifecycle.

Examples

Output caps at a glance

When you expect large output, redirect it to a file (… > ~/out.log 2>&1) and read the parts you need with the filesystem tools instead of returning it all through stdout.

Fields

string
required
The command line to run. Executed as bash -c <command>.
integer
Maximum time to wait before the command is killed and the call returns. Defaults to 30000, up to 600000. When it elapses, exit_code is 124 and timed_out is true.
There is no cwd or env field: cd and set variables inside the command (cd ~ && CI=1 npm test); they last for that call only. There is no way to bake environment variables into a computer at create time. With the coming egress pinning, secrets are supplied by the vault at the network boundary rather than as sandbox env vars — see Networking.

Response

The command is run to completion and its output is buffered, then returned together:
string
Buffered standard output. Capped at 262,144 characters; output beyond the cap is cut, and truncated is true.
string
Buffered standard error, capped at 262,144 characters independently of stdout.
integer
The process exit code; 124 when timeout_ms elapsed.
integer
How long the command ran, in milliseconds.
boolean
true when the command was killed at timeout_ms.
boolean
true when stdout or stderr was cut at the cap.
exec is not streaming: stdout and stderr are collected in full (up to the cap) and returned once the command exits or timeout_ms elapses. To read output as it is produced, use the streamed exec (computers.execStream(id, command, { timeoutMs }) in the SDK). For long-running work, have the command write progress to a file and poll it with read.

Next: browser

Drive a real, managed browser scoped to an allow-list of domains.