Skip to content
Home

SDK & CLI Guide

Use SDKs for application integrations. Use raw HTTP when verifying HTTP routes, auth headers, or SDK behavior.

LayerRecommendation
Browser or mobile appDo not call Sandbox APIs directly. Call your backend.
Your backendOwns SEACLOUD_API_KEY, creates sandboxes, stores sandbox IDs, and exposes product-specific actions.
Agent runnerUses SDK helpers for commands/files and passes only task-specific data into the sandbox.
Sandbox runtimeReceives only the env vars, source files, and credentials needed for that workload.
Support dashboardReads sandbox detail, logs, metrics, usage limits, and observability summary.

This shape keeps SEACLOUD_API_KEY and envdAccessToken out of browser code and model-visible logs.

SDKInstall
Nodenpm install @seacloudai/sandbox
Pythonpip install seacloud-sandbox
Gogo get github.com/SeaCloudAI/sandbox-go
Terminal window
export SEACLOUD_BASE_URL="https://sandbox-service.real-cloud.seaart.ai/api/v1/sandbox"
export SEACLOUD_API_KEY="YOUR_API_KEY"
VariableRequiredPurpose
SEACLOUD_BASE_URLyesAPI base URL.
SEACLOUD_API_KEYyesAPI key sent as X-API-Key.
AreaNodePythonGo
CreateSandbox.create(...)Sandbox.create(...)sandbox.Create(...)
ConnectSandbox.connect(...)Sandbox.connect(...)sandbox.Connect(...)
Filessandbox.filessandbox.filessbx.Files()
Commandssandbox.commandssandbox.commandssbx.Commands()
Public URLsandbox.getHost(port)sandbox.get_host(port)sbx.GetHost(port)
Code interpretersandbox.runCode(...)sandbox.run_code(...)RunCode
Template buildsCLI / HTTP APICLI / HTTP APICLI / HTTP API
TaskPrefer
Product backend creates and operates sandboxesSDK
Agent orchestration with files, commands, and previewsSDK
Listing and pinning official templatesSDK or raw HTTP
Building custom templates from local sourceCLI, or HTTP API for backend integrations
Debugging route contracts or auth headersRaw HTTP
Building a low-level dashboard or gateway proxyRaw HTTP plus typed response models
Investigating SDK behaviorRaw HTTP reproduction with the same sandbox ID

SeaCloud Sandbox API calls:

X-API-Key: <SEACLOUD_API_KEY>

Runtime calls to envdUrl:

X-Access-Token: <envdAccessToken>

Runtime health endpoints are exceptions: GET {envdUrl}/health, GET {envdUrl}/, and OPTIONS * do not require runtime token auth.

MethodPathPurpose
POST/sandboxesCreate a sandbox.
GET/sandboxesList visible sandboxes.
GET/sandboxes/:sandboxIDFetch detail.
POST/sandboxes/:sandboxID/connectReconnect runtime access.
POST/sandboxes/:sandboxID/pausePause runtime.
POST/sandboxes/:sandboxID/refreshesRefresh TTL.
POST/sandboxes/:sandboxID/timeoutSet timeout in seconds.
DELETE/sandboxes/:sandboxIDDelete sandbox.
GET/usage/limitsRead sandbox quota usage.
GET/observability/summaryRead caller usage, quota checks, endpoint availability, and suggested actions.

Store opaque identifiers and public status fields. Do not parse IDs or derive infrastructure state from them.

FieldStore?Notes
sandboxIDYesPrimary key for detail, logs, metrics, connect, and delete.
templateIDYes, when returnedStore the resolved template for audit and reproducibility. Create requests may omit it to use base.
state / statusYesDisplay current lifecycle state.
timelineYes, optionalGood for user-facing progress.
diagnosticYes, optionalGood for troubleshooting copy and next actions.
envdUrlShort-lived onlyUse through SDK/runtime helpers; do not treat as permanent.
envdAccessTokenSecretNever expose to browser, users, or model prompts.
requestIDYes for errorsInclude in support tickets and logs.
MethodPathPurpose
GET/api/v1/templatesList visible templates.
GET/api/v1/templates/resolve/:refResolve official aliases or tags.
GET/api/v1/templates/:idFetch template detail.
GroupRoutes
REST helpersGET /files, POST /files, POST /files/batch, POST /files/compose, POST /run, GET/POST /file
Filesystem RPCPOST /filesystem.Filesystem/*
Process RPCPOST /process.Process/*
SurfaceRouteNotes
Sandbox logsGET /sandboxes/:sandboxID/logsSupports cursor, direction, level, search, and limit up to 1000.
Sandbox metricsGET /sandboxes/:sandboxID/metricsDashboard metric snapshot.
Fleet metricsGET /sandboxes/metricsBatch current metrics for visible sandboxes.
Runtime metricsGET {envdUrl}/metricsDirect runtime snapshot with X-Access-Token.

API errors use this shape:

{
"code": 400,
"message": "timeoutMs is no longer supported in sandbox create requests; use timeout seconds",
"requestID": "req-..."
}

For 429, inspect details.usageEndpoint and show scope, resource, metric, used, limit, and remaining to the user.

Sandbox and template commands use the SeaCloud login session:

Terminal window
seacloud auth login
seacloud auth status

Core sandbox workflow:

Terminal window
seacloud sandbox create base --no-connect --wait --output json --metadata app=agent
seacloud sandbox list --state running,paused --output json
seacloud sandbox exec <sandbox_id> "python --version"
seacloud sandbox logs <sandbox_id> --limit 100 --direction backward --output json
seacloud sandbox metrics <sandbox_id> --output json
seacloud sandbox connect <sandbox_id> --shell bash
seacloud sandbox pause <sandbox_id>
seacloud sandbox timeout <sandbox_id> --seconds 3600
seacloud --dry-run sandbox kill <sandbox_id>
seacloud sandbox kill <sandbox_id>

Network and storage helpers:

Terminal window
seacloud sandbox network update <sandbox_id> --allow-internet-access=false --allow-out 1.1.1.1/32
seacloud sandbox volume create cache
seacloud sandbox create base --volume-mount cache:/cache --no-connect --wait --output json

Events, webhooks, and observability:

Terminal window
seacloud sandbox events --type sandbox.lifecycle.created --limit 20
seacloud sandbox webhook create --name lifecycle --url https://example.com/webhook --secret <secret> --event sandbox.lifecycle.created
seacloud sandbox webhook deliveries --status failed --limit 20
seacloud sandbox observability

Template projects and builds:

Terminal window
seacloud template init --language typescript --name my-template
seacloud template build my-template --dockerfile Dockerfile --tag v1
seacloud template list --format json
seacloud template get <template_id>
seacloud template logs <template> <build_id> --limit 100

For the full command list, see SeaCloud CLI command reference.