Guide
How to give Claude Code, Codex or Cursor a sandbox
Paste one prompt into your coding agent and let it do the setup. It checks for KVM, installs Jasmine, starts it with an API key, runs a smoke test, then routes your model's code into sandboxes and tells you what it changed.
Why should a coding agent use a sandbox?
So the code it writes and runs can't touch your laptop, your files or your cloud account.
It also makes the agent faster to trust: you can let it run tests, install packages and start servers freely, because every task happens on a computer you can throw away.
What's the fastest way to set it up?
Copy the agent setup prompt and paste it into Claude Code, Codex or Cursor.
If your machine has no /dev/kvm (most laptops and many cloud VMs), run Jasmine on a Linux server that has it (see fixing "no /dev/kvm"), or request Jasmine Cloud early access.
How does my agent's code call the sandbox?
Through the Python or TypeScript SDK, or plain HTTP: create a sandbox, exec commands, read and write files, then delete it.
from jasmine_sdk import Jasmine # sdk/python, standard library only
with Jasmine().create() as sbx: # a fresh microVM, ready in ~0.1 s
r = sbx.exec("python3 -c 'print(6*7)'", timeout_ms=10_000)
print(r.stdout) # deleted when the block endsCan the agent preview a web app it built?
Yes. Every port inside a sandbox gets a preview URL (/v1/sandboxes/<id>/ports/<port>/), and WebSockets work over it, so dev servers with hot reload work too.
Does it work with any model?
Yes. Jasmine doesn't care which model wrote the code; anything that can make an HTTP request can use it.
Related
- How to run AI-generated code safely
- How to give an AI agent a headless browser
- Fix "no /dev/kvm" (Firecracker, Jasmine, and other microVMs)
- The best sandboxes for AI agents, measured
Updated 2026-11-25.
Try it in a minute
Self-host it with one command, free. Jasmine Cloud, the hosted version, is in early access.