https://codesandbox.io/blog/joining-together-ai-introducing-codesandbox-sdk * Sign In * Try for free * Features * Use Cases + deployed_codeCodeSandbox SDK Programmatically spin up dev environments. + dnsCloud Development Environments Give every developer a 2x faster machine. + reviewsCode Reviews Review PRs without breaking flow. + code_blocksCode in Sandboxes Prototype your ideas in record time. + schoolLearn & Experiment Try frameworks and experiment new tools. * SDK * Resources + codeTemplates Find inspiration for your next project. + articleBlog Read news and insights from our team. + diversity_4Community Engage with other community members. + new_releasesChangelog Check out our latest features and fixes. * Docs * Support * Pricing 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 arrow_back Blog chevron_right News Dec 12, 2024 Joining Together AI and Introducing CodeSandbox SDK We are starting a new chapter for CodeSandbox, building better tooling for our community. Ives van Hoorne Ives van Hoorne Joining Together AI and Introducing CodeSandbox SDK * share Share + + + This might be the most important blog post I've written since our launch of CodeSandbox back in 2017. Today, I'm excited to announce that CodeSandbox has joined Together AI! But first, let's address the elephant in the room: CodeSandbox will continue to run as normal. We'll keep working on CodeSandbox, and sandboxes and devboxes will continue to run as before. In fact, with the backing of Together AI, we're making private sandboxes & devboxes part of the Free plan! Finally, I'm thrilled to announce the launch of our new product, CodeSandbox SDK! Let's dive into what this means--but first, some history. A CodeSandbox history primer CodeSandbox started back in 2017 as a React playground. The goal was to make it very easy to share code examples without having to download & run code on your own computer. old website of codesandbox back in 2017 While it took a couple of months to take off, suddenly we saw hundreds, then thousands of people using CodeSandbox to build and share code examples--as students working from our student dorms, we couldn't believe what we were seeing! So we started expanding the type of projects we could run. We added support for Angular, Vue, Preact, and Svelte, and people discovered more new use cases that we didn't think of initially. They started using us to learn how to code, do job interviews, bug reports, workshops, and even development. At this point, our main goal became to make coding more accessible. Graph of user growth in the initial year Our growth continued through 2018, and then I had a big decision to make: continue my studies, accept a job offer from Facebook, accept an acquisition offer for CodeSandbox, or work on CodeSandbox full-time. You can guess which decision we went with! We raised a seed round in 2019 and started building a team. One common feedback we heard from our users was that CodeSandbox worked for small examples, but not for development. At the time, we were running all sandboxes completely in the browser and this fell short when scaling to bigger and more complicated projects. So we started to explore running sandboxes on the server. First, we used Container Sandboxes, this felt sluggish because every time someone forked a sandbox, we had to create a new container and start all processes from scratch. But in 2021, we discovered Firecracker. Firecracker can spin up so-called microVMs: VMs with a very quick boot-up time, small memory footprint, and the unique functionality to pause VMs, snapshot memory to disk, and resume from that state later. This felt perfect for running our sandboxes. We started building on top of Firecracker. We've built a technique to efficiently snapshot/restore memory snapshots and we've made it possible to live clone a VM within a few seconds (using Copy-on-Write). Everything we created--from UI/UX, to orchestrator, even down to kernel patches--was built to create the fastest experience for snapshotting and cloning sandboxes. It's incredibly powerful, but we were only using it for CodeSandbox. By 2024, we reached 4.5 million monthly users and AI became an important tool for many developers. It does not just make developers faster, it also makes development more accessible. With the explosive growth of AI, suddenly there were mountains of AI-generated code that needed a secure environment to run in. While CodeSandbox was initially built for code written by humans, incidentally it's also perfect for running code written by LLMs. Why Together AI? A few months ago, I was talking with Vipul, the Co-Founder & CEO of Together AI, and we agreed that the number one use case of AI models is code generation. Together AI has quickly grown into the leading hosting platform for AI and they give developers access to 200+ generative AI models and tooling to manage their entire AI lifecycle, including training, fine-tuning, and inference. However, all of their users need a solution to execute that AI-generated code securely. The infrastructure we were building at CodeSandbox was a natural fit for Together AI to offer secure AI sandboxes as a service. This is exciting for us because it's far more powerful to have your code execution solution hosted in the same place as your LLM or agent. We can leverage the infrastructure of Together AI to build a more powerful solution for running sandboxed code close to the LLM--and with more resources, we can continue growing CodeSandbox SDK and provide sandboxes and devboxes to our community. We saw a massive opportunity here to make CodeSandbox the backbone of executing all AI-generated code. So we are excited to release CodeSandbox SDK to achieve this. CodeSandbox SDK With CodeSandbox SDK, you can programmatically spin up (AI) sandboxes. These sandboxes run inside a microVM, using our existing infrastructure. This gives you: 1. Memory snapshot/restore (checkpointing). 2. VM cloning from a live VM or snapshot in 3 seconds. 3. FS persistence (with git version control built-in). 4. Environment customization using Docker & Docker Compose (Dev Containers). 5. Stability: at CodeSandbox we worked on this infra for the past 4 years, and we start and resume 2 million VMs on a weekly basis. Let's look at the API to see how it works: import { CodeSandbox } from "@codesandbox/sdk"; const sdk = new CodeSandbox(); // Create a sandbox const sandbox = await sdk.sandbox.create(); // Write our beautiful HTML page await sandbox.fs.writeTextFile("./index.html", "