sandbox.agent.
await sandbox.agent.start(...)
Start an agent session. HTTP API →
Initial prompt
Claude model
System prompt
Restrict tools
Permission mode
Max turns
Working directory
MCP server configuration
Event callback
Stderr callback
AgentSession
resume, on_exit, and on_scrollback_end are not available in the Python SDK.await sandbox.agent.attach(session_id, ...)
Reconnect to a running agent session. Accepts on_event and on_error.
Returns: AgentSession
await sandbox.agent.list()
List all agent sessions. HTTP API →
Returns: list[AgentSessionInfo]
AgentSession
await session.collect_events()
Collect all events until the agent process exits. Python-unique alternative to callbacks.
Returns: list[AgentEvent]
await session.wait()
Wait for the agent to finish.
Returns: int (exit code)
Types
AgentEvent
AgentEvent
AgentSessionInfo
AgentSessionInfo