Skip to content

Agent runs

Last updated: 6 December 2026 · CLI 0.5.0 · API v1 (beta)

An agent run starts an AI command-line agent (Claude Code, Codex, Gemini CLI, Aider or OpenCode) on a clean hadronbox machine for you. You give a repository address and a task; hadronbox starts the machine, installs the agent, clones the repository, runs the task headless and leaves the result: exit code, changed file count, change summary and the agent's output.

Private repositories on GitHub only. The address must be under https://github.com, https://gitlab.com or https://bitbucket.org and cannot hold a user name, password, port or query. For a private GitHub repository set up the GitHub integration; on other providers only public repositories work and no access key is given to the machine.

How it works

  1. Queue: The request is accepted with 202 and the run enters queued.
  2. Machine: A new machine of the size you chose, with the agent's tool installed, is started (provisioning).
  3. Install: The agent's tool is installed on the machine (installing).
  4. Repository: The repository is cloned with git clone --depth 50 (cloning). You may give a branch.
  5. Agent: The task is given to the agent in headless mode (running). The task text is never put on a command line; it is written to a file on the machine.
  6. Result: The exit code, the changed file count and the git diff --stat summary are stored. The machine is paused; with destroyOnFinish it is deleted.

End states: succeeded (the agent ended with code 0), failed (failureReason gives the cause), timed_out (the time limit ran out) and cancelled.

From the panel

The Agents menu (AUTOMATION section) lists the runs. In the Run an agent form you enter the repository address, the branch, the task, the agent, the secrets the agent uses, the machine size, the time limit and "Delete the machine when it ends". A run's page shows the steps, the live output, the result and a Cancel run button.

With the CLI

hb run starts a run and hb runs manages runs (CLI 0.5.0 and later, not published yet). The API key needs the agent_runs:write and agent_runs:read scopes.

hb run \
  --repo https://github.com/acme/web \
  --task "Fix the failing date parsing test" \
  --agent claude-code \
  --secret ANTHROPIC_API_KEY \
  --follow

Give a long task from a file: --task @task.md. --follow streams the output and exits with the run's exit code when it ends. Other commands: hb runs ls, hb runs show <id>, hb runs logs <id>, hb runs cancel <id>. See the CLI reference.

With the REST API

curl -sS https://api.hadronbox.tr/v1/agent-runs \
  -H "Authorization: Bearer $HADRONBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "repoUrl": "https://github.com/acme/web",
    "task": "Fix the failing date parsing test",
    "agent": "claude-code",
    "secrets": ["ANTHROPIC_API_KEY"]
  }'

The answer is 202 with the run. Follow its status with GET /v1/agent-runs/{id}, stream the output with GET /v1/agent-runs/{id}/output (Server-Sent Events) and cancel with POST /v1/agent-runs/{id}/cancel. All fields are on the endpoints page.

FieldMeaning
repoUrlPublic repository address (required)
branchBranch to clone; the default branch when empty
taskWhat the agent should do, up to 8,000 characters (required)
agentclaude-code, codex, gemini-cli, aider or opencode (required)
secretsNames of the secrets the agent uses, up to 10
sizesmall (default), medium, large; a size your package allows
timeoutMinutesTime limit of the agent step, 1–60 (default 30)
destroyOnFinishtrue deletes the machine when the run ends; the default is to pause it

Comparing agents

You give the same task to 2 to 4 agents at once; each agent runs on its own clean machine and the results are shown side by side. There is no automatic scoring and no merging of a winner; you judge the result.

  • Panel: Start it with Compare on the Agents page. The comparison page shows each agent's status, duration, estimated cost, changed file count, change summary and the run and machine links in one table. From the same page you cancel every run, and pause or delete the group's machines together.
  • CLI: hb run --repo … --task … --agents claude-code,codex prints a comparison id (rgrp_…); hb runs compare <id> shows the results side by side (CLI 0.5.0 and later, not published yet).
  • API: POST /v1/agent-run-groups, GET /v1/agent-run-groups, GET /v1/agent-run-groups/{id} and POST /v1/agent-run-groups/{id}/cancel. The scopes are the same as for a single run: agent_runs:read and agent_runs:write.
  • Capacity: All agents run at the same time and each opens a machine. If the total number of machines does not fit your package's machine limit, your balance and your spend budget together, none starts and the answer is 402 (PLAN_LIMIT_MACHINES, CREDIT_INSUFFICIENT or BUDGET_EXCEEDED; details.requested is the number asked for and details.remaining the number that can open). There is no queueing: on the Beta package's limit of 2 machines, 3 or 4 agents cannot be started.
  • Cost: Each agent's machine minutes are multiplied by the current price list and the total estimate is shown on the comparison; the settled amount appears in usage on the Balance page. The start form also shows the hourly estimate.
  • Every agent in a comparison takes one place of the limit of 5 unfinished runs.

The agent's key

For the agent to reach its model provider it needs an API key (for example ANTHROPIC_API_KEY). Save the key on the Secrets page first and give only its name in the run; the value never travels through this API.

  • A selected secret is given to this run's machine only, as an environment variable. Secrets whose scope is "all machines" are in every machine of your organization anyway.
  • The agent and the code in the repository can read the key. Use a limited key that is separate for this job, and put a spending limit on it.
  • Known secret values are masked as *** in the output and in the stored output tail. Masking is an extra measure, not a guarantee.
  • The webhook payload carries no task text, output or secret value.

Limits and cost

  • At most 5 unfinished runs per organization; more answers 409 AGENT_RUN_LIMIT. Your package's machine limit applies too.
  • A run gets a time limit of at most 60 minutes. Longer jobs are not in this release.
  • The minutes of the machine started for the run are metered as usual (Credits and pricing); there is no separate agent fee. When the spend budget or the balance is not enough the run does not start: 402 BUDGET_EXCEEDED or CREDIT_INSUFFICIENT.
  • The live output is followed on the server that runs the run only; when the stream drops, the stored last part is read once the run ends.

Failure reasons

The failureReason of a failed run is one of:

ReasonMeaning
budget_exceeded, credit_insufficient, plan_limitThe machine could not start because of the spend limit, the balance or the package limit
machine_unavailableThe machine could not start; try again in a moment
tools_failed, tools_timeoutThe agent could not be installed on the machine or the installation did not finish in time
clone_failedThe repository could not be cloned; check the address, the branch and that the repository is public
agent_not_foundThe agent was not found on the machine
agent_failedThe agent ended with a non-zero code; look at the output
orchestrator_lost, internal_errorInterrupted on the server side; start it again

When a run ends, an agent.run.completed or agent.run.failed webhook event is sent (Webhooks). A cancelled run sends no event.

Agent runs · hadronbox docs