Skip to main content

Overview

The Runtime API manages Docker-based sandboxed environments for secure tool execution. Each agent runs in an isolated container with its own filesystem and network.

Getting the Runtime

get_runtime

Returns the global runtime instance based on configuration.
AbstractRuntime
Runtime instance (currently DockerRuntime)
Example:

AbstractRuntime

Base interface for runtime implementations.

create_sandbox

Creates or retrieves a sandboxed environment.
str
required
Unique identifier for the agent
str | None
Authentication token to reuse
list[dict[str, str]] | None
Local directories to mount in the sandbox
SandboxInfo
Sandbox information dictionary
Example:

get_sandbox_url

Returns the host-accessible URL for a container port.
str
required
Docker container ID
int
required
Container port number
str
Accessible URL (e.g., “http://127.0.0.1:49152”)

destroy_sandbox

Stops and removes a sandbox container.
str
required
Container ID to destroy
Example:

cleanup

Cleans up runtime resources asynchronously.

DockerRuntime

Docker-based runtime implementation.

Configuration

Configure via environment variables:

Container Features

The Docker sandbox provides:
  • Isolated filesystem - Each container has /workspace for file operations
  • Network access - Containers can make external HTTP requests
  • Tool server - Built-in HTTP server for executing tools
  • Caido proxy - Integrated proxy for HTTP traffic analysis
  • Security - Runs as non-root user with limited capabilities

Container Lifecycle

Containers are shared across agents in the same scan:
  1. First agent creates the container
  2. Subsequent agents reuse the same container
  3. Local sources are copied only once
  4. Container persists until explicitly destroyed or cleanup
Example:

Exceptions

SandboxInitializationError

Raised when sandbox creation or initialization fails.
str
required
Error message
str | None
Additional error details
Example:

Cleanup

cleanup_runtime

Cleans up the global runtime instance and all containers. Example:

Advanced Usage

Custom Local Sources

Accessing Container Services

Environment Variables

str
default:"'docker'"
Runtime backend to use (currently only “docker” supported)
str
default:"'ghcr.io/usestrix/strix-sandbox:0.1.12'"
Docker image for sandboxes
str
default:"'120'"
Tool execution timeout in seconds
str
default:"'10'"
Connection timeout in seconds
str
default:"None"
Custom Docker host URL (e.g., “tcp://192.168.1.100:2376”)