chainabit agents run
Run local agents as child conversations of this command; prints chainabit.agents/v1 with --json or --events
Synopsis
chainabit agents run [name] [options]Arguments
| Argument | Description | Default |
|---|---|---|
[name] | — |
Options
| Option | Description | Default |
|---|---|---|
--task <text> | The task for the agent | — |
--task-file <path> | Read the task from a file in this folder | — |
--spec <file> | Run several: a JSON array of | — |
--parallel <n> | Run at most n at once (never more than 3) | — |
--model <key> | A model key; default: server routing | — |
--mode <mode> | plan, ask or auto; never above your settings | — |
--timeout <duration> | Wall clock per agent, e.g. 10m (max 30m) | — |
--with-context-file <path> | Give the agent a file of this folder as context | — |
--budget <credits> | Start no agent once settled credits reach this | — |
--fresh | Run again even when the same task completed in this run | — |
--events | Print one chainabit.agents/v1 event per line (NDJSON) | — |
--answers <source> | stdin: answer agent.question events with {"type":"answer","questionId","answers"} lines | — |
Options shared by every command are described in Global options and shared behavior.
Behavior
Starts one or more local agents as child conversations of this command, on the same conversation path every turn uses. Billing, quotas, model entitlement and cancellation stay with the server. Each agent runs with at most your own permissions: its tools are capped by its definition and by your settings, Bypass All is never passed to it, and an agent cannot start another agent. The folder must be trusted.
- Give the task with
--taskor--task-file(a file inside this folder), or run several with--spec, a JSON array of one to twenty{ "agent", "task", "key"? }objects. At most three agents run at once (--parallellowers that), twenty per run, one of them changing files at a time. A result is at most 16 KiB. --modesetsplan,askorautofor the agent, never above your settings.--modelnames a model key; the default is the server's routing.--timeoutis the wall clock per agent, from 10s to 30m (default 10m).--with-context-filegives the agent a file of this folder as context.--budget <credits>starts no further agent once the credits settled in this run reach the number. A run's credits come from the server's own report; nothing is estimated.- An identical task that already completed in this run is reused unless you pass
--fresh. - Approvals and questions belong to you, the owner of the run. Without a terminal approver a request that needs approval is refused (
approval_unavailable). With--events --answers stdineach question arrives as anagent.questionevent and you answer it with one line on standard input:{"type":"answer","questionId":"<id>","answers":[...]}. When standard input ends, open and later questions stay unanswered and the agent stops instead of waiting.--answersneeds--events.
Output
With --json the result is one object: v (chainabit.agents/v1), agents (handle, state, grant, usage with tokens, credits and wall time, result), refusals and a summary. With --events each line is one event of chainabit.agents/v1 (NDJSON): agent.queued, agent.started, agent.status, agent.approval, agent.question, agent.message, agent.completed, agent.failed, agent.cancelled, agent.expired, agent.refused, agent.deduplicated and a final session.summary. Fields are only ever added within v1.
The exit code is 0 when every agent completed. A network failure is 6, exhausted credits, a quota, or a --budget or session limit that stopped further agents is 5, a refused approval or an untrusted definition is 4, interruption by Ctrl+C is 130, and any other failure is 1.
Safety and billing
Every agent turn is a model run that consumes credits from your plan or wallet. Set --budget when you run several agents.
Examples
The agent name and task are placeholders; use a name from chainabit agents status.
chainabit --json agents run reviewer --task "Review the changes in this folder"
chainabit agents run --spec tasks.json --parallel 2 --budget 20 --events