ScriptsMay 7, 2026·4 min read

Daytona SDK — Programmable Dev Sandboxes for AI Agents

Daytona SDK spawns Linux dev environments in 90 ms. Run agent-generated code, browser automation, ML jobs. Snapshot + fork to branch execution.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Stage only · 17/100Stage only
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Stage only
Trust
Trust: New
Entrypoint
Asset
Universal CLI install command
npx tokrepo install 3b7e7e34-396e-424e-a2f8-e47decaee4cd
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 exit

Mount 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_b

Why 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.


Quick Use

  1. Sign up at app.daytona.io → copy API key
  2. pip install daytona-sdk (or npm install @daytonaio/sdk)
  3. daytona.create(), then sandbox.process.exec("<command>") — branch with sandbox.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 exit

Mount 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_b

Why 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+

🙏

Source & Thanks

Built by Daytona. Apache-2.0 (core).

daytonaio/daytona — ⭐ 16,000+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets