Coding agent templates
Start a sandbox with Claude Code, Codex, OpenCode, Gemini CLI, Grok, Amp or GitHub Copilot CLI ready to run, by naming the tool as the template.
Seven template names start a sandbox that already has a coding agent's command-line tool installed. You name the tool, the sandbox starts in about a second, and the tool is on the PATH.
| Template | Tool | Run a prompt and exit | What it needs |
|---|---|---|---|
claude | Claude Code | claude -p "…" | ANTHROPIC_API_KEY |
codex | Codex CLI | codex exec "…" | OPENAI_API_KEY |
opencode | OpenCode | opencode run "…" | the key of the model provider you choose |
gemini | Gemini CLI | gemini -p "…" | GEMINI_API_KEY |
grok | Grok CLI | grok -p "…" | XAI_API_KEY |
amp | Amp | amp -x "…" | AMP_API_KEY |
copilot | GitHub Copilot CLI | copilot -p "…" | a GitHub token with Copilot access (GH_TOKEN) |
All seven names start the same image, agent. So every one of these sandboxes has all seven tools, plus Node 24, Python 3, git and ripgrep. The name is how you say which tool you mean, in your code and in your sandbox list. It costs nothing extra: same 2 GB of memory, same 8 burstable vCPUs, same restore time as agent.
PandaStack does not supply the model. You bring the key for the tool you run, and the tool talks to its own provider from inside the sandbox.
Start one
import os
import shlex
from pandastack import Sandbox
sb = Sandbox.create(template="claude", ttl_seconds=1800)
key = shlex.quote(os.environ["ANTHROPIC_API_KEY"])
result = sb.exec(
f"cd /workspace && ANTHROPIC_API_KEY={key} "
"claude -p 'Explain what a microVM is in two sentences.'"
)
print(result.stdout)
sb.kill()import { Sandbox } from "@pandastack/sdk";
const sb = await Sandbox.create({ template: "codex", ttlSeconds: 1800 });
const result = await sb.exec(
`cd /workspace && OPENAI_API_KEY='${process.env.OPENAI_API_KEY}' ` +
`codex exec "Explain what a microVM is in two sentences."`,
);
console.log(result.stdout);
await sb.kill();# Create the sandbox; the command prints its id.
pandastack sandbox create --template gemini --ttl 1800
# Run the tool once and get the answer back.
pandastack sandbox exec <id> -- gemini --version
# Or open a terminal in the sandbox and use the tool interactively.
pandastack sandbox ssh <id>curl -X POST https://api.pandastack.ai/v1/sandboxes \
-H "Authorization: Bearer $PANDASTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template": "claude", "ttl_seconds": 1800}'
# → {"id": "…", "template": "agent", "status": "running",
# "metadata": {"template_alias": "claude"}, …}/workspace is there for the agent's work. Clone a repository into it first if the agent should work on your code.
Give the tool its key
The key is yours, and it should live only as long as the command that needs it. Put it in front of the command, as in the examples above, so it is in that one process's environment and nowhere on the sandbox's disk.
If you run many commands in one sandbox, you can export the key once in a shell profile inside the sandbox instead. Then remember that a snapshot of that sandbox contains the key too.
Do not bake a key into a custom template. A template is restored into every sandbox created from it.
Let the agent work without asking
On your laptop these tools stop and ask before they edit a file or run a command. In a sandbox there is nobody to ask, and nothing of yours to break: the sandbox is its own Firecracker microVM, and you delete it when the job is done. This is the place where each tool's "do not ask" mode is reasonable.
| Tool | Flag |
|---|---|
| Claude | --permission-mode acceptEdits |
| Codex | --dangerously-bypass-approvals-and-sandbox |
| Gemini | --yolo |
| Grok | --always-approve |
| Copilot | --allow-all-tools |
The tools change quickly. Run <tool> --help inside the sandbox to see the flags of the version installed there.
A sandbox still has network access, and the agent holds the key you gave it. Give it a key that is scoped to this work, not your main one.
What the name changes, and what it does not
- The sandbox's template is
agent. That is whatGET /v1/sandboxes/{id}reports, and usage is metered exactly as foragent. - The name you asked for is kept in the sandbox's metadata as
template_alias, so you can still tell yourclaudesandboxes from yourcodexones. GET /v1/templateslists the seven names, each withalias_of: "agent".- The names are reserved. A custom template cannot be called
claude,codex,opencode,gemini,grok,amporcopilot. - Nothing else changes. Snapshots, forks, preview URLs, the idle timeout and every SDK method work as they do for any other sandbox.
Related
- Templates: the full catalog and how to build your own.
- Claude Managed Agents: the
claude-agenttemplate, which is a different thing. There Anthropic runs the agent loop and your sandbox runs its tool calls. - Deep Agents and the other agent framework guides: when the agent is your own code and the sandbox is where its commands run.