A coding agent on your repository, with a spending cap
Hand an issue to Claude Code, Codex or OpenCode in a clean VM, follow it live, cap what it can spend, and get a pull request back.
For Engineers who delegate issues to agents
Why it pays
- A clean machine every time No leftovers from the last task, and nothing touches your laptop.
- Spending that stops itself A per-prompt budget ends a runaway turn, at the proxy, before the bill grows.
- Your keys stay outside The agent sees a placeholder; the credentials proxy adds the real key on the way out.
Step by step
Connect your model key once
Store the key with HareBox and route it through the proxy, so it never enters a sandbox.
CLI
harebox ai key set default anthropic-api-key --value "$ANTHROPIC_API_KEY" harebox proxy rule add --secret-ref anthropic-api-key --host api.anthropic.com --header x-api-key --template "{secret}"Start a sandbox for the issue
Use an environment that holds the repo and setup, and label the sandbox with the issue.
CLI
ID=$(harebox new --name issue-482 --environment web-app --label issue=482 | jq -r .id)Python
box = hb.create(name="issue-482", environment="web-app", labels={"issue": "482"})TypeScript
const box = await hb.create({ name: "issue-482", environment: "web-app", labels: { issue: "482" } });Hand the agent the task, with a cap
Pick the harness and a dollar budget. Events stream as the agent works.
CLI
harebox prompt "$ID" "Fix issue 482, add a test, and open a pull request" --harness claude --budget 3Python
for ev in box.prompt("Fix issue 482, add a test, and open a pull request", harness="claude", budget_usd=3): print(ev["type"])TypeScript
for await (const ev of box.prompt("Fix issue 482, add a test, and open a pull request", { harness: "claude", budget_usd: 3 })) console.log(ev.type);Steer it, if it drifts
Add guidance mid-turn without starting over, or interrupt just this conversation.
CLI
harebox steer "$ID" --message "Keep the public API unchanged" harebox interrupt "$ID"Python
hb.steer_agent(box.id, body={"message": "Keep the public API unchanged"})TypeScript
await hb.steerAgent(box.id, { body: { message: "Keep the public API unchanged" } });Check the cost and stop
Read the exact bill for the task, then stop the machine to end it.
CLI
harebox usage "$ID" harebox stop "$ID"Python
print(hb.get_sandbox_usage(box.id)["total_usd"]) box.stop()TypeScript
console.log((await hb.getSandboxUsage(box.id)).total_usd); await hb.stopSandbox(box.id);
Tips
- Conversations live on the sandbox's disk, so a stopped sandbox resumes with the agent's memory.
- Use
--newfor a fresh conversation in the same machine, and run several in parallel. - Set a project budget as well as per-prompt caps, so a busy week has a ceiling too.
Related use cases
Browser automation and scraping at scale
Run real Chrome with persistent profiles on a real desktop, record sessions for audit, and fork a logged-in browser into many.
See the stepsCI runners with a whole VM
Run tests that need Docker, systemd or KVM on a fresh VM per job, from GitHub Actions or any CI, billed by the second.
See the stepsLong-running autonomous agents
Let an agent work on a task for days, with its files, tools and browser intact, waking on a schedule or a webhook.
See the steps

