Guide
Daytona Sandbox, Explained for Teams Giving Every Customer an Agent
Daytona gives an agent its own persistent sandbox through one SDK call, and keeps it until you delete it. Here is how its sandboxes behave, how they map to one agent per customer, and which jobs stay on your plate.
Agent to Product Editors · Checked against the sources on
The short answer
- A Daytona sandbox is a persistent computer for an agent, created with
daytona.v0.create()from the@daytona/sdkpackage (or the Python, Ruby, Go or Java SDKs). The default class is a Linux container; Linux VM and Windows sandboxes add their own kernel, plus pause, resume and fork. - Sandboxes are persistent by default: stopping one keeps its files and identity, and it is only deleted when you delete it or set it to be. A container sandbox auto-stops after 15 minutes of inactivity and auto-archives to object storage after 7 days stopped, when it stops being billed.
- One agent per customer maps onto a snapshot for the agent, a sandbox per customer tagged with
labels, the sandbox ID stored on the customer record, and idle intervals that stop and archive it between visits. Daytona's create call takes no idempotency key, so a duplicate-safe signup is yours to build. - Daytona runs the sandboxes. You still own the agent itself, idle policy, per-customer credentials, cost per customer and cleanup when a customer leaves.
What a Daytona sandbox is
Daytona describes itself as secure, elastic infrastructure for running AI-generated code. A sandbox is an isolated environment with its own filesystem, network stack and allocated vCPU, RAM and disk, where an agent can install packages, run servers, compile code and manage processes. You drive it from the SDKs (npm i @daytona/sdk or pip install daytona), the CLI or the REST API, authenticated with a DAYTONA_API_KEY.
Daytona says sandboxes go from code to execution in under 90 ms, and that they are built on OCI/Docker compatibility, so a snapshot can start from an image or a Dockerfile. The docs describe a few building blocks:
- Sandbox: the running environment. Created with default resources of 1 vCPU, 1 GiB of RAM and 3 GiB of disk, up to 4 vCPU, 8 GiB and 10 GiB per sandbox by default.
- Snapshot: the template a sandbox starts from: a base image, packages, files and an entrypoint command. Daytona ships defaults such as
daytona-smallanddaytona-vm-small, and you can build your own. - Volume: an S3-backed mount that outlives any one sandbox, for data that should survive deleting it.
- Toolbox: the in-sandbox API behind
sandbox.process,sandbox.fsandsandbox.git: run code and commands, read and write files, clone repositories.
Daytona's guides show coding agents such as Claude Code and OpenCode running inside a sandbox, so the sandbox can host the agent itself, not only the code it writes.
Sandbox classes: containers, VMs and GPUs
Daytona's overview says every sandbox gets a dedicated kernel. Its isolation page is more precise, and the difference matters for a product that runs code an LLM wrote for many customers: the boundary depends on the sandbox class you pick.
| Class | Runtime boundary, per Daytona's docs | What it adds or lacks |
|---|---|---|
| Container (default) | An isolated container with dedicated namespaces and enforced resource limits | Fastest to create; stop, start and archive. No pause, no fork, and memory is cleared on every stop |
| Linux VM and Windows | A full virtual machine with its own kernel, behind a hardware virtualization boundary | Pause and resume with memory intact, fork, and snapshots of filesystem and memory. Created only from VM snapshots |
| GPU | An isolated container with exclusive GPU devices, never shared between sandboxes | Ephemeral by design: deleted when stopped, so results belong in a volume |
Each sandbox reserves its own vCPU, memory and disk as hard limits, so one customer's agent can't starve another's. If kernel-level separation between customers is a requirement, choose the VM class deliberately rather than taking the default. This site's piece on evaluating agent platforms by isolation depth explains why the boundary matters more than the API surface.
The lifecycle: auto-stop, archive and what you pay for
Daytona's lifecycle is the reverse of a short-lived code runner: sandboxes are persistent by default, and stopped, paused and archived sandboxes are kept until you delete them. What changes from state to state is what you are billed for and how much of your quota the sandbox holds.
| State | What it means | Billed for |
|---|---|---|
| Started | Running. Holds its reserved vCPU, RAM and disk. | vCPU, RAM and disk |
| Stopped | Memory cleared, filesystem kept. A stopped container still counts against your disk quota; a stopped VM doesn't. | Disk only |
| Paused (VM only) | Filesystem and memory kept; processes continue from where they froze on resume. | Disk only; the saved memory isn't billed |
| Archived (container only) | Filesystem moved to object storage. Starting it restores the sandbox. | Nothing |
| Deleted | Gone. Snapshots you took from it remain, and are billed for storage. | Nothing |
Four intervals, set in minutes at creation or later, move a sandbox through those states on its own:
- Auto-stop (containers and GPUs): stops a sandbox after 15 minutes of inactivity by default.
0disables it, so the sandbox runs until you stop it. - Auto-pause (VMs): pauses a VM sandbox after 60 minutes of inactivity by default. At most one of auto-stop and auto-pause can be non-zero.
- Auto-archive (containers): archives a sandbox that has been stopped for 7 days by default, 30 days at most.
- Auto-delete and wall-clock TTL: both off by default. Auto-delete counts time stopped; a TTL destroys the sandbox at a fixed deadline in any state.
The detail to plan around is what counts as activity. For auto-stop, the timer resets on lifecycle changes, requests through preview URLs, active SSH connections and Toolbox API calls. A background process doesn't count: Daytona warns that a task running more than 15 minutes without outside interaction can be stopped mid-run. Call sandbox.refreshActivity() while a customer's agent is working, or raise the interval.
How it maps to one agent per customer
If your product gives each customer their own agent, Daytona's primitives line up with the customer lifecycle like this:
- Build the agent into a snapshot from an image or Dockerfile, with an entrypoint command that starts it. Daytona runs the entrypoint inside each sandbox and keeps its logs in a dedicated session.
- Create the sandbox at signup, from the webhook that creates the customer's account (see wiring provisioning into your signup webhook). Tag it with
labels: { customerId }sodaytona.v0.list({ labels })can find it later. - Store the sandbox ID on the customer record.
daytona.v0.get(idOrName)fetches it again, andsandbox.start()brings back a stopped or archived one with its files intact. - Let it stop and archive between visits with auto-stop and auto-archive, and refresh activity while the customer is using it. On the VM class, auto-pause keeps the agent's memory too.
- Delete it when the customer leaves, after exporting anything you have promised to keep (see teardown and cleanup flows). Delete returns as soon as the API accepts it unless you ask it to wait.
import { Daytona } from '@daytona/sdk'
const daytona = new Daytona() // reads DAYTONA_API_KEY
export async function provisionAgent(customer) {
// create() takes no idempotency key, so look before you create
for await (const existing of daytona.v0.list({ labels: { customerId: customer.id } })) {
return existing.id
}
const sandbox = await daytona.v0.create({
snapshot: '<your-agent-snapshot>',
labels: { customerId: customer.id },
autoStopInterval: 30, // minutes idle before it stops
autoArchiveInterval: 60 * 24, // minutes stopped before it archives
})
await db.customers.update(customer.id, { sandboxId: sandbox.id })
return sandbox.id
}A lookup before create narrows the window for duplicates but doesn't close it: two retries at the same moment can both find nothing. Put a lock or a unique provisioning record on your side, as in this site's guide to idempotent agent provisioning API design. One more case from the SDK reference: if create() times out after the sandbox exists, the DaytonaTimeoutError carries its sandboxId, and create() doesn't delete it, so record or clean it up. For notifications rather than polling, Daytona sends sandbox.created and sandbox.state.updated webhooks.
Warm pools keep pre-created sandboxes of a snapshot running so a create request is handed one at once. They must be enabled for your organization by Daytona, and a request only claims a warm sandbox when it uses the snapshot's default resources and no custom environment variables, volumes or secrets.
Network access, preview URLs and secrets
Isolating compute is half the job once an agent can reach the internet and the customer's tools. What Daytona's docs say about the other half:
- Outbound access depends on your tier. On Tiers 1 and 2, the organization's network restrictions apply and can't be overridden per sandbox, though essential services such as package registries stay reachable. On Tiers 3 and 4, internet access is open by default and each sandbox can take one of
networkBlockAll,domainAllowListornetworkAllowList, enforced strictly. - Sandboxes don't share a network. Sandbox-to-sandbox traffic is off unless you link sandboxes, so one customer's agent can't reach another's.
- Preview URLs are private unless you make them public. The standard preview token works for every port of the sandbox, including the terminal and Toolbox API ports, and can't be revoked, so never hand it to a customer. To share one port, use a signed preview URL, which is bound to that port, expires and can be revoked.
- Secrets stay outside the sandbox. A secret is stored in your organization; the sandbox sees only a placeholder, and Daytona's outbound proxy swaps in the real value in HTTPS request headers to the hosts on the secret's allowlist. A secret with no allowlist is sent to any host, so set one every time.
Secrets are organization-wide and suit your own API keys, such as the model key every agent uses. Per-customer tokens for Gmail, Slack or GitHub still need their own storage, refresh and revocation; see OAuth credential management for hundreds of agent users. For per-customer files, Daytona recommends one shared volume with a subpath per customer: each sandbox sees only its own prefix.
The tier limits that matter for one agent per customer
Daytona bills pay-as-you-go, per second, for the resources a sandbox reserves in each state, and places your organization in a tier that sets its compute pool and rate limits. Rates and limits change, so check Daytona's pricing page and its limits docs for current numbers.
| Tier | vCPU pool | Storage pool | Sandbox creations per minute | How you reach it |
|---|---|---|---|---|
| Tier 1 | 10 | 30 GiB | 300 | Email verified |
| Tier 2 | 100 | 300 GiB | 400 | Credit card linked, $25 top-up |
| Tier 3 | 250 | 2,000 GiB | 500 | $500 top-up |
| Tier 4 | 500 | 5,000 GiB | 600 | $2,000 top-up every 30 days |
What the table means for a per-customer design:
- Running sandboxes share the pool. Stopped, paused and archived sandboxes free their CPU and memory, so stopping idle agents is what lets the number of customers exceed what fits at once.
- Stopped containers still hold disk quota until they are archived, which is why the auto-archive interval matters once you have many customers who come back rarely.
- Tiers 1 and 2 restrict outbound traffic with no per-sandbox override. An agent that calls arbitrary customer tools needs Tier 3 or above.
- Signup bursts hit the creation limit. The API returns
429withRetry-Afterheaders; queue provisioning rather than failing signups (see concurrency limits and queue design). - Volumes are capped at 100 per organization, which is why the docs point multi-tenant products to subpaths rather than a volume per customer.
Where it runs: shared, dedicated and custom regions
Daytona's shared regions are the United States (us) and Europe (eu); you pick one with target when you create a sandbox. Two other options, per its regions docs:
- Dedicated regions: infrastructure Daytona runs as a managed service for one organization only, set up through Daytona's sales team.
- Custom regions (BYOC): runner machines your organization provides and manages, controlled by Daytona's control plane. Custom regions have no limits on concurrent resource usage beyond the compute you attach. BYOC must be enabled for your organization.
Daytona's pricing page lists larger limits, SSO, audit logs and BYOC under Enterprise. For compliance reports, check the Trust Center linked from Daytona's site.
What you still run yourself
Daytona gives you the sandbox and its lifecycle. When the agent inside it belongs to a paying customer, these jobs stay with your team:
- The agent and its snapshot. Building and versioning the agent image, and deciding how an update reaches customers whose sandboxes started from an older snapshot. See versioning agent configurations across a growing user base.
- Idle policy. Picking the auto-stop, archive and delete intervals, and refreshing activity so a working agent isn't stopped mid-task. The site's piece on idle agent cost control covers the policy side.
- The customer-to-sandbox mapping. Storing the sandbox ID, guarding against duplicates at signup, and making sure one customer can never be connected to another's sandbox.
- Per-customer credentials and egress rules. Daytona gives you per-sandbox network limits and organization secrets; deciding what each customer's agent may reach, and storing its OAuth tokens, is yours.
- Cost per customer. Daytona bills your organization, not your customers. Mapping sandbox usage back to accounts for pricing and margin is your work; see per-user agent cost breakdown.
- Health and stuck sessions. Daytona reports sandbox states and webhooks; knowing whether a customer's agent is making progress is a signal you define. See alerting on agent idle timeouts and stuck sessions.
Daytona compared with a managed per-user agent platform
Daytona is a sandbox layer you build a product on. The other route is a platform that hosts one isolated, persistent agent per user for you, such as Agent37, whose Cloud API creates a per-user agent sandbox with one API call. How the two compare on the jobs above:
| Daytona sandboxes | Managed per-user agent platform | |
|---|---|---|
| What you get | A persistent sandbox per call, as a container or a VM, controlled through an SDK | A hosted agent per user, provisioned through the platform's API |
| Provisioning a customer's agent | daytona.v0.create() from your snapshot, with labels; duplicate protection is yours | One API call to the platform |
| Persistence | On by default; containers stop after 15 idle minutes and archive after 7 days stopped | Check what the platform does by default |
| The agent itself | You build, package and update it in a snapshot | Check which agents the platform runs and how updates roll out |
| Per-customer credentials | Yours to store; Daytona's secrets are organization-wide | Check the platform's integration and credential docs |
| Cost | Per-second billing for reserved resources by state; see Daytona's pricing page | The platform's price; see its pricing page |
| Best fit | Teams building their own agent runtime who want long-lived sandboxes, VM or GPU options, or their own compute | Teams that want each customer to have a working agent without building that layer |
If you are weighing other sandbox layers, this site's guides to E2B sandboxes and Kubernetes Agent Sandbox cover the same jobs on Firecracker microVMs and on your own cluster, and what out-of-the-box agent provisioning actually means across today's platforms compares the options more broadly.
Is Daytona the right call for you?
It is a good fit when most of these are true:
- You are building your own agent and want each customer's copy to keep its files between visits without you running servers.
- You have decided between the container class and the VM class for the isolation and pause behaviour you need.
- You will be on Tier 3 or above if your agents need open outbound access, or you can work within the tier's network restrictions.
- You are prepared to build duplicate-safe provisioning, idle policy, per-customer credentials and cost attribution on top.
If the goal is that every customer has a working agent the moment they sign up, without building that layer, a managed per-user platform will usually get you there with less to run. Either way, the requirements are the ones laid out in what persistent per-customer context requires from your provisioning layer.





