New

CodeSandbox is now part of Together AI! We have joined forces to launch CodeSandbox SDK and bring code interpretation to generative AI.

Learn more
About CodeSandbox

CodeSandbox
SDK

Programmatically spin up development environments

Use our API to create and run isolated development environments quickly and securely.

Get started in seconds

npm install @codesandbox/sdk
import { CodeSandbox } from "@codesandbox/sdk";
  
const sdk = new CodeSandbox();

const sandbox = await sdk.sandbox.create();
const result = await sandbox.shells.python.run("print(1+1)");

// Live clone the sandbox to a second version
const sandbox2 = await sandbox.fork();

// Checkpoint the sandbox by hibernating it
await sandbox.hibernate();
  • checkSupports VM snapshot/restore & cloning within seconds.
  • checkPersistence of sandboxes using git source control.
  • checkPrebuild custom snapshots using Docker.
  • checkFully integrates with Together AI inference.
  • checkData centers close to you (US, APAC or EMEA)

Built for AI use cases and more

AI agents

Give agents a Devbox to resolve user prompts, or create autonomous agents running on Devboxes. You can run multiple agents in parallel without them interfering with each other. Using the forking mechanism, you can also A/B test different agents.

Development environments at scale

Create a Devbox for each developer or student, and run their code in the Devbox. This way, you can run multiple development environments in parallel without them interfering with each other.

Secure code interpretation & evals

Run code in a Devbox to interpret it. This way, you can run untrusted code without worrying about it affecting your system. You can also run popular evals on any piece of code.

CI/CD

Run tests inside a Devbox, and hibernate the Devbox when the tests are done. This way, you can quickly start the Devbox again when you need to run the tests again or evaluate the results.

Secure code generation at scale

Settings

Powerful API

Use our API to create isolated development environments (Devboxes) that can run any type of code you need.

Lock

Secure & isolated

Every environment runs in isolation, so you can safely run untrusted code without it affecting your system.

Dns

Ready for scale

We can handle millions of concurrent VMs and make it easy to provision, manage and decommission VMs.

Cloud

Continuous context

Resume development within the same Devbox after periods of inactivity. With no loss thanks to our snapshots.

Sync

Quick start & auto resume

Our microVM infrastructure allows us to spin up entire VMs, clone them and restore snapshots within 2 seconds.

Schedule

Customizable hibernation

Gain total control over periods of inactivity before auto hibernation kicks in.

Frequently asked questions

Yes. You need a CodeSandbox API key to use CodeSandbox SDK, which you can get by creating a CodeSandbox account.

Start building today

npm install @codesandbox/sdk