Sandbox / SandboxOpts
Interface: SandboxOpts
Options for creating a new Sandbox.
Extends
ConnectionOpts
Properties
allowInternetAccess?
optionalallowInternetAccess?:boolean
Allow sandbox to access the internet. If set to False, it works the same as setting network denyOut to [0.0.0.0/0].
Default
trueapiHeaders?
optionalapiHeaders?:Record<string,string>
Additional headers to send with AgentBox API requests.
Inherited from
ConnectionOpts.apiHeaders
apiKey?
optionalapiKey?:string
AgentBox API key to use for authentication.
Default
AGENTBOX_API_KEY // environment variableInherited from
ConnectionOpts.apiKey
domain?
optionaldomain?:string
Domain to use for the API.
Default
AGENTBOX_DOMAIN // environment variable or agentbox-runtime.ru
Inherited from
ConnectionOpts.domain
envs?
optionalenvs?:Record<string,string>
Custom environment variables for the sandbox.
Used when executing commands and code in the sandbox. Can be overridden with the envs argument when executing commands or code.
Default
{}iam?
optionaliam?:SandboxIamOpts
Sandbox workload identity configuration. Providing a non-empty tokens map enables workload identity for the sandbox.
Registered tokens are exposed to SandboxNetworkOpts.rulestransform callbacks as iam.tokens.<name> placeholders, which the egress proxy resolves per request.
Example
const sandbox = await Sandbox.create({
iam: {
tokens: {
aws: {
audience: 'sts.amazonaws.com',
tokenType: 'JWT-SVID',
},
},
},
})lifecycle?
optionallifecycle?:SandboxLifecycle
Sandbox lifecycle configuration.
logger?
optionallogger?:Logger
Logger to use for logging messages. It can accept any object that implements Logger interface—for example, console.
Inherited from
ConnectionOpts.logger
metadata?
optionalmetadata?:Record<string,string>
Custom metadata for the sandbox.
Default
{}network?
optionalnetwork?:SandboxNetworkOpts
Sandbox network configuration
proxy?
optionalproxy?:string
Proxy URL to use for requests. In case of a sandbox it applies to all requests made to the returned sandbox.
Example
'http://user:pass@127.0.0.1:8080'Inherited from
ConnectionOpts.proxy
requestTimeoutMs?
optionalrequestTimeoutMs?:number
Timeout for requests to the API in milliseconds.
Default
60_000 // 60 secondsInherited from
ConnectionOpts.requestTimeoutMs
sandboxUrl?
optionalsandboxUrl?:string
Sandbox URL. Used for local development
Overrides
ConnectionOpts.sandboxUrl
secure?
optionalsecure?:boolean
Secure all traffic coming to the sandbox controller with auth token
Default
truesignal?
optionalsignal?:AbortSignal
An optional AbortSignal that can be used to cancel the in-flight request. When the signal is aborted, the underlying fetch is aborted and the returned promise rejects with an AbortError.
Inherited from
ConnectionOpts.signal
template?
optionaltemplate?:string
Sandbox template name or ID.
Default
'base'timeoutMs?
optionaltimeoutMs?:number
Timeout for the sandbox in milliseconds. Maximum time a sandbox can be kept alive is 24 hours (86_400_000 milliseconds) for Pro users and 1 hour (3_600_000 milliseconds) for Hobby users.
Default
300_000 // 5 minutes