Sessions are the unit of interaction with an agent. Create one session per task, send prompts, and consume event history. For SDK-based flows, sessions can be restored after runtime/session loss when persistence is enabled. See Session Restoration.Documentation Index
Fetch the complete documentation index at: https://sandboxagent.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Create a session
Send a prompt
Subscribe to live events
Event types
Each event’spayload contains a session update. The sessionUpdate field identifies the type.
agent_message_chunk
agent_message_chunk
Streamed text or content from the agent’s response.
agent_thought_chunk
agent_thought_chunk
Internal reasoning from the agent (chain-of-thought / extended thinking).
user_message_chunk
user_message_chunk
Echo of the user’s prompt being processed.
tool_call
tool_call
The agent invoked a tool (file edit, terminal command, etc.).
tool_call_update
tool_call_update
Progress or result update for an in-progress tool call.
plan
plan
The agent’s execution plan for the current task.
usage_update
usage_update
Token usage metrics for the current turn.
session_info_update
session_info_update
Session metadata changed (e.g. agent-generated title).
Fetch persisted event history
List and load sessions
Configure model, mode, and thought level
Set the model, mode, or thought level on a session at creation time or after:Advanced config options
For config options beyond model, mode, and thought level, usegetConfigOptions to discover what the agent supports and setConfigOption to set any option by ID:
Handle permission requests
For agents that request tool-use permissions, register a permission listener and reply withonce, always, or reject:
Auto-approving permissions
To auto-approve all permission requests, respond with"once" or "always" in your listener:
examples/permissions/src/index.ts for a complete permissions example that works with Claude and Codex.
Some agents like Claude allow configuring permission behavior through modes (e.g.
bypassPermissions, acceptEdits). We recommend leaving the mode as default and handling permission decisions explicitly in onPermissionRequest instead.