Skip to main content

StateSet Sandbox

Self-hosted Kubernetes sandbox infrastructure for running AI agents and code execution workloads in isolated containers. REST and WebSocket APIs for creating sandboxes, streaming command output, and managing files.

Skill Files

Check for updates: Re-fetch these files anytime to see new features!

API Base URL

Environment Variables:

Architecture Overview

Key Capabilities:
  • Isolated execution per sandbox pod with resource limits
  • REST and WebSocket APIs for command execution and streaming
  • File read/write APIs for workspace workflows
  • Prebuilt runtime with Node.js, Python, Go, Rust, and CLI tools
  • Automatic cleanup with per-sandbox timeouts
  • Warm pool support for sub-100ms startup

Agent Registration

AI agents must register to receive an API key for authentication.

Register a New Agent

Response:
Important: Store the api_key securely. It is only returned once.

Authentication

All API requests require authentication:
Or with Bearer token (JWT):

Quick Start

1. Create a Sandbox

Response:

2. Write Files

3. Execute Commands

Response:

4. Read Files

Response:

5. Stop Sandbox


TypeScript SDK

Installation

Basic Usage

Streaming Execution

Extended SDK (Advanced Features)


Python SDK

Installation

Basic Usage

Running Claude Code Agent


WebSocket API

Connect for real-time streaming:

API Reference

Sandbox Lifecycle

File Operations

Command Execution

Execute Request:

Checkpoints

Artifacts (Cloud Storage)

MCP Servers

Agent Sessions

API Keys

Webhooks

Tunnels (Port Forwarding)


Create Sandbox Options


Agent Sessions

Long-running agent sessions with automatic sandbox rotation:
Session States:
  • pending - Created, not started
  • running - Active execution
  • rotating - Sandbox rotation in progress
  • paused - Temporarily suspended
  • completed - Successfully finished
  • failed - Error occurred
  • cancelled - Manually stopped

MCP Server Integration

Start Model Context Protocol servers inside sandboxes:
Built-in MCP Presets:
  • filesystem - File operations
  • github - GitHub repository access
  • postgres - PostgreSQL queries
  • slack - Slack messaging
  • brave-search - Web search
  • puppeteer - Browser automation

Checkpoints

Save and restore sandbox state:

Webhooks

Subscribe to sandbox events:
Webhook Events:
  • sandbox.created, sandbox.ready, sandbox.stopped, sandbox.error, sandbox.timeout
  • command.started, command.completed, command.failed
  • file.written, artifact.uploaded, artifact.deleted
  • checkpoint.created, checkpoint.restored, checkpoint.deleted
  • mcp.started, mcp.stopped
  • resource.warning, resource.critical
  • security.alert

Configuration

Environment Variables


Self-Hosted Deployment

Prerequisites

  • Kubernetes cluster (1.24+)
  • kubectl configured
  • PostgreSQL database
  • Redis (optional, for warm pools)

Deploy

Configure Secrets


Security

Container Isolation

  • Non-root user: Runs as UID 1001
  • Dropped capabilities: ALL capabilities dropped
  • Seccomp profile: Enabled by default
  • Read-only filesystem: Only /workspace is writable
  • Resource limits: CPU, memory, ephemeral storage enforced

Network Isolation

  • Egress allowed: HTTPS (443), DNS (53)
  • Private ranges blocked: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
  • Network policies: Restrictive by default

Authentication

  • API Keys: Revocable, organization-scoped
  • JWTs: Signed with secret, expiring tokens
  • Rate limiting: Per-organization limits

Preinstalled Tools

Each sandbox includes:

Quick Reference

CLI Commands (curl)

SDK Quick Reference


Ideas to Try

  • Register and create your first sandbox
  • Run a Claude Code agent to generate and test code
  • Set up checkpoints to save and restore work
  • Use MCP servers for database or GitHub integration
  • Create agent sessions for long-running tasks
  • Set up webhooks for real-time notifications
  • Deploy self-hosted with warm pools for fast startup
  • Use GPU sandboxes for ML workloads

StateSet Sandbox v0.4.0 January 2026