Define the tool
Add a run_code entry to the tools array with an input schema for a code string. Claude now knows it can offload computation instead of guessing.
"name": "run_code", "input_schema": { "code": "string" }
Define a run_code tool in the Messages API and hand Claude a real interpreter — every call executes inside an isolated microVM, not on your host. Feed the result back and let Claude reason over the output.
Works with the real anthropic SDK · no card · $5 free credits.
from anthropic import Anthropic from pilldrops import Sandbox client = Anthropic() tools = [{"name": "run_code", "description": "Run Python", "input_schema": {"type": "object", "properties": {"code": {"type": "string"}}}}] msg = client.messages.create(model="claude-opus-4-5", max_tokens=1024, tools=tools, messages=[{"role": "user", "content": "Sum the primes under 100."}]) for block in msg.content: if block.type == "tool_use": with Sandbox.create(template="code-interpreter") as sb: r = sb.run(f"python -c '{block.input['code']}'") print(r.stdout) # 1060
Claude decides when to run code; PillDrops decides where. You register a run_code tool in the Messages API, and when Claude returns a tool_use block you execute the code inside a throwaway microVM — then send the stdout back as a tool_result so Claude can finish the answer.
Add a run_code entry to the tools array with an input schema for a code string. Claude now knows it can offload computation instead of guessing.
"name": "run_code", "input_schema": { "code": "string" }
On a tool_use block, spin up a code-interpreter sandbox, run the code, capture r.stdout, and append it as a tool_result. Claude reads real output — never a hallucinated number.
with Sandbox.create(...) as sb: r = sb.run(cmd) send(r.stdout)
Want the full Claude Code CLI, not just a function? The claude-terminal template boots a microVM with the Claude Code CLI installed and its own repo checkout — so the agent can edit files, run tests, and iterate without touching your machine. Give it real cores and a full day to work.
$ pilldrops sandbox create --template claude-terminal \ --vcpu 4 --mem 8192 --timeout 86400 ✓ sandbox sb_9f3c live · claude-terminal · 4 vCPU / 8 GB ✓ Claude Code CLI ready · repo checked out at /workspace session expires in 24h · pause/resume anytime
Skip the SDK plumbing entirely. Point Claude at the hosted PillDrops MCP server and it gets create, exec, file, and log tools over an OAuth-authed HTTP transport — nothing to install, no keys to paste.
$ claude mcp add --transport http pilldrops https://pilldrops.com/mcp ✓ added pilldrops (http) · OAuth · 73 tools available create_sandbox · run_command · write_file · read_file · get_logs …
Fourteen tools in total — create_sandbox, run_command, write_file, get_metrics, pause, resume, and more. Read the MCP server docs →
Real anthropic SDK, real pilldrops sandboxes. Wire up tool use, drop in the claude-terminal template, or add the hosted MCP — and start on $5 of free credits.