prime template with Prime Agent already installed.
CLI
Create a sandbox with the E2B CLI./login to pick a subscription (Claude Pro/Max, ChatGPT Plus/Pro, GitHub Copilot) or an API-key provider.
Run headless
Use-p to print the response and exit. Prime Agent has no approval prompts or auto-approve flag — it runs model-generated Python and project commands with the permissions of the user it runs as, which is why upstream recommends running it inside a sandbox. The sandbox isolates the agent from your host machine, but sandboxes can reach the open internet by default — restrict outbound traffic with network rules. Prime Agent authenticates with standard provider environment variables (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, XAI_API_KEY, OPENROUTER_API_KEY), or PRIME_API_KEY for Prime Inference. Pick a model with --provider <name> and --model <pattern>.
Running tool calls without approval is contained by the sandbox: the agent cannot touch your host machine, local files, or credentials. It can still make outbound network requests — internet access is enabled by default. To limit where an unattended agent can connect, configure outbound network rules (
allowInternetAccess, plus allow/deny lists by CIDR or hostname). Hostname rules apply to HTTP(S) traffic only; use CIDR rules for other protocols.Example: work on a cloned repository
Streaming JSON
Use--mode json to get a real-time JSONL event stream. The first line is a session header, followed by events as they occur — agent_start, turn_start, message_start/message_update/message_end, tool_execution_start/tool_execution_end, turn_end, and agent_end. For bidirectional integrations, --mode rpc exposes the same session over stdin/stdout.
Session management
Prime Agent saves sessions to disk and runs them behind a background daemon, so work survives across commands in a long-lived sandbox. Use-c to continue the most recent session, -r <path|id> to resume a specific one, and prime-agent agents / prime-agent attach <agent> to list and reattach to agents still running in the sandbox.
Build a custom template
If you need to customize the environment (e.g. pre-install dependencies, add config files), build your own template on top of the pre-builtprime template.
Related guides
Sandbox persistence
Auto-pause, resume, and manage sandbox lifecycle
Git integration
Clone repos, manage branches, and push changes
SSH access
Connect to the sandbox via SSH for interactive sessions