Skip to main content
Sandbox is the central type. Every instance exposes .Commands, .Files, and .PTY sub-objects for interacting with the sandbox.

Package-level functions

declaw.Create()

Create a new sandbox and return a connected *Sandbox.
string
default:"'base'"
Template ID or alias to boot. Defaults to "base" (Ubuntu 22.04).
int
default:"300"
Sandbox lifetime in seconds. The sandbox is killed automatically when the timeout expires unless WithLifecycle sets OnTimeout to "pause".
map[string]string
Arbitrary key-value pairs attached to the sandbox.
map[string]string
Environment variables injected into the sandbox at boot time.
bool
default:"server default (typically true)"
Whether to enable the security proxy. When not specified, the server applies its default. Set to false only for trusted workloads where TLS interception overhead is unacceptable.
SandboxNetworkOpts
Fine-grained network configuration. See SandboxNetworkOpts below.
SecurityPolicy
Full security policy including PII detection, injection defense, transformations, audit, and env masking. See SecurityPolicy.
SandboxLifecycle
Controls sandbox behaviour on timeout. See SandboxLifecycle.
[]VolumeAttachment
Persistent volumes to attach at boot. See Volumes.
Returns (*Sandbox, error)

declaw.Connect()

Connect to an existing sandbox by ID without creating a new one.
string
required
The ID of the sandbox to connect to.
Returns (*Sandbox, error)

declaw.ListSandboxes()

List sandboxes with optional filtering and pagination.
SandboxState
Filter by state (StateLive, StatePaused, StateKilled).
int
Maximum number of results to return.
int
Offset for pagination.
string
API key override for this call.
string
API URL override for this call.
Returns (*SandboxPage, error)

declaw.KillSandbox()

Kill a sandbox by ID.

declaw.KillManySandboxes()

Kill multiple sandboxes in a single call.
Returns ([]KillResult, error)

declaw.Restore()

Restore a sandbox from a snapshot.
string
required
The sandbox to restore.
string
Specific snapshot to restore from. If omitted, the most recent snapshot is used.
string
API key override for this call.
string
API URL override for this call.
Returns (*Sandbox, error)

Instance methods

sbx.Kill()

Kill and destroy the sandbox.
Returns error

sbx.IsRunning()

Check whether the sandbox is currently live.
Returns (bool, error)

sbx.SetTimeout()

Update the sandbox timeout in seconds.
Returns error

sbx.GetInfo()

Fetch current metadata and state.
Returns (*SandboxInfo, error)

sbx.GetMetrics()

Retrieve CPU, memory, and disk usage metrics.
Returns (*SandboxMetrics, error)

sbx.Pause()

Pause the sandbox, taking a snapshot of its state.

sbx.Resume()

Resume a previously paused sandbox.

sbx.CreateSnapshot()

Create a snapshot of the sandbox’s current state.
Returns (*SnapshotInfo, error)

sbx.ListSnapshots()

List all snapshots for this sandbox.
Returns ([]SnapshotInfo, error)

sbx.DeleteSnapshot()

Delete a snapshot by ID.

sbx.GetHost()

Return the URL that reverse-proxies HTTP traffic to the given port inside the sandbox. Requires AllowPublicTraffic to be enabled in the sandbox’s network config (the default).
Parameters: port int Returns: string

sbx.GetMcpURL()

Return the URL for an MCP server listening on port 50005 inside the sandbox. Equivalent to sbx.GetHost(50005) + "/mcp".
Returns: string

Properties


Data models

SandboxInfo

SandboxState

SandboxMetrics

SandboxLifecycle

SnapshotInfo

SandboxNetworkOpts

Lower-level network config used directly in Create(WithNetwork(...)). For security-policy-level network rules, see NetworkPolicy.

SandboxPage