---
title: "Sandbox"
url: https://www.daytona.com/definitions/s/sandbox
---

# Sandbox

A sandbox is an isolated environment in which code runs without access to the system around it.

A sandbox runs code on the assumption that the code may be buggy or hostile, and it limits the damage that code can do. If the code crashes or tries to break out, the sandbox keeps the effect inside. A flaw in its boundary can still let code out. The limits are set from outside, so the code inside cannot lift them. Web browsers use the same idea, running the code of each site in a restricted process.

A sandbox can be thrown away once its work is done, along with anything the code left behind. That makes it a safer place for untrusted code, such as programs submitted by users or written by AI agents. Starting again from a known state also makes runs repeatable, since nothing from an earlier run can change the result. It also lets code be tested in a realistic setting without touching real systems.

The term covers many mechanisms, from a filter on one process to a whole virtual machine. They differ mainly in where they draw the isolation boundary and in what each sandbox costs to start and run. A stronger boundary leaves less shared code between the sandbox and the host, so fewer bugs can lead out. Cloud sandboxes for agents often use microVMs, which give each sandbox its own kernel. The right choice depends on who wrote the code and what an escape would cost.

## Related terms

- [Isolation](https://www.daytona.com/definitions/i/isolation.md)
- [AI Agents](https://www.daytona.com/definitions/a/ai-agents.md)
- [Virtual Machine (VM)](https://www.daytona.com/definitions/v/virtual-machine-vm.md)
- [Agent harness](https://www.daytona.com/definitions/a/agent-harness.md)
- [Agent loop](https://www.daytona.com/definitions/a/agent-loop.md)
- [Agent trace](https://www.daytona.com/definitions/a/agent-trace.md)
