How we built teams of AI agents that don't loop
说明与用途
AI 代理团队通过基于快照的协调运行时、明确的交接映射和预执行限制检查,避免了无限循环、重复工作和不断上升的令牌成本。
问题
Free‑for‑all coordination in multi‑agent demos causes loops, duplicate work, and escalating token costs in production.
结果
Teams of AI agents now avoid loops, duplicate work, and runaway token costs by using a snapshot‑based coordination runtime, explicit handoff maps, and pre‑execution limit checks.
工作流
- Define a team snapshot with members, roles, way of working, handoff map, rules and limits.
- Choose a way of working: manager, pipeline, or open table.
- In manager mode, the lead plans tasks and delegates via
delegate_to(agent, task). Members execute tasks with their own models and return results. Results are merged by the lead into a single answer. In pipeline mode, members run in a fixed order, each receiving the previous result. In open table mode, a human or mentioned agent handles the task. When delegating, the runtime checks the handoff map to provide thedelegate_totool only to allowed targets. A handoff carries only the task and necessary context, not the full transcript. Before each handoff, the runtime checks limits on steps, handoffs, and cloud tokens; if exceeded, the handoff is refused. After execution, the runtime counts steps and tokens used and updates limits. The thread ends when limits are reached or no further handoffs are possible.
证据
Free-for-all coordination is the default in most demos, and it is the source of the problems above.
When a team thread starts, it takes a snapshot of the team: its members, their roles, the way of working, the handoff map, its rules and its limits.
In code, the tool only exists when the map gives an agent someone to hand to: ... if (!targets.length) return [];
Every thread has three limits: steps, handoffs and cloud tokens. Every handoff is checked against them before it runs.
- 记录日期: 2026-10-21T06:41:07.427Z