Skip to main content

StateSet Sandbox - Quick Start

Get up and running with StateSet Sandbox in 5 minutes.

1. Get Your API Key

Save the api_key from the response — you’ll need it!

2. Install the SDK

TypeScript / Node.js:
Python:
Other language SDKs (preview) are available in this repo:
  • Rust: sdk-rust/README.md
  • Ruby: sdk-ruby/README.md
  • Go: sdk-go/README.md
  • PHP: sdk-php/README.md
  • Java: sdk-java/README.md
  • Kotlin: sdk-kotlin/README.md
  • Swift: sdk-swift/README.md

3. Create Your First Sandbox

TypeScript

Python

cURL

4. Write and Read Files

TypeScript

Python

5. Interactive REPL Sessions

REPL sessions let you execute code interactively with persistent state across calls — ideal for data exploration, iterative development, and AI agent workflows.
Note: Requires REPL_ENABLED=true on the controller.

cURL

TypeScript

6. Choose a Template

Templates pre-configure your sandbox with the right tools:

Validate Computer-Use Template (optional)

7. Use with AI Frameworks

StateSet Sandbox integrates with popular AI frameworks so your agents can execute code safely:

LangChain

Full LangChain Guide →

OpenAI Function Calling

Full OpenAI Guide →

Vercel AI SDK

Full Vercel AI SDK Guide →

8. Full Example: AI Agent Task

Environment Variables

What’s Next?

  • Python SDK Guide — full Python reference
  • Node.js SDK Guide — full TypeScript reference
  • LangChain Guide — build LangChain agents with sandboxes
  • OpenAI Guide — OpenAI function calling integration
  • Vercel AI SDK Guide — AI SDK tool integration
  • Templates Guide — all available sandbox templates
  • API Reference — full REST API documentation
  • Production Guide — deployment and operations

Troubleshooting

Auth failures (401/403)
  • Verify STATESET_API_KEY is set and valid.
  • For API key auth (non-JWT), ensure the key belongs to your org.
Rate limits or plan limits
  • Check your plan’s max runtime and concurrent sandbox limits.
  • Reduce CPU/memory or shorten timeouts if you hit rate limits.
Command timeouts
  • Increase timeout for long-running commands (up to 10 minutes).
  • Prefer smaller steps and check stdout/stderr for partial output.
Artifacts return 404
  • Artifact routes require ARTIFACTS_ENABLED=true and storage config.