Provider comparison
| Provider | Isolation | Cost | Best for |
|---|---|---|---|
| Local | None (host passthrough) | Free | Development, trusted code |
| Docker | Container | Free | Testing, reproducible environments |
| Daytona | Cloud or self-hosted | Free (self-hosted) | Production, team environments |
| E2B | Cloud | $0.15/hr | Ephemeral tasks, CI |
| AgentBay | Alibaba Cloud | ¥1/hr | China region |
Session lifecycle
on_exit value | Behavior |
|---|---|
pause | Pause on exit. Files, packages, processes preserved. |
destroy | Kill on exit. Clean slate next time. |
pause is the default — you keep everything across restarts.
Quick start
Configure a provider
Go to Settings → Sandbox in the Web UI. Expand the provider card and fill in the required fields:
Config is stored at
| Provider | Required |
|---|---|
| Docker | Image name, mount path |
| E2B | API key |
| Daytona | API key, API URL |
| AgentBay | API key |
~/.leon/sandboxes/<provider>.json.Start a sandboxed thread
In the new conversation view, use the sandbox dropdown in the input area to select your provider. Send your first message — the Thread is now permanently bound to that sandbox.
Provider configuration
- Docker
- E2B
- Daytona SaaS
- Daytona self-hosted
- AgentBay
Requires Docker on the host. No API key needed.
| Field | Default | Description |
|---|---|---|
docker.image | python:3.12-slim | Docker image |
docker.mount_path | /workspace | Working directory inside container |
on_exit | pause | pause or destroy |
API key resolution
API keys are resolved in order:- Config file field (
e2b.api_key,daytona.api_key, etc.) - Environment variable (
E2B_API_KEY,DAYTONA_API_KEY,AGENTBAY_API_KEY) ~/.leon/config.env
Session management
Web UI
From Resources:- Unified grid of all sessions across all providers
- Click a session card → detail sheet with metrics and file browser
- Pause / Resume / Destroy via UI or API
API endpoints
| Action | Endpoint |
|---|---|
| List sessions | GET /api/sandbox/sessions |
| Pause | POST /api/sandbox/sessions/{id}/pause?provider={type} |
| Resume | POST /api/sandbox/sessions/{id}/resume?provider={type} |
| Destroy | DELETE /api/sandbox/sessions/{id}?provider={type} |
| Metrics | GET /api/sandbox/sessions/{id}/metrics |
Architecture
Middleware owns policy. The sandbox backend owns I/O. Swapping the backend changes where operations run without touching any middleware logic. Sessions are tracked in SQLite (~/.leon/sandbox.db):
| Table | Purpose |
|---|---|
sandbox_leases | Lease lifecycle — provider, desired/observed state |
sandbox_instances | Provider-side session IDs |
abstract_terminals | Virtual terminals bound to Thread + lease |
lease_resource_snapshots | CPU, memory, disk metrics |