---
title: "Prime Agent integration"
description: "Run Prime Intellect's Prime Agent in an E2B sandbox from the prebuilt prime template, headless from code or interactively from the CLI."
url: "https://e2b.dev/integrations/prime"
---

# Prime Agent

> Run Prime Intellect's Prime Agent in an E2B sandbox. It has no approval prompts, so the model-generated Python and commands it runs stay off your machine.

Coding agents · [All integrations](https://e2b.dev/integrations.md)

## About this integration

- **Maintained by:** E2B
- **How it works:** Prebuilt prime template
- **Template:** prime
- **Language:** TypeScript, Python
- **Upstream:** [PrimeIntellect-ai/prime-agent · ★ 23k](https://github.com/PrimeIntellect-ai/prime-agent)
- **Docs:** [docs.e2b.dev/agents/prime](https://docs.e2b.dev/agents/prime)

## Get started

Paste the prompt into your coding agent, or follow the steps yourself.

### Paste this into your coding agent

```text
Run Prime Agent in an E2B sandbox from this project.

1. Install the e2b package using the project's package manager.
2. The SDK needs the E2B_API_KEY environment variable. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys. Never hardcode it.
3. Follow the Prime Agent guide at https://docs.e2b.dev/agents/prime: create a sandbox from the prime template, pass my model provider key as a sandbox env, and run prime-agent -p with a task.
4. Run it once, show me the output that came from the sandbox, then kill the sandbox.
```

## Or set it up yourself

### 1. Install the E2B SDK

```bash
pip install e2b
```

### 2. Set your API keys

```bash
export E2B_API_KEY="e2b_..."
export ANTHROPIC_API_KEY="..."
```

### 3. Run Prime Agent headless

```python
import os
from e2b import Sandbox

sandbox = Sandbox.create("prime", envs={
    "ANTHROPIC_API_KEY": os.environ["ANTHROPIC_API_KEY"],
})

result = sandbox.commands.run(
    'prime-agent -p "Create a hello world HTTP server in Go"',
)

print(result.stdout)
sandbox.kill()
```

### 4. Or open it interactively

```bash
e2b sbx create prime
prime-agent
```

## What runs in the sandbox

Prime Agent runs with the permissions of its user, so it runs in a sandbox instead of on your machine.

- **Code:** Model-generated Python and project commands, run without approval prompts inside the sandbox.
- **State:** Sessions are saved to disk behind a background daemon. -c continues the latest one and -r resumes a specific one.
- **Secrets:** Provider keys such as ANTHROPIC_API_KEY go in as sandbox envs. Your host files and credentials stay out of reach.
- **Network:** Sandboxes reach the internet by default. Restrict outbound traffic with allow and deny rules by CIDR or hostname.

## More coding agents

Other coding agents that run in E2B sandboxes.

- [Pi](https://e2b.dev/integrations/pi.md): Run the Pi coding agent in a sandbox, or keep Pi local and send its tool calls to E2B with @e2b/pi.
- [Hermes Agent](https://e2b.dev/integrations/hermes.md): Run Hermes Agent in a sandbox template, or keep it local and execute its terminal tools on E2B.
- [Claude Code](https://e2b.dev/integrations/claude-code.md): Run Claude Code in its own sandbox with a real filesystem, terminal, and git, so it can work unattended.

## Links

- [Get API key](https://console.e2b.dev/?tab=keys)
- [Read the docs](https://docs.e2b.dev/agents/prime)
- [E2B documentation](https://docs.e2b.dev)
