Skip to main content
Superserve provides isolated cloud sandboxes (Firecracker microVMs) for running AI-generated code. The sandbox persists across tool calls, so files your agent writes and packages it installs remain available. Every tool has a sync and an async variant, so the toolkit works with both agent.run() and agent.arun().

Prerequisites

The following example requires the superserve and openai packages:
You will also need a Superserve API key. You can get it from superserve.ai:

Example

This example creates an agent that writes and executes code in a Superserve sandbox:
cookbook/91_tools/superserve_tools.py

Sandbox Reuse

With persistent=True (the default), the sandbox ID is stored in the agent’s session state. The same sandbox is reused across tool calls and across runs in the same session. Pass sandbox_id to connect to a specific existing sandbox instead of creating a new one. Sandboxes are created from the superserve/code-interpreter template by default, which ships with Python 3.11 and pip. Override it for other runtimes:

Secrets

Bind team secrets to the sandbox without exposing the real credential. The sandbox sees a proxy token; the real value is swapped in only for outbound requests to the secret’s allowed hosts:

Toolkit Params

Toolkit Functions

Each function has an async variant with the same tool name, used automatically with agent.arun().

Developer Resources