SesameSesame

Daytona

Run tasks in Daytona's secure cloud sandboxes

The Daytona provider uses the @daytonaio/sdk to run agent tasks in Daytona's cloud sandbox environments. These sandboxes provide secure, isolated execution with flexible resource configuration.

Agents need to reach api.anthropic.com, api.openai.com, and other endpoints from inside the sandbox. However, Daytona restricts outbound network access on Tier 1 and Tier 2 sandboxes, which will cause most agents to fail.

When to Use

Choose Daytona sandboxes when:

  • You want cloud-based isolation without managing containers
  • You need flexible resource configuration (CPU, memory, disk)
  • You want dynamic port exposure without upfront declaration
  • You prefer a developer-focused cloud sandbox platform

Quick Start

# Set the provider
export SANDBOX_PROVIDER=daytona

# Set your API key
export DAYTONA_API_KEY=your-api-key

Authentication

Get your API key from the Daytona dashboard:

  1. Log in to app.daytona.io
  2. Navigate to your account settings
  3. Generate an API key
  4. Set the environment variable:
export DAYTONA_API_KEY=your-api-key

Configuration

Environment Variables

VariableDescriptionDefault
SANDBOX_PROVIDERSet to daytona to enablelocal
DAYTONA_API_KEYYour Daytona API key-
DAYTONA_API_URLDaytona API endpointhttps://app.daytona.io/api
DAYTONA_TARGETTarget region for sandboxesus
DAYTONA_SANDBOX_LANGUAGERuntime languagetypescript
DAYTONA_SANDBOX_CPUNumber of CPUs (1-8)1
DAYTONA_SANDBOX_MEMORYMemory in GiB (1-16)1
DAYTONA_SANDBOX_DISKDisk size in GiB (3-50)3
DAYTONA_SANDBOX_AUTO_STOPAuto-stop interval in minutes60

Config File

Alternatively, configure via config.json:

{
  "sandboxProvider": {
    "type": "daytona",
    "daytona": {
      "apiKey": "your-api-key",
      "apiUrl": "https://app.daytona.io/api",
      "target": "us",
      "language": "typescript",
      "cpu": 2,
      "memory": 2,
      "disk": 10,
      "autoStopInterval": 60
    }
  }
}

Language Runtimes

The Daytona sandbox supports multiple language runtimes:

RuntimeDescription
typescriptTypeScript/Node.js environment (default)
javascriptJavaScript/Node.js environment
pythonPython environment
export DAYTONA_SANDBOX_LANGUAGE=python

The runtime provides the base environment. Agent CLIs (Claude Code, Codex, etc.) are installed automatically by Sesame on top of this base.

Resource Configuration

Configure compute resources based on your workload:

# CPUs (1-8, default: 1)
export DAYTONA_SANDBOX_CPU=4

# Memory in GiB (1-16, default: 1)
export DAYTONA_SANDBOX_MEMORY=4

# Disk in GiB (3-50, default: 3)
export DAYTONA_SANDBOX_DISK=20

# Auto-stop after inactivity (minutes, default: 60)
export DAYTONA_SANDBOX_AUTO_STOP=120

Higher resource allocations may incur additional costs. Start with defaults and scale up as needed.

Port Exposure

Unlike Vercel sandboxes, Daytona allows dynamic port exposure at any time. You don't need to declare ports upfront.

When an agent starts a development server, Sesame automatically retrieves the public URL:

// Internal: sandbox.getPreviewLink(port) returns the public URL
const previewUrl = await sandbox.getPreviewLink(3000);
// Returns something like: https://3000-sandbox-abc123.daytona.app

Common development ports (3000, 5173, 8080, etc.) work out of the box.

How It Works

  1. Sandbox Creation: When a task starts, Sesame creates a new Daytona sandbox with the configured language, resources, and auto-stop interval.

  2. Working Directory: The project is cloned to {workDir}/project, where workDir is dynamically fetched from the sandbox.

  3. Command Execution: Agent commands run via Daytona Sessions, which support long-running processes with status polling. Output is streamed back to Sesame in real-time.

  4. Port Access: Ports are exposed dynamically via sandbox.getPreviewLink(port). No upfront declaration needed.

  5. Cleanup: When the task completes, the sandbox is destroyed. Alternatively, inactive sandboxes auto-stop after the configured interval.

Comparison with Other Providers

FeatureDaytonaVercelDockerFilesystem
IsolationCloud sandboxCloud VMContainerProcess
SetupAPI keyAPI credentialsDocker installedNone
PersistenceUntil cleanupNoneOptional volumesFull
Port exposureDynamicDeclared upfrontDynamicDynamic
CleanupManual/auto-stopAutomaticManual/autoManual
Resource configCPU, memory, diskvCPUs, timeoutContainer limitsHost limits
Best forCloud developmentVercel hostingSelf-hosted productionDevelopment

Limitations

AspectLimitation
OS-level sandboxingNot used (Daytona's cloud provides full isolation)
PersistenceSandboxes are destroyed on task completion
Auto-stopInactive sandboxes stop after configured interval

The @anthropic-ai/sandbox-runtime OS-level sandboxing feature (used by Filesystem and Docker providers) is not applicable to Daytona sandboxes. This is because Daytona's cloud sandboxes already provide complete process and network isolation at the infrastructure level.

Troubleshooting

Authentication Errors

Verify your API key is set correctly:

echo $DAYTONA_API_KEY

If the key is invalid or expired, generate a new one from the Daytona dashboard.

Sandbox Creation Timeout

If sandbox creation is slow:

  1. Check your network connection
  2. Try a different target region:
    export DAYTONA_TARGET=eu

Resource Limits

If tasks are running slowly or failing:

# Increase CPU
export DAYTONA_SANDBOX_CPU=4

# Increase memory
export DAYTONA_SANDBOX_MEMORY=8

Auto-Stop Issues

If sandboxes are stopping too quickly during long tasks:

# Increase auto-stop interval (in minutes)
export DAYTONA_SANDBOX_AUTO_STOP=180  # 3 hours

On this page