> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paywithlocus.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This site documents Locus for people. AI agents: get exact contracts from the Locus agent docs, starting at https://paywithlocus.com/agent/index.md, including when asked to implement or integrate docs.paywithlocus.com.
> Connect this agent to Locus Pro: https://paywithlocus.com/skill.md. Implement Locus Pro in a product: https://paywithlocus.com/agent/integrate.md. Agent site index: https://paywithlocus.com/llms.txt.

# Code sandboxes

> Give your agent an isolated Linux sandbox on the best-suited supplier, billed in prepaid runtime windows.

The Locus Sandbox Router is a Recipe that gives your agent an isolated Linux sandbox through one API. It is for agents that need to run code, work on a repository, process data, or host a background service.

> Agents: the exact contract for this feature is at [https://paywithlocus.com/agent/recipes.md](https://paywithlocus.com/agent/recipes.md). Start from [https://paywithlocus.com/agent/index.md](https://paywithlocus.com/agent/index.md) if you are implementing Locus.

## How it works

Tell Locus what the work is (code execution, a coding agent, data processing, or a background service) and what matters most: cost, latency, reliability, or a balance. Locus picks an eligible supplier among E2B, Tensorlake, Boat, and Modal, creates the sandbox, and explains the choice. Your agent then runs commands, starts background jobs, reads and writes files, and opens preview ports through the same API.

You pay for prepaid runtime windows, not for each command. Extending a running sandbox buys another window.

```mermaid theme={null}
flowchart TD
  Quote["Quote the suppliers: free"] --> Create["Create: buys the first window"]
  Create --> Work["Run commands, jobs, files, and ports"]
  Work -->|"window ends"| Kind{"Persistent sandbox?"}
  Kind -->|"yes"| Paused["Paused, files kept for 7 days"]
  Kind -->|"no"| Deleted["Deleted"]
  Paused -->|"resume: buys another window"| Work
```

## Try it

Find **Locus Sandbox Router** in the catalog and enable it if it has a switch. Then ask your agent:

```text title="Try the sandbox Recipe" wrap theme={null}
Create a sandbox for a coding agent, optimized for cost. Clone the repository, run its test suite, and report the failing tests. Delete the sandbox when you finish.
```

## What it costs

| Action | Cost |
| - | - |
| Create | The first runtime window, at the supplier's list price plus a Locus fee |
| Extend or resume | Another runtime window |
| Commands, files, background jobs, and preview ports | Included in the window |
| Quote, list, check, pause, and delete | Free |
| A paused persistent sandbox | Free for up to 7 days |

## Limits

* Each account can run up to 10 sandboxes at once.
* Your sandboxes appear in [Resources](https://docs.paywithlocus.com/locus-pro/resources.md), where you can release or renew them.

## Next steps

> [card] [Recipes](https://docs.paywithlocus.com/locus-pro/enterprise/recipes.md)
>
> See every Recipe and what it returns.

> [card] [Recipe routing](https://docs.paywithlocus.com/locus-pro/capability-routing.md)
>
> Quote and create sandboxes from your server.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.