Protocol-agnostic worker orchestration CLI
Project description
subagent-cli
Language: English | 日本語
Orchestrate coding agents from another coding agent, cleanly and safely.
subagent-cli turns a manager coding agent (for example Codex or Claude Code) into a practical control plane for starting worker coding agents, sending turns, handling approvals, and continuing handoffs. 🤖
The command interface is protocol-agnostic, and the current runtime backend is ACP-based (acp-stdio).
Why subagent-cli? 🚀
Coordinating multiple coding agents is harder than it looks.
Many tools centralize this behind a single /subagent-style command.
But in real workflows, you may want to use different agents for different roles.
subagent-cli exists for that split. It separates responsibilities and routes communication through ACP to keep multi-agent collaboration simple and explicit.
For example, you can use Claude Code as the manager, start Codex for code review, and start Gemini for implementation.
Concrete Use Cases 🧪
- Flaky test investigation: split reproduction, root-cause analysis, and fix proposals across multiple workers.
- Parallel code review / research workers: run reviewer-focused and research-focused workers in parallel, then merge outputs in the manager turn.
- Parent crash -> handoff -> continue: recover from manager interruption by resuming from handoff context instead of restarting from scratch.
Note: the sample prompt in Quick Start is project-manager oriented. For the use cases above, adjust manager role instructions and worker prompts to match your workflow.
Current Scope 🧭
- Alpha (
v0.1.x) - Local single-host focused
- Python 3.11+
Features ✨
- Worker lifecycle:
start,list,show,inspect,stop - Turn operations:
send,watch,wait,approve,cancel - Handoff workflow:
worker handoffandworker continue - Strict approval flow with structured events
- ACP runtime integration (
acp-stdio)
Install 📦
With uv (recommended):
uv tool install subagent-cli
From PyPI:
pip install subagent-cli
From local artifacts:
pip install dist/subagent_cli-*.whl
Quick Start ⚡
- Bootstrap your local config.
subagent config init --scope user
-
Set launcher command/args/env in
~/.config/subagent/config.yaml. -
Initialize a controller in your workspace (run once per workspace, by you or your manager agent).
subagent controller init --cwd .
- Hand off from here to your manager agent (Codex / Claude Code).
Ask the manager agent to runsubagent prompt render --target manageras its first step.
Use this instruction template:
Act as the manager and product lead for this repository.
Use subagent-cli as the control plane and progress this task by coordinating a small team of worker agents rather than acting as a solo implementer.
Your role:
* Define the objective, user value, constraints, scope, and success criteria.
* Break the work into small chunks with clear owners.
* Assign worker roles intentionally.
* Coordinate handoffs, reviews, and validation.
* Review worker proposals critically and give actionable feedback.
* Make explicit decisions on whether to proceed, revise, compare options, or reject.
Default behavior:
* Delegate by default when useful.
* Prefer small, verifiable increments.
* Prevent over-engineering and keep the team focused on the smallest valuable outcome.
* Do not accept worker output blindly; evaluate it for product fit, feasibility, scope, risk, and validation quality.
Before execution:
1. Run `subagent prompt render --target manager` and follow that output.
2. Check command help before execution (`subagent worker --help`, `subagent send --help`, `subagent approve --help`).
3. State:
* your role
* planned worker roles
* task breakdown
* success criteria
* validation plan
During execution:
4. Start and coordinate workers with subagent-cli.
5. Use `send` as the default turn driver (`send` waits by default).
6. If `matchedEvent.type` is `approval.requested`, run `approve` and continue with `send`.
7. Use `watch` only when detailed event streaming or debugging is needed.
8. Use handoff/continue when context gets large.
9. Require workers to report: goal, findings, proposal, risks, validation, next step.
10. Respond to worker proposals with: decision, reason, what is good, what is missing, what should change, and next action.
Before reporting completion:
11. Verify results with tests or checks.
12. Confirm the final output is integrated, validated, and aligned with the task objective.
If worker startup or turn operations fail due to sandbox limits, request approval for out-of-sandbox execution and retry.
Task to execute:
<your task here>
After handoff, the manager agent's standard lifecycle is:
worker start -> send -> (approve -> send as needed) -> handoff -> continue
For a single command that sends and waits for terminal-or-approval events:
subagent send --worker <worker-id> --text "<instruction>" --json
Opt out of waiting when needed:
subagent send --worker <worker-id> --text "<instruction>" --no-wait --json
For shell-safe input (recommended when text includes backticks, $(), redirects, etc.):
subagent send --input - --json <<'JSON'
{
"workerId": "<worker-id>",
"text": "Use commands like `echo hello` literally; do not execute them."
}
JSON
workerId is required in JSON input payloads.
Manual wait mode (advanced cursor control) still exists:
subagent wait --worker <worker-id> --until turn_end --timeout-seconds 60 --json
For local simulation/testing without a real ACP launcher:
subagent worker start --cwd . --debug-mode
Troubleshooting 🛠️
- Ensure both the runtime and your manager/worker agent sandbox allow what your launcher needs.
- Some launchers require outbound network access, but agent sandbox policies can block network even when the host machine itself has connectivity.
- If state path resolution fails, run commands from inside your workspace root (or set
SUBAGENT_STATE_DIRexplicitly). - Preflight launcher availability:
subagent launcher probe <launcher-name> --json
- If
worker startfails withBACKEND_UNAVAILABLE, inspect runtime logs under<workspace>/.subagent/state/runtimes/(default) or$SUBAGENT_STATE_DIR/runtimes/(when overridden). - For cut-down local testing without backend connectivity:
subagent worker start --cwd . --debug-mode
Configuration ⚙️
- Resolution order:
--config>SUBAGENT_CONFIG> nearest<cwd-or-parent>/.subagent/config.yaml>~/.config/subagent/config.yaml - Generate user config:
subagent config init --scope user - Generate project config:
subagent config init --scope project --cwd . config initdefaults:codex->npx -y @zed-industries/codex-acp,claude-code->npx -y @zed-industries/claude-agent-acp,gemini->npx -y @google/gemini-cli --experimental-acp,opencode->opencode acp,cline->npx -y cline --acp,github-copilot->npx -y @github/copilot-language-server --acp,kiro->npx -y @kirodotdev/cli acp- Override config path:
SUBAGENT_CONFIG=/path/to/config.yaml - Example config: config.example.yaml
- Launchers support either split style (
command: npx,args: ["-y", "..."]) or inline style (command: "npx -y ...") for probe/start/restart.
State 💾
- Default state DB:
<workspace>/.subagent/state/state.db - Override state dir:
SUBAGENT_STATE_DIR=/path/to/state-dir - If workspace root cannot be detected and no override is set, commands fail with
WORKSPACE_ROOT_NOT_FOUND - Project hint file:
<workspace>/.subagent/controller.json
Documentation 📚
- Architecture note: docs/ARCHITECTURE.md
- Examples: docs/examples
- Contributing and release process: CONTRIBUTING.md
License
MIT (LICENSE)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file subagent_cli-0.1.5.tar.gz.
File metadata
- Download URL: subagent_cli-0.1.5.tar.gz
- Upload date:
- Size: 100.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
892d6fa9ea1ab8e88ced5813439ed1105b8cd5ecbf8d677ea86e5eee55525976
|
|
| MD5 |
23b7677cd21e74a8eb8b097bc5426eaa
|
|
| BLAKE2b-256 |
cbdc55f7848b1f6d4e57d4fbccb718dfb29575d8e196b9544fe0795a7a8f55bc
|
Provenance
The following attestation bundles were made for subagent_cli-0.1.5.tar.gz:
Publisher:
publish-pypi.yml on otakumesi/subagent-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subagent_cli-0.1.5.tar.gz -
Subject digest:
892d6fa9ea1ab8e88ced5813439ed1105b8cd5ecbf8d677ea86e5eee55525976 - Sigstore transparency entry: 1015773247
- Sigstore integration time:
-
Permalink:
otakumesi/subagent-cli@5414a71bb905c7fff2dd4077bf6c48fb03471750 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/otakumesi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5414a71bb905c7fff2dd4077bf6c48fb03471750 -
Trigger Event:
release
-
Statement type:
File details
Details for the file subagent_cli-0.1.5-py3-none-any.whl.
File metadata
- Download URL: subagent_cli-0.1.5-py3-none-any.whl
- Upload date:
- Size: 64.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d589690b0142bfdfcabf37e9c9b3f5c37fcc0802708088073c008ffa4fb5993a
|
|
| MD5 |
e928cd679ee6cab2a3d1eb4f048cc94a
|
|
| BLAKE2b-256 |
b40bbbb2ff56077cbdc7a35e5f11b7b6ca00b7943190ad5c3069dc24e5f26ca1
|
Provenance
The following attestation bundles were made for subagent_cli-0.1.5-py3-none-any.whl:
Publisher:
publish-pypi.yml on otakumesi/subagent-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
subagent_cli-0.1.5-py3-none-any.whl -
Subject digest:
d589690b0142bfdfcabf37e9c9b3f5c37fcc0802708088073c008ffa4fb5993a - Sigstore transparency entry: 1015773345
- Sigstore integration time:
-
Permalink:
otakumesi/subagent-cli@5414a71bb905c7fff2dd4077bf6c48fb03471750 -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/otakumesi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5414a71bb905c7fff2dd4077bf6c48fb03471750 -
Trigger Event:
release
-
Statement type: