No account is required for the first run. Create a one-hour sandbox, save the returned box.id and sandboxToken, then use that token for commands or task messages.
Create anonymous sandbox
Call POST /api/sandboxes without auth. Save box.id as SANDBOX_ID and sandboxToken as CLANKER_SANDBOX_TOKEN.
Use messages when the runtime image includes an agent endpoint and you want task-level instructions instead of raw shell commands.
curl -sS "https://clankercloud.ai/api/sandboxes/$SANDBOX_ID/messages" \
-H "Content-Type: application/json" \
-H "X-API-Key: $CLANKER_SANDBOX_TOKEN" \
-d '{
"role": "user",
"content": "Clone the repo, install dependencies, run tests, and summarize anything that blocks the run."
}'
Clanker CLI
Use sandboxes from CLI or MCP
The open-source Clanker CLI now wraps the hosted sandbox API for terminal users and exposes the same operations as MCP tools for Codex, Claude Code, GitHub Copilot, OpenClaw, Hermes, and other clients.
CLI quickstart
Create, inspect, command, message, and delete hosted sandboxes from the terminal. Account-owned calls use CLANKER_CLOUD_API_KEY or --api-key.
# Create an anonymous sandbox. Save created.body.box.id and created.body.sandboxToken.
clanker cloud sandboxes create --name agent-sandbox --agent clanker-cli --region earth
# Use CLANKER_SANDBOX_TOKEN or pass --sandbox-token for sandbox-scoped calls.
export CLANKER_SANDBOX_TOKEN="<sandboxToken from create>"
clanker cloud sandboxes inspect "$SANDBOX_ID"
clanker cloud sandboxes command "$SANDBOX_ID" "pwd && ls -la" --timeout-seconds 120
clanker cloud sandboxes message "$SANDBOX_ID" "Clone the repo, install dependencies, run tests, and summarize blockers."
clanker cloud sandboxes delete "$SANDBOX_ID"
# One-shot agent task: create a sandbox and send the first task message.
clanker cloud sandboxes run "Clone the repo, install dependencies, run tests, and summarize blockers." \
--name repo-check \
--agent clanker-cli \
--region earth
MCP tools
Launch the CLI as an MCP server when an agent should create sandboxes, run commands, or send sandbox task messages through tool calls.
clanker mcp --transport stdio
# Hosted sandbox tools exposed by the MCP server:
clanker_cloud_create_sandbox
clanker_cloud_list_sandboxes
clanker_cloud_inspect_sandbox
clanker_cloud_delete_sandbox
clanker_cloud_run_sandbox_command
clanker_cloud_send_sandbox_message
clanker_cloud_run_sandbox_task
Markdown for agents
Fetch the agent-readable API docs
Agents can query a stable Markdown file before calling sandbox routes. Use it as retrieval context for tool runners, LLM orchestration, queue workers, and internal automations.
Fetch the Markdown file
Use this URL when an agent needs the full sandbox API contract without browsing the rendered page: https://clankercloud.ai/api-docs-agent.md
Paste this into your runner or system prompt before enabling sandbox API calls.
Before using the Clanker Cloud sandbox API, fetch https://clankercloud.ai/api-docs-agent.md. Start with an anonymous sandbox unless the task needs a persistent paid account feature. Save box.id and sandboxToken, keep workflow state with the sandbox, ask before side effects, and delete one-off runtimes when finished.
Agent handoff
Copy docs for your agent
Paste this into Codex, Claude Code, OpenClaw, Hermes, your own runner, or any LLM tool orchestrator that needs the sandbox API contract, account creation paths, token rules, workflow records, approvals, traces, memory, paid outputs, and cleanup behavior.
# Clanker Cloud sandbox API runbook for agents
Base URL: https://clankercloud.ai/api
Use Clanker Cloud sandboxes when a task needs a real hosted shell, files, command execution, workflow state, approval records, traces, memory, or a hosted output.
Agent-readable Markdown docs:
...
Use cases
Useful jobs to run in a sandbox
Repo triage from an issue
Clone a repo, install dependencies, run tests, inspect failures, and leave handoff memory before opening a PR.
CI smoke checks
Run build and test commands in a clean hosted runtime before a deployment, migration, or agent-authored change.
Approval-gated publishing
Generate a report or preview, create an approval record, then publish only after the user accepts the step.
Scheduled reports
Use workflow metadata to track weekly ops, cost, security, or account-review jobs with clear owners and steps.
Human handoffs
Store traces and short non-secret memory so a teammate or follow-up agent can resume without rereading the whole run.
LLM tool orchestration
Expose sandbox creation as a tool, keep sandbox tokens in orchestration state, and let the model call safe task operations.
Base URL
Use https://clankercloud.ai/api for public sandbox API calls.
Authentication
Use X-API-Key or Authorization: Bearer with either an account token or the returned sandbox token.
CLI and MCP
Use clanker cloud sandboxes for terminal workflows, or clanker mcp --transport stdio for agent tools.
Tiers
Anonymous sandboxes last one hour. Free account sandboxes last about eight hours. Paid accounts get larger persistent sandboxes plus hosted sites and /explain.
Agent state
Use workflows, approvals, traces, memory, and tools routes to make runs inspectable and resumable.
Lifecycle
List, inspect, wait, and clean up sandboxes
Agents should treat sandboxes like task runtimes: create one, wait until it is ready, keep the id and token, then delete it when the job is done.
List account sandboxes
Use an account API key to show sandboxes owned by the account. Anonymous sandboxes are only addressable by id and sandbox token.
Register sandbox creation as a tool. Your orchestration layer should call the HTTP API and store returned credentials outside the model transcript when possible.
A minimal dispatcher for the tool call. Keep sandboxToken in your runner or session store instead of echoing it back to the model.
async function dispatchSandboxTool(call) {
if (call.name !== 'create_clanker_sandbox') {
throw new Error('Unknown tool: ' + call.name)
}
const args = call.arguments
const created = await clanker('/sandboxes', {
method: 'POST',
body: {
name: args.name,
agent: args.agent || 'empty',
region: args.region || 'earth',
},
})
// Store these in your orchestration layer, not in the visible model transcript.
return {
sandboxId: created.box.id,
sandboxToken: created.sandboxToken,
expiresAt: created.box.expiresAt,
}
}
System prompt
Give this to an LLM or agent before allowing sandbox tool calls.
You can use Clanker Cloud sandboxes when work needs a real shell or hosted workspace.
Rules:
- Create one sandbox per task.
- Store sandbox id and sandboxToken from the create response.
- Prefer Clanker CLI or MCP sandbox tools when they are already available; they call the same hosted sandbox API.
- Use sandboxToken only for that sandbox.
- Run read and test commands freely.
- Create an approval before publishing, deleting, installing system packages, sending messages, or changing accounts.
- Put secrets in the user's normal secret manager or Clanker Cloud settings, not sandbox memory.
- Delete the sandbox when the task is done.
JavaScript helper
A minimal fetch helper for Node, Workers, serverless functions, or agent runners.
These examples are meant for small agent runners, queue workers, test automation, and internal tools that need a hosted runtime but still want an approval trail.
End-to-end JavaScript run
Create a sandbox, create a workflow, run a repo command, append a trace, and store handoff memory.
Use these as starting points for real workflows. They keep work inside one sandbox, record state as the job moves forward, and pause before side effects.
Repo triage from an issue
Create a sandbox for one issue, run the repo checks, and save a handoff for the next human or agent.
Use the returned sandboxToken for an anonymous sandbox. Use an account API key for account-owned sandboxes, listing sandboxes, paid hosting, and /explain.
Can I put secrets in sandbox memory?
No. Memory is for short non-secret handoff notes. Put secrets in the normal account, customer, or local secret boundary.
Should every LLM call create a sandbox?
No. Create a sandbox when the task needs a shell, files, a hosted workspace, workflow state, or a published output. Simple chat should stay as chat.
Next step
Need the concise reference?
Use the Sandbox API page when you want route tables and lifecycle rules without the longer examples.