Skip to main content
POST /v1/agents/runtime/{runtime_id}/commands/run run_cmd / runCmd accepts either a single shell string or a command plus an explicit args list:
CLI timeout is in seconds (--timeout 300). The REST API timeout field is in milliseconds (300000). The Python SDK takes seconds and converts for you.

Basic Usage

Install Packages

Guest egress is deny-by-default, so pip install needs a network policy. The example uses allow_all for a short demo; prefer an allowlist for PyPI in production.

Run Shell Scripts

With Environment Variables

Set env_vars at runtime creation so variables are available to every run_cmd / run_code call, or pass them per command:

Streaming Output

For long-running commands, pass on_stdout / on_stderr / on_exit callbacks to receive output incrementally as the process produces it. The transport switches to Server-Sent Events transparently; the returned CommandRunResponse still carries the aggregated stdout/stderr/exit_code so existing code keeps working.
All user code (including streamed commands) executes as the unprivileged agent user inside the runtime. sudo is configured for the agent user with NOPASSWD, so commands like sudo apt-get install -y ... work without prompting.

Parameters

Response