Quick Use
- Sign up at app.daytona.io → copy API key
pip install daytona-sdk(ornpm install @daytonaio/sdk)daytona.create(), thensandbox.process.exec("<command>")— branch withsandbox.snapshot()
Intro
The Daytona SDK lets AI agents spin up secure Linux sandboxes in 90 ms. Each sandbox is a full Ubuntu environment with a writable filesystem, optional GPU, and the ability to fork or snapshot to branch agent execution paths. Best for: AI agents that need to test generated code, perform parallel exploratory branches, or maintain a persistent agent workspace. Works with: Python and TypeScript SDKs. Setup time: 5 minutes.
Spin up a sandbox
from daytona import Daytona
daytona = Daytona(api_key=os.environ["DAYTONA_API_KEY"])
sandbox = daytona.create()
print(sandbox.id) # "sb_abc123"
print(sandbox.cold_start_ms) # ~90
# Run a command
response = sandbox.process.exec("python -c 'print(2+2)'")
print(response.result) # "4"
# Or shell session
session = sandbox.process.create_session()
session.execute("cd /workspace && git clone ...")
session.execute("cd repo && pip install -r requirements.txt")
session.execute("pytest")
sandbox.delete() # or auto-cleanup on exitMount files from local
sandbox = daytona.create()
# Upload a directory
sandbox.fs.upload_directory(local_path="./my-project", sandbox_path="/workspace/proj")
# Download generated artifacts
sandbox.fs.download(sandbox_path="/workspace/proj/dist", local_path="./build")Snapshot + fork — branch agent execution
sandbox = daytona.create()
sandbox.process.exec("git clone https://github.com/example/repo /work")
# Snapshot the current state
snap = sandbox.snapshot() # "snap_xyz"
# Branch 1: try approach A
sb_a = daytona.create_from_snapshot(snap)
sb_a.process.exec("python try_approach_a.py")
# Branch 2: try approach B in parallel
sb_b = daytona.create_from_snapshot(snap)
sb_b.process.exec("python try_approach_b.py")
# Pick the winner
winner = sb_a if score(sb_a) > score(sb_b) else sb_bWhy use Daytona vs running Docker locally
- 90 ms cold start vs Docker's ~10 s
- Snapshot + fork lets agents do tree search across solutions
- Cloud-resident — no local CPU / RAM tax
- Pay per second of sandbox time
FAQ
Q: Is Daytona free? A: Daytona has a free tier for testing. Paid plans (per-second compute pricing) start when you scale up. Their core platform is also open-source on GitHub for self-hosting.
Q: How is this different from Modal Sandboxes or E2B? A: All three are cloud Linux sandboxes. Differences: Daytona's snapshot/fork primitives are unique (great for agents doing parallel exploration). Modal optimizes for Python ML workloads. E2B optimizes for code-interpreter UX and microVM isolation. Pick by primary use case.
Q: Can I use Daytona with Claude Code or Cursor? A: Yes — agents in Claude Code / Cursor can use the Daytona Python SDK as a tool. They can also connect via MCP — Daytona ships an MCP server. Useful for 'try this code in a sandbox before committing it' workflows.
Source & Thanks
Built by Daytona. Apache-2.0 (core).
daytonaio/daytona — ⭐ 16,000+