文档

Multi-Agent Governor

试用

Govern any task that uses or considers multiple agents, subagents, delegation, parallel work, or speed-first execution. Use whenever the user says "多派 Agent"...

它能做什么

Govern any task that uses or considers multiple agents, subagents, delegation, parallel work, or speed-first execution. Use whenever the user says "多派 Agent", "并行", "省时间", "不用省 token", "many agents", or asks several agents to work or review simultaneously. Convert the request into bounded parallel lanes, route mechanical work to tools/scripts, issue minimal context capsules, enforce agent and QA limits, protect artifact freshness, wait for long-running sessions correctly, and report actual time and token usage.

技能文档

Multi-Agent Governor

Treat parallelism as an execution budget, not an agent-count target. Optimize for elapsed time and correctness while preventing duplicated work, stale reviews, full-history forks, and unbounded QA loops.

Hard Limits

  • Use at most 3 first-wave agents.
  • Use at most 2 final QA agents.
  • Use at most 5 agents total and 4 concurrently.
  • Use 1 QA wave by default; allow a second only for a verified blocking defect.
  • Do not let subagents spawn descendants.
  • Keep one integration owner: the main agent.
  • Disable full-history inheritance; use fork_context: false when the platform supports it.
  • Keep each context capsule at or below 6 KB.
  • Close completed agents immediately.

User phrases such as "多多多派 Agent" or "不用省 token" raise urgency and evidence coverage. They do not override these limits.

Choose the Execution Primitive

Before spawning, classify every work item:

Work itemExecute with
Independent expert judgment or bounded writingAgent
File reads, searches, API calls, shell commandsApproved parallel/batch tool calls
Counting, hashing, schema checks, formulas, overflow, string scansDeterministic script
Critical path, conflict resolution, final editsMain agent

Do not use agents merely to parallelize I/O. If fewer than 2 independent reasoning lanes exist, keep the task local or use only 1 sidecar agent even when the user asks for many.

Read references/orchestration-policy.md when decomposition or model routing is non-obvious.

Run Protocol

1. Define the run

Identify:

  • concrete objective and newest user instruction;
  • immutable source files and their hashes;
  • critical path owned by the main agent;
  • independent lanes with disjoint ownership;
  • deterministic acceptance tests;
  • user deadline and quality posture.

Create a manifest:

python3 scripts/init_run.py \
  --objective "" \
  --source /absolute/path/to/input \
  --mode fast-deep \
  --deadline-minutes 90

Use --main-thread-id when the current platform exposes a stable thread id. Store temporary run state under /tmp/multi-agent-runs/; do not place it beside user deliverables.

2. Build minimal capsules

Create one capsule per independent lane:

python3 scripts/add_capsule.py \
  --manifest /tmp/multi-agent-runs//run-manifest.json \
  --lane-id evidence-qa \
  --role explorer \
  --objective "Verify financing and source claims" \
  --input /absolute/path/to/workbook.xlsx \
  --deliverable "Structured findings only" \
  --acceptance "Every finding includes file/sheet/range evidence" \
  --exclusion "Do not edit source files"

Pass the capsule path and necessary file paths to the agent. Do not paste the long conversation, entire file contents, intended conclusion, or another agent's diagnosis. See references/agent-contracts.md.

3. Execute wave one

  • Spawn only the lanes that can proceed independently.
  • Keep urgent blocking work local instead of delegating it and waiting.
  • Assign disjoint file or responsibility ownership.
  • Continue meaningful main-agent work immediately after spawning.
  • Reuse an existing agent only when the new task depends on its prior local context.
  • Register agent ids with scripts/update_run.py agent-start.

When a command returns a session id, register it and poll that exact session until exit_code is present. Never rerun a command merely because the first call returned no output.

4. Integrate once

The main agent reviews findings, resolves conflicts, and writes the integrated artifact once. Agents must not concurrently edit the same deliverable.

Register the integrated build and hashes:

python3 scripts/update_run.py build \
  --manifest /tmp/multi-agent-runs//run-manifest.json \
  --artifact /absolute/path/to/output

5. Run deterministic gates first

Run format, schema, test, count, hash, formula, overflow, link, and prohibited-language checks before asking agents to review. Domain skills supply their own gates.

Then verify build freshness:

python3 scripts/check_freshness.py \
  --manifest /tmp/multi-agent-runs//run-manifest.json \
  --include-sources

6. Run one QA wave

Use no more than 2 non-overlapping QA lenses, such as:

  • factual/data consistency;
  • visual/narrative/user-perspective quality.

Every QA capsule must include the current build_id and artifact hashes. Do not edit artifacts while QA is running. Discard a result if freshness fails. Fix verified blockers in one batch. Do not spawn another broad review wave for cosmetic suggestions.

Read references/quality-gates.md for severity and stop rules.

7. Close and report

  • Close every agent as soon as its result is integrated.
  • Confirm every registered command session has an exit code.
  • Mark the run complete only after acceptance tests pass.
  • Collect elapsed time and usage from the platform's native telemetry when available. When running inside Codex, the bundled adapter can read local thread metrics:
python3 scripts/collect_usage.py \
  --manifest /tmp/multi-agent-runs//run-manifest.json \
  --write
  • Report gross tokens, cached input, fresh non-cached input plus output, agent count, and wall time when the platform exposes them. Never fabricate unavailable metrics.

Stop Conditions

Stop when all deterministic acceptance tests pass and no blocking QA finding remains. Do not continue because another reviewer might produce a different preference.

Escalate to the user before exceeding 5 agents, starting a second QA wave, changing frozen source files, or resolving a genuine product/business judgment that cannot be inferred safely.

Failure Prevention

  • Do not accept reviews without matching build hashes.
  • Do not mix findings produced against different artifact versions.
  • Do not ask multiple agents the same broad question.
  • Do not use a high-reasoning model for mechanical verification.
  • Do not mark a run complete while agents or command sessions remain active.
  • Do not treat cached-token volume as fresh-token consumption; report both.

相关技能

A comprehensive governance system for managing agent roles, responsibilities, handoff policies, and conflict resolution in multi-agent environments

用 4 Agent 半串行协作流水线(Plan/Write/Test/Refine)把老板的一句话需求变成可用的 Python 软件。Use when user says "做个软件", "开发工具", "写个脚本", or wants software built by AI agents.

2 次安装

Design a multi-agent team that actually routes work. Pick roles by what they refuse, wire reporting lines, bound hand-offs, and place human gates, before writing any orchestration code.

1 次安装

Coordinate multi-agent swarms for parallel and pipeline workflows. Use when coordinating multiple agents, running parallel reviews, building pipeline workflows, or implementing divide-and-conquer patterns with subagents.

27 次安装

为 AI Agent 设计评估方案、解读基准测试、横向对比主流多 Agent 框架。

22 次安装1 星标

多部门AI Agent组织架构搭建:层级设计、三通道通讯协议、日报汇报链、自主学习系统、全员审计巡查。解决Agent多了互相踩脚的问题——不是教你建团队,是教你一个AI团队怎么不被自己搞死。触发词:「agent团队」「多Agent组织」「Agent分工」「Agent管理」「Agent架构」「Agent协作」「AI组织」