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.
(*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.
(*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.
(*SandboxPage, error)
declaw.KillSandbox()
Kill a sandbox by ID.
declaw.KillManySandboxes()
Kill multiple sandboxes in a single call.
([]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.
(*Sandbox, error)
Instance methods
sbx.Kill()
Kill and destroy the sandbox.
error
sbx.IsRunning()
Check whether the sandbox is currently live.
(bool, error)
sbx.SetTimeout()
Update the sandbox timeout in seconds.
error
sbx.GetInfo()
Fetch current metadata and state.
(*SandboxInfo, error)
sbx.GetMetrics()
Retrieve CPU, memory, and disk usage metrics.
(*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.
(*SnapshotInfo, error)
sbx.ListSnapshots()
List all snapshots for this sandbox.
([]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).
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".
string
Properties
Data models
SandboxInfo
SandboxState
SandboxMetrics
SandboxLifecycle
SnapshotInfo
SandboxNetworkOpts
Lower-level network config used directly inCreate(WithNetwork(...)). For security-policy-level
network rules, see NetworkPolicy.