Run Coding Agents in Sandboxes. Control Them Over HTTP. Supports Claude Code, Codex, OpenCode, and Amp.
Repo: rivet-dev/sandbox-agent
What's inside
Running coding agents remotely is hard. Existing SDKs assume local execution, SSH breaks TTY handling and streaming, and every agent has a different API. Building from scratch means reimplementing everything for each coding agent.
Sandbox Agent solves three problems:
Coding agents need sandboxes โ You can't let AI execute arbitrary code on your production servers. Coding agents need isolated environments, but existing SDKs assume local execution. Sandbox Agent is a server that runs inside the sandbox and exposes HTTP/SSE.
Every coding agent is different โ Claude Code, Codex, OpenCode, Cursor, Amp, and Pi each have proprietary APIs, event formats, and behaviors. Swapping agents means rewriting your integration. Sandbox Agent provides one HTTP API โ write your code once, swap agents with a config change.
Sessions are ephemeral โ Agent transcripts live in the sandbox. When the process ends, you lose everything. Sandbox Agent streams events in a universal schema to your storage. Persist to Postgres, ClickHouse, or Rivet. Replay later, audit everything.

The Sandbox Agent acts as a universal adapter between your client application and various coding agents. Each agent has its own adapter that handles the translation between the universal API and the agent-specific interface.
| Component | Description |
|---|---|
| Server | Rust daemon (sandbox-agent server) exposing the HTTP + SSE API |
| SDK | TypeScript client with embedded and server modes |
| Inspector | Built-in UI at inspecting sessions and events |
| CLI | sandbox-agent (same binary, plus npm wrapper) mirrors the HTTP endpoints |
Choose the installation method that works best for your use case.
Install skill with:
npx skills add rivet-dev/skills -s sandbox-agent
bunx skills add rivet-dev/skills -s sandbox-agent
Import the SDK directly into your Node or browser application. Full type safety and streaming support.
Install
npm install sandbox-agent@0.4.x
bun add sandbox-agent@0.4.x
# Optional: allow Bun to run postinstall scripts for native binaries (required for SandboxAgent.start()).
bun pm trust @sandbox-agent/cli-linux-x64 @sandbox-agent/cli-linux-arm64 @sandbox-agent/cli-darwin-arm64 @sandbox-agent/cli-darwin-x64 @sandbox-agent/cli-win32-x64
Setup
Local (embedded mode):
import { SandboxAgent } from "sandbox-agent";
const client = await SandboxAgent.start();
Remote (server mode):
import { SandboxAgent } from "sandbox-agent";
const client = await SandboxAgent.connect({
baseUrl: "http://127.0.0.1:2468",
token: process.env.SANDBOX_TOKEN,
});
API Overview
const agents = await client.listAgents();
await client.createSession("demo", {
agent: "codex",
agentMode: "default",
});
await client.postMessage("demo", { message: "Hello from the SDK." });
for await (const event of client.streamEvents("demo", { offset: 0 })) {
console.log(event.type, event.data);
}
SDK documentation โ Managing Sessions
Run as an HTTP server and connect from any language. Deploy to E2B, Daytona, Vercel, or your own infrastructure.
# Install it
curl -fsSL https://releases.rivet.dev/sandbox-agent/0.4.x/install.sh | sh
# Run it
sandbox-agent server --token "$SANDBOX_TOKEN" --host 127.0.0.1 --port 2468
Optional: preinstall agent binaries (no server required; they will be installed lazily on first use if you skip this):
sandbox-agent install-agent --all
To disable auth locally:
sandbox-agent server --no-token --host 127.0.0.1 --port 2468
Quickstart โ Deployment guides
Install the CLI wrapper (optional but convenient):
npm install -g @sandbox-agent/cli@0.4.x
# Allow Bun to run postinstall scripts for native binaries.
bun add -g @sandbox-agent/cli@0.4.x
bun pm -g trust @sandbox-agent/cli-linux-x64 @sandbox-agent/cli-linux-arm64 @sandbox-agent/cli-darwin-arm64 @sandbox-agent/cli-darwin-x64 @sandbox-agent/cli-win32-x64
Create a session and send a message:
sandbox-agent api sessions create my-session --agent codex --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
sandbox-agent api sessions send-message my-session --message "Hello" --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
sandbox-agent api sessions send-message-stream my-session --message "Hello" --endpoint http://127.0.0.1:2468 --token "$SANDBOX_TOKEN"
You can also use npx like:
npx @sandbox-agent/cli@0.4.x --help
bunx @sandbox-agent/cli@0.4.x --help
Debug sessions and events with the built-in Inspector UI (e.g., http://localhost:2468/ui/).

Explore API โ View Specification
Often you need to use your personal API tokens to test agents on sandboxes:
sandbox-agent credentials extract-env --export
This prints environment variables for your OpenAI/Anthropic/etc API keys to test with Sandbox Agent SDK.
No, they're complementary. AI SDK is for building chat interfaces and calling LLMs. This SDK is for controlling autonomous coding agents that write code and run commands. Use AI SDK for your UI, use this when you need an agent to actually code.
Claude Code, Codex, OpenCode, Cursor, Amp, and Pi. The SDK normalizes their APIs so you can swap between them without changing your code.
This SDK does not handle persisting session data. Events stream in a universal JSON schema that you can persist anywhere. See Managing Sessions for patterns using Postgres or Rivet Actors.
Both. Run locally for development, deploy to E2B, Daytona, or Vercel Sandboxes for production.
The server is a single Rust binary that runs anywhere with a curl install. If your platform can run Linux binaries (Docker, VMs, etc.), it works. See the deployment guides for E2B, Daytona, and Vercel Sandboxes.
Yes. Use sandbox-agent credentials extract-env to extract API keys from your local agent configs (Claude Code, Codex, OpenCode, Amp, Pi) and pass them to the sandbox environment.
Rust gives us a single static binary, fast startup, and predictable memory usage. That makes it easy to run inside sandboxes or in CI without shipping a large runtime, such as Node.js.
You can for development. But in production, you need isolation. Coding agents execute arbitrary code โ that can't happen on your servers. Sandboxes provide the isolation; this SDK provides the HTTP API to control coding agents remotely.
Official SDKs assume local execution. They spawn processes and expect interactive terminals. This SDK runs a server inside a sandbox that you connect to over HTTP โ designed for remote control from the start.
Coding agents expect interactive terminals with proper TTY handling. SSH with piped commands breaks tool confirmations, streaming output, and human-in-the-loop flows. The SDK handles all of this over a clean HTTP API.
.agents/
skills/
agent-browser/
references/
authentication.md
proxy-support.md
session-management.md
snapshot-refs.md
video-recording.md
SKILL.md
templates/
authenticated-session.sh
capture-workflow.sh
form-automation.sh
.claude/
commands/
post-release-testing.md
release.md
skills/
agent-browser
frontend-design
vercel-react-best-practices
.codex/
skills/
agent-browser
frontend-design
vercel-react-best-practices
.dockerignore
.env.development.example
.github/
actions/
docker-setup/
action.yaml
media/
agent-diagram.gif
banner.png
gigacode-header.jpeg
inspector.png
og.png
workflows/
ci.yaml
claude-code-review.yml
claude.yml
release.yaml
skill-generator.yml
.gitignore
.mcp.json
.npmrc
.opencode/
skills/
frontend-design
vercel-react-best-practices
AGENTS.md
biome.json
Cargo.toml
CLAUDE.md
CONTRIBUTING.md
docker/
inspector-dev/
Dockerfile
release/
build.sh
linux-aarch64.Dockerfile
linux-x86_64.Dockerfile
macos-aarch64.Dockerfile
macos-x86_64.Dockerfile
windows.Dockerfile
runtime/
Dockerfile
Dockerfile.full
test-agent/
Dockerfile
test-common-software/
Dockerfile
docs/
agent-sessions.mdx
agents/
amp.mdx
claude.mdx
codex.mdx
cursor.mdx
opencode.mdx
pi.mdx
ai/
llms-txt.mdx
skill.mdx
architecture.mdx
attachments.mdx
cli.mdx
common-software.mdx
computer-use.mdx
cors.mdx
custom-tools.mdx
daemon.mdx
deploy/
agentcomputer.mdx
boxlite.mdx
cloudflare.mdx
computesdk.mdx
daytona.mdx
docker.mdx
e2b.mdx
local.mdx
modal.mdx
vercel.mdx
docs.json
favicon.svg
file-system.mdx
images/
inspector.png
inspector.mdx
llm-credentials.mdx
logo/
dark.svg
light.svg
manage-sessions.mdx
mcp-config.mdx
multiplayer.mdx
observability.mdx
openapi.json
opencode-compatibility.mdx
orchestration-architecture.mdx
processes.mdx
quickstart.mdx
react-components.mdx
sdk-overview.mdx
security.mdx
session-persistence.mdx
session-restoration.mdx
skills-config.mdx
telemetry.mdx
theme.css
troubleshooting.mdx
examples/
agentcomputer/
package.json
src/
index.ts
tests/
agentcomputer.test.ts
tsconfig.json
boxlite/
boxlite-python/
.gitignore
client.py
credentials.py
Dockerfile
main.py
requirements.txt
setup_image.py
.gitignore
Dockerfile
package.json
src/
index.ts
setup-image.ts
tsconfig.json
CLAUDE.md
cloudflare/
.gitignore
Dockerfile
frontend/
App.tsx
index.html
main.tsx
package.json
README.md
src/
index.ts
prompt-endpoint.ts
tests/
cloudflare.test.ts
tsconfig.json
vite.config.ts
vitest.config.ts
wrangler.jsonc
computesdk/
package.json
src/
index.ts
tests/
computesdk.test.ts
tsconfig.json
daytona/
package.json
src/
daytona.ts
index.ts
tests/
daytona.test.ts
tsconfig.json
docker/
docker-python/
.gitignore
client.py
credentials.py
main.py
requirements.txt
package.json
src/
index.ts
tests/
docker.test.ts
tsconfig.json
e2b/
package.json
src/
e2b.ts
index.ts
tests/
e2b.test.ts
tsconfig.json
file-system/
package.json
src/
index.ts
tsconfig.json
mcp/
mcp-custom-tool/
package.json
src/
index.ts
mcp-server.ts
tsconfig.json
package.json
src/
index.ts
tsconfig.json
mock-acp-agent/
package.json
README.md
src/
index.ts
tsconfig.build.json
tsconfig.json
modal/
package.json
src/
index.ts
tests/
modal.test.ts
tsconfig.json
permissions/
package.json
src/
index.ts
tsconfig.json
persist-memory/
package.json
src/
index.ts
tsconfig.json
persist-postgres/
package.json
src/
index.ts
persist.ts
tsconfig.json
persist-sqlite/
package.json
src/
index.ts
persist.ts
tsconfig.json
shared/
package.json
src/
docker.ts
sandbox-agent-client.ts
tsconfig.json
skills/
skills-custom-tool/
package.json
SKILL.md
src/
index.ts
random-number.ts
tsconfig.json
package.json
src/
index.ts
tsconfig.json
sprites/
package.json
src/
index.ts
tests/
sprites.test.ts
tsconfig.json
vercel/
.gitignore
package.json
src/
index.ts
vercel.ts
tests/
vercel.test.ts
tsconfig.json
foundry/
AGENT-HANDOFF.md
AGENTS.md
CLAUDE.md
compose.dev.yaml
compose.mock.yaml
compose.preview.yaml
CONTRIBUTING.md
docker/
backend.dev.Dockerfile
backend.Dockerfile
backend.preview.Dockerfile
foundry-base.Dockerfile
frontend-caddy-entrypoint.sh
frontend.Caddyfile
frontend.dev.Dockerfile
frontend.Dockerfile
frontend.mock.Dockerfile
frontend.preview.Dockerfile
nginx.preview.conf
e2e/
wb-mmilw7yh.txt
wb-mmilzdwf.txt
FOUNDRY-CHANGES.md
foundry-cloud.md
memory/
roadmap.md
packages/
backend/
CLAUDE.md
package.json
src/
actors/
_scripts/
generate-actor-migrations.ts
audit-log/
db/
db.ts
drizzle/
drizzle.config.ts
0000_fluffy_kid_colt.sql
0001_add_repo_id.sql
meta/
_journal.json
0000_snapshot.json
0001_snapshot.json
migrations.ts
schema.ts
index.ts
context.ts
github-data/
db/
db.ts
migrations.ts
schema.ts
index.ts
workflow.ts
handles.ts
index.ts
keys.ts
logging.ts
organization/
actions/
actions.ts
app.ts
better-auth.ts
github.ts
onboarding.ts
organization.ts
task-mutations.ts
tasks.ts
app-shell.ts
constants.ts
db/
db.ts
drizzle/
drizzle.config.ts
0000_melted_viper.sql
0001_add_auth_and_task_tables.sql
meta/
_journal.json
0000_snapshot.json
migrations.ts
schema.ts
index.ts
queues.ts
workflow.ts
polling.ts
sandbox/
index.ts
task/
db/
db.ts
drizzle/
drizzle.config.ts
0000_charming_maestro.sql
meta/
_journal.json
0000_snapshot.json
migrations.ts
schema.ts
index.ts
... 898 moreFAQ
sandbox-agent is a Claude Code plugin with hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.