> For the complete documentation index, see [llms.txt](/llms.txt).
> A full single-fetch corpus is available at [llms-full.txt](/llms-full.txt).
---
title: Sandbox providers
description: Configure sandbox provider credentials for isolated agent code execution.
last_verified: 2026-06-19
---

A **sandbox provider** creates the isolated workspace used by `Sandbox()` in the SDK. AGNT5 keeps the agent API provider-neutral, so your code can use `Sandbox()` or select a provider by name while credentials stay in the worker environment or Studio integration configuration.

## Supported providers

Use these provider names with `Sandbox(provider=...)` in Python or `new Sandbox({ provider: ... })` in TypeScript.

| Provider | Selector | Required environment variables |
|---|---|---|
| E2B | `e2b` | `E2B_API_KEY` |
| Daytona | `daytona` | `DAYTONA_API_KEY` |
| Vercel Sandbox | `vercel` | `VERCEL_TOKEN` or `VERCEL_OIDC_TOKEN`, plus `VERCEL_TEAM_ID` and `VERCEL_PROJECT_ID` |
| Northflank | `northflank` | `NORTHFLANK_API_TOKEN` and `NORTHFLANK_PROJECT_ID` |
| Together Code Interpreter | `together` | `TOGETHER_API_KEY` |

`Sandbox()` auto-detects the first configured provider. Use an explicit selector when more than one provider is configured.

## Configure local credentials

For local development, put sandbox credentials in `.env` and start the worker with `agnt5 --env-file .env dev`.

```bash
# Choose one provider for local testing.
AGNT5_SANDBOX_PROVIDER=e2b
E2B_API_KEY=e2b_...
```

For Daytona:

```bash
AGNT5_SANDBOX_PROVIDER=daytona
DAYTONA_API_KEY=...
```

For Vercel Sandbox:

```bash
AGNT5_SANDBOX_PROVIDER=vercel
VERCEL_TOKEN=...
VERCEL_TEAM_ID=team_...
VERCEL_PROJECT_ID=prj_...
```

For Northflank:

```bash
AGNT5_SANDBOX_PROVIDER=northflank
NORTHFLANK_API_TOKEN=...
NORTHFLANK_PROJECT_ID=...
```

For Together Code Interpreter:

```bash
AGNT5_SANDBOX_PROVIDER=together
TOGETHER_API_KEY=...
```

Do not commit `.env`. The worker reads these variables when it starts.

## Select a provider in code

Use `Sandbox()` when one provider is configured. Pass a provider name when you want to route a specific agent to a specific backend.



**Python:**

```python
from agnt5 import Agent, Sandbox

agent = Agent(
    name="coder",
    model="openai/gpt-4o-mini",
    instructions="Use the configured sandbox provider.",
    sandbox=Sandbox(),
)

daytona_agent = Agent(
    name="daytona_coder",
    model="openai/gpt-4o-mini",
    instructions="Use Daytona for this task.",
    sandbox=Sandbox(provider="daytona"),
)
```





**TypeScript:**

```ts
const agent = new Agent({
  name: 'coder',
  model: LM.openai(),
  modelName: 'openai/gpt-4o-mini',
  instructions: 'Use the configured sandbox provider.',
  sandbox: new Sandbox(),
});

const daytonaAgent = new Agent({
  name: 'daytona-coder',
  model: LM.openai(),
  modelName: 'openai/gpt-4o-mini',
  instructions: 'Use Daytona for this task.',
  sandbox: new Sandbox({ provider: 'daytona' }),
});
```



## Configure deployed workers

In managed deployments, configure sandbox provider credentials in Studio so workers receive the required environment variables without storing secrets in source code.

1. Open your project in Studio.
2. Open **Settings** -> **Integrations**.
3. Add the sandbox provider integration.
4. Store the provider credential at the narrowest scope that works for the worker.
5. Deploy or restart the worker so the updated environment is available.

Provider credentials are not shown to the model. The agent receives sandbox capabilities; the SDK and worker use the provider credential to create and manage the sandbox.

## Validate a provider

Use the `sandbox-smoke` template to verify provider credentials from a worker before you rely on the provider in an agent.

```bash
agnt5 create --template python/sandbox-smoke sandbox-smoke
cd sandbox-smoke
cp .env.example .env
agnt5 --env-file .env dev
```

Run the lifecycle check:

```bash
agnt5 --env-file .env run sandbox_lifecycle_check \
  --input '{"provider": "e2b", "code": "print(6 * 7)", "language": "python"}'
```

Run the file and execution check:

```bash
agnt5 --env-file .env run sandbox_agent_tools_check \
  --input '{"provider": "e2b"}'
```

For a real agent loop, run:

```bash
agnt5 --env-file .env run sandbox_coding_agent_check \
  --input '{"provider": "e2b", "model": "openai/gpt-4o-mini"}'
```

## Troubleshoot

| Symptom | What to check |
|---|---|
| `Sandbox provider 'auto' is not configured` | The worker did not receive any supported provider environment variables. Restart with `agnt5 --env-file .env dev` or update the deployed worker environment. |
| Provider creation fails | Confirm the provider key is valid and the provider account has sandbox access enabled. |
| File operations fail but code execution works | Run `sandbox_agent_tools_check` to isolate write, list, read, and execute behavior. |
| Shutdown does not complete | Check provider-side quota, active sandbox limits, and provider API status. |

## Next steps

- [Use sandboxes with agents](/docs/build/sandboxes.md): attach a sandbox to an agent and use it from custom tools.
- [AI providers](/docs/integrations/ai-providers.md): configure model credentials for agents and prompts.
- [Local development](/docs/build/local-development.md): run workers with explicit environment files.
- [Deploying](/docs/run/deploying.md): deploy workers after integrations are configured.
