INNER CODE UNIT · Python
exec_command
deeplethe/forkd · sdk/mcp/sandstorm_mcp/server.py:325
def exec_command(
sandbox_id: str,
args: list[str],
timeout_secs: int = 30,
sandbox_token: str | None = None,
) -> dict[str, Any]:
"""Run a subprocess inside a sandbox.
Example:
exec_command("sb-abc-0000", ["python3", "-c", "print(2+2)"],
sandbox_token="<token-from-creation>")
sandbox_token: Token from the creation response; required by v0.6.
Returns: {stdout, stderr, exit_code}.
"""
body = {"args": args, "timeout_secs": timeout_secs}
with _client(sandbox_token, _command_timeout(timeout_secs)) as c: