Thanks to visit codestin.com
Credit goes to sandboxagent.dev

Skip to main content

Server

Start the HTTP server:
sandbox-agent server [OPTIONS]
OptionDefaultDescription
-t, --token <TOKEN>-Authentication token for all requests
-n, --no-token-Disable authentication (local dev only)
-H, --host <HOST>127.0.0.1Host to bind to
-p, --port <PORT>2468Port to bind to
-O, --cors-allow-origin <ORIGIN>-Additional CORS origin (repeatable, cumulative with Inspector)
-M, --cors-allow-method <METHOD>allCORS allowed method (repeatable)
-A, --cors-allow-header <HEADER>allCORS allowed header (repeatable)
-C, --cors-allow-credentials-Enable CORS credentials
--no-inspector-cors-Disable default Inspector CORS
--no-telemetry-Disable anonymous telemetry
sandbox-agent server --token "$TOKEN" --port 3000

Install Agent (Local)

Install an agent without running the server:
sandbox-agent install-agent <AGENT> [OPTIONS]
OptionDescription
-r, --reinstallForce reinstall even if already installed
sandbox-agent install-agent claude --reinstall

Credentials

Extract

Extract locally discovered credentials:
sandbox-agent credentials extract [OPTIONS]
OptionDescription
-a, --agent <AGENT>Filter by agent (claude, codex, opencode, amp)
-p, --provider <PROVIDER>Filter by provider (anthropic, openai)
-d, --home-dir <DIR>Custom home directory for credential search
-r, --revealShow full credential values (default: redacted)
--no-oauthExclude OAuth credentials
sandbox-agent credentials extract --agent claude --reveal
sandbox-agent credentials extract --provider anthropic

Extract as Environment Variables

Output credentials as shell environment variables:
sandbox-agent credentials extract-env [OPTIONS]
OptionDescription
-e, --exportPrefix each line with export
-d, --home-dir <DIR>Custom home directory for credential search
--no-oauthExclude OAuth credentials
# Source directly into shell
eval "$(sandbox-agent credentials extract-env --export)"

API Commands

The sandbox-agent api subcommand mirrors the HTTP API for scripting without client code. All API commands support:
OptionDefaultDescription
-e, --endpoint <URL>http://127.0.0.1:2468API endpoint
-t, --token <TOKEN>-Authentication token

Agents

List Agents

sandbox-agent api agents list

Install Agent

sandbox-agent api agents install <AGENT> [OPTIONS]
OptionDescription
-r, --reinstallForce reinstall
sandbox-agent api agents install claude --reinstall

Get Agent Modes

sandbox-agent api agents modes <AGENT>
sandbox-agent api agents modes claude

Sessions

List Sessions

sandbox-agent api sessions list

Create Session

sandbox-agent api sessions create <SESSION_ID> [OPTIONS]
OptionDescription
-a, --agent <AGENT>Agent identifier (required)
-g, --agent-mode <MODE>Agent mode
-p, --permission-mode <MODE>Permission mode (default, plan, bypass)
-m, --model <MODEL>Model override
-v, --variant <VARIANT>Model variant
-A, --agent-version <VERSION>Agent version
sandbox-agent api sessions create my-session \
  --agent claude \
  --agent-mode code \
  --permission-mode default

Send Message

sandbox-agent api sessions send-message <SESSION_ID> [OPTIONS]
OptionDescription
-m, --message <TEXT>Message text (required)
sandbox-agent api sessions send-message my-session \
  --message "Summarize the repository"

Send Message (Streaming)

Send a message and stream the response:
sandbox-agent api sessions send-message-stream <SESSION_ID> [OPTIONS]
OptionDescription
-m, --message <TEXT>Message text (required)
--include-rawInclude raw agent data
sandbox-agent api sessions send-message-stream my-session \
  --message "Help me debug this"

Terminate Session

sandbox-agent api sessions terminate <SESSION_ID>
sandbox-agent api sessions terminate my-session

Get Events

Fetch session events:
sandbox-agent api sessions events <SESSION_ID> [OPTIONS]
OptionDescription
-o, --offset <N>Event offset
-l, --limit <N>Max events to return
--include-rawInclude raw agent data
sandbox-agent api sessions events my-session --offset 0 --limit 50
get-messages is an alias for events.

Stream Events (SSE)

Stream session events via Server-Sent Events:
sandbox-agent api sessions events-sse <SESSION_ID> [OPTIONS]
OptionDescription
-o, --offset <N>Event offset to start from
--include-rawInclude raw agent data
sandbox-agent api sessions events-sse my-session --offset 0

Reply to Question

sandbox-agent api sessions reply-question <SESSION_ID> <QUESTION_ID> [OPTIONS]
OptionDescription
-a, --answers <JSON>JSON array of answers (required)
sandbox-agent api sessions reply-question my-session q1 \
  --answers '[["yes"]]'

Reject Question

sandbox-agent api sessions reject-question <SESSION_ID> <QUESTION_ID>
sandbox-agent api sessions reject-question my-session q1

Reply to Permission

sandbox-agent api sessions reply-permission <SESSION_ID> <PERMISSION_ID> [OPTIONS]
OptionDescription
-r, --reply <REPLY>once, always, or reject (required)
sandbox-agent api sessions reply-permission my-session perm1 --reply once

CLI to HTTP Mapping

CLI CommandHTTP Endpoint
api agents listGET /v1/agents
api agents installPOST /v1/agents/{agent}/install
api agents modesGET /v1/agents/{agent}/modes
api sessions listGET /v1/sessions
api sessions createPOST /v1/sessions/{sessionId}
api sessions send-messagePOST /v1/sessions/{sessionId}/messages
api sessions send-message-streamPOST /v1/sessions/{sessionId}/messages/stream
api sessions terminatePOST /v1/sessions/{sessionId}/terminate
api sessions eventsGET /v1/sessions/{sessionId}/events
api sessions events-sseGET /v1/sessions/{sessionId}/events/sse
api sessions reply-questionPOST /v1/sessions/{sessionId}/questions/{questionId}/reply
api sessions reject-questionPOST /v1/sessions/{sessionId}/questions/{questionId}/reject
api sessions reply-permissionPOST /v1/sessions/{sessionId}/permissions/{permissionId}/reply