Skip to content
Home

SDK & CLI Guide

Use SDKs for application integrations. Use raw HTTP when debugging wire contracts, building internal tools, or validating gateway 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-gateway.cloud.seaart.ai"
export SEACLOUD_API_KEY="YOUR_API_KEY"
VariableRequiredPurpose
SEACLOUD_BASE_URLyesGateway 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 buildsTemplate.build(...)Template.build(...)sandbox.BuildTemplate(...)
TaskPrefer
Product backend creates and operates sandboxesSDK
Agent orchestration with files, commands, and previewsSDK
Building custom templates from local sourceSDK
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

Control-plane 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/api/v1/sandboxesCreate a sandbox.
GET/api/v1/sandboxesList visible sandboxes.
GET/api/v1/sandboxes/:sandboxIDFetch detail.
POST/api/v1/sandboxes/:sandboxID/connectReconnect runtime access.
POST/api/v1/sandboxes/:sandboxID/pausePause runtime.
POST/api/v1/sandboxes/:sandboxID/refreshesRefresh TTL.
POST/api/v1/sandboxes/:sandboxID/timeoutSet timeout in seconds.
DELETE/api/v1/sandboxes/:sandboxIDDelete sandbox.
GET/api/v1/usage/limitsRead sandbox quota usage.
GET/api/v1/usage/template-limitsRead template/build quota usage.
GET/api/v1/observability/summaryRead user/project 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.
templateIDYesRequired for audit and reproducibility.
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
POST/api/v1/templatesCreate custom template metadata.
GET/api/v1/templatesList visible templates.
GET/api/v1/templates/resolve/:refResolve official aliases or tags.
GET/api/v1/templates/:idFetch template detail.
POST/api/v1/templates/:id/builds/:buildIDStart a build.
GET/api/v1/templates/:id/builds/:buildID/statusPoll build status.
GET/api/v1/templates/:id/builds/:buildID/logsRead build logs.
POST/api/v1/templates/:id/rollbackRoll back to a ready build.
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 /api/v1/sandboxes/:sandboxID/logsSupports cursor, direction, level, search, and limit up to 1000.
Build logsGET /api/v1/templates/:id/builds/:buildID/logsSupports cursor, direction, level, and limit up to 100.
Sandbox metricsGET /api/v1/sandboxes/:sandboxID/metricsControl-plane snapshot for dashboards.
Fleet metricsGET /api/v1/sandboxes/metricsBatch current metrics for visible sandboxes.
Runtime metricsGET {envdUrl}/metricsDirect runtime snapshot with X-Access-Token.

Control-plane errors use this shape:

{
"code": 400,
"message": "templateID is required",
"requestID": "req-..."
}

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

Use SDKs or raw HTTP for the MVP sandbox integration path.