sandbox.agent.
sandbox.agent.start(opts?)
Start an agent session. HTTP API →
Initial prompt
Claude model
System prompt
Restrict tools
Permission mode
Max turns
Working directory
MCP servers
Resume session ID
Event callback
Stderr callback
Exit callback
Scrollback done callback
Promise<AgentSession>
sandbox.agent.attach(sessionId, opts?)
Reconnect to a running agent session. Accepts onEvent, onError, onExit, onScrollbackEnd.
Returns: Promise<AgentSession>
sandbox.agent.list()
List all agent sessions. HTTP API →
Returns: Promise<AgentSessionInfo[]>
AgentSession
| Member | Type | Description |
|---|---|---|
sessionId | string | Session ID |
done | Promise<number> | Resolves with exit code |
sendPrompt(text) | method | Send follow-up prompt |
interrupt() | method | Interrupt current turn |
configure(config) | method | Update agent configuration |
kill(signal?) | Promise<void> | Kill agent process |
close() | method | Close WebSocket |
Types
AgentEvent
AgentEvent
McpServerConfig
McpServerConfig