sdk
CodeSandbox is now part of Together AI! We have joined forces to launch CodeSandbox SDK and bring code interpretation to generative AI.
CodeSandbox SDK
Programmatically spin up development environments
Use our API to create and run isolated development environments quickly and securely.
Try the open beta Read the Docs
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 agents and more
AI agents
Give agents a sandbox to resolve user prompts, or create autonomous agents running on sandboxes. 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 sandbox for each developer or student, and run their code in the sandbox. This way, you can run multiple development environments in parallel without them interfering with each other.
Secure code interpretation & evals
Run code in a sandbox 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 sandbox, and hibernate the sandbox when the tests are done. This way, you can quickly start the sandbox again when you need to run the tests again or evaluate the results.
Secure code generation at scale
Settings
Powerful APIs
Use our APIs to create isolated development environments (sandboxes) 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 sandbox 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
Do I need a CodeSandbox workspace to be able to use the SDK?
Yes. You need a CodeSandbox API key to use CodeSandbox SDK, which you can get by creating a CodeSandbox account.
What is the pricing of CodeSandbox SDK?
How long does the SDK take to create a sandbox?
What are memory snapshots?
Are there any SDK rate limits?
Can I use the same CodeSandbox plan for SDK and non-SDK usage?
Is it possible to self-host CodeSandbox SDK?
Start building today
npm install @codesandbox/sdk