The CodeSandbox SDK enables you to programmatically spin up development environments and run untrusted code. It provides a programmatic API to create and run sandboxes quickly and securely.Documentation Index
Fetch the complete documentation index at: https://togetherai-migration.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Use Cases
The main use cases for the SDK are:- Agentic workflows: Build coding agents that can run code to make decisions by calling APIs, processing data & performing calculations
- Data analysis & viz: Analyze datasets to provide on-the-fly analysis and visualizations like charts and graphs
- Cloud code environments: Spin up personalized VM sandboxes that can render a code editor in the browser for each user
- Dynamic file processing: Automate the handling and processing of user-uploaded files, such as converting formats or extracting data
Getting Started
The CodeSandbox SDK is only available on TypeScript for now, Python support is coming!
CodeSandbox Integration
This SDK uses the API token from your workspace in CodeSandbox to authenticate and create sandboxes. Because of this, the sandboxes will be created inside your workspace, and the resources will be billed to your workspace. You could, for example, create a private template in your workspace that has all the dependencies you need (even running servers), and then use that template to fork sandboxes from. This way, you can control the environment that the sandboxes run in.Features
Under the hood, the SDK uses the microVM infrastructure of CodeSandbox to spin up sandboxes. It supports:- Starting fresh VMs within 4 seconds
- Snapshotting/restoring VMs (checkpointing) at any point in time
- With snapshot restore times of less than 2 seconds
- Cloning VMs within 3 seconds
- Source control (git, GitHub, CodeSandbox SCM)
- Running any Dockerfile