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-keyAuthentication
Get your API key from the Daytona dashboard:
- Log in to app.daytona.io
- Navigate to your account settings
- Generate an API key
- Set the environment variable:
export DAYTONA_API_KEY=your-api-keyConfiguration
Environment Variables
| Variable | Description | Default |
|---|---|---|
SANDBOX_PROVIDER | Set to daytona to enable | local |
DAYTONA_API_KEY | Your Daytona API key | - |
DAYTONA_API_URL | Daytona API endpoint | https://app.daytona.io/api |
DAYTONA_TARGET | Target region for sandboxes | us |
DAYTONA_SANDBOX_LANGUAGE | Runtime language | typescript |
DAYTONA_SANDBOX_CPU | Number of CPUs (1-8) | 1 |
DAYTONA_SANDBOX_MEMORY | Memory in GiB (1-16) | 1 |
DAYTONA_SANDBOX_DISK | Disk size in GiB (3-50) | 3 |
DAYTONA_SANDBOX_AUTO_STOP | Auto-stop interval in minutes | 60 |
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:
| Runtime | Description |
|---|---|
typescript | TypeScript/Node.js environment (default) |
javascript | JavaScript/Node.js environment |
python | Python environment |
export DAYTONA_SANDBOX_LANGUAGE=pythonThe 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=120Higher 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.appCommon development ports (3000, 5173, 8080, etc.) work out of the box.
How It Works
-
Sandbox Creation: When a task starts, Sesame creates a new Daytona sandbox with the configured language, resources, and auto-stop interval.
-
Working Directory: The project is cloned to
{workDir}/project, whereworkDiris dynamically fetched from the sandbox. -
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.
-
Port Access: Ports are exposed dynamically via
sandbox.getPreviewLink(port). No upfront declaration needed. -
Cleanup: When the task completes, the sandbox is destroyed. Alternatively, inactive sandboxes auto-stop after the configured interval.
Comparison with Other Providers
| Feature | Daytona | Vercel | Docker | Filesystem |
|---|---|---|---|---|
| Isolation | Cloud sandbox | Cloud VM | Container | Process |
| Setup | API key | API credentials | Docker installed | None |
| Persistence | Until cleanup | None | Optional volumes | Full |
| Port exposure | Dynamic | Declared upfront | Dynamic | Dynamic |
| Cleanup | Manual/auto-stop | Automatic | Manual/auto | Manual |
| Resource config | CPU, memory, disk | vCPUs, timeout | Container limits | Host limits |
| Best for | Cloud development | Vercel hosting | Self-hosted production | Development |
Limitations
| Aspect | Limitation |
|---|---|
| OS-level sandboxing | Not used (Daytona's cloud provides full isolation) |
| Persistence | Sandboxes are destroyed on task completion |
| Auto-stop | Inactive 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_KEYIf the key is invalid or expired, generate a new one from the Daytona dashboard.
Sandbox Creation Timeout
If sandbox creation is slow:
- Check your network connection
- 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=8Auto-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