fetch support.
Installation
Environment variables
ConnectionConfig
ConnectionConfig holds the API key, domain, port, and base URL. It is constructed automatically when you pass apiKey and domain to Sandbox.create(). Instantiate it directly when you need to share connection settings.
ConnectionConfigOptions
API key sent as
X-API-Key. Defaults to process.env.DECLAW_API_KEY.Hostname of the Declaw API. Supports
host:port format — the port is
parsed from the string.Explicit port override. Ignored when
domain already contains a port.Full URL override (e.g.
http://localhost:8080). When set, domain,
port, and scheme detection are bypassed.Default per-request HTTP timeout in milliseconds.
Properties
| Property | Type | Description |
|---|---|---|
config.apiKey | string | Resolved API key. |
config.domain | string | Resolved hostname (without port). |
config.port | number | Resolved port. |
config.apiUrl | string | Fully constructed base URL. |
config.requestTimeout | number | undefined | Default timeout in ms. |
SandboxOpts
SandboxOpts is the options object passed to Sandbox.create().
Template ID or alias to boot.
Sandbox lifetime in seconds.
Arbitrary key-value pairs attached to the sandbox.
Environment variables injected at boot time.
Whether to enable the MITM security proxy.
When
false, blocks all outbound traffic (deny_out: ["0.0.0.0/0"]).Fine-grained network configuration. Overrides
allowInternetAccess.Full security policy. See Security Policy.
Resource constraints (e.g.
{ cpu: 2, memory_mb: 2048 }).Sandbox lifecycle settings (
onTimeout, autoResume).API key override for this call.
Domain override for this call.
Full URL override for this call.
Per-request HTTP timeout in milliseconds.
Quick example
Using await using (TypeScript 5.2+)
await using calls sbx.close() which releases the HTTP client but does
not kill the sandbox. Call await sbx.kill() explicitly to destroy the
sandbox.