feat(agentswarm): M2 — peer-coordination swarm (router + handoffs)

createSwarm() composes named agents into one SwarmRunner: a router picks the
first agent; any agent hands control to a named peer via `HANDOFF: <name>`,
bounded by maxHandoffs. createLLMRouter() is a cheap-model router. Composes
with the rubric loop and HTTP handler since a swarm is itself a SwarmRunner.

6 new tests (routing, handoff, maxHandoffs cap, unknown-peer/unknown-route
fallbacks, empty-agents guard); 19/19 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-06-25 17:44:12 +00:00
parent 018a583a00
commit 925894359f
3 changed files with 223 additions and 0 deletions

View file

@ -8,6 +8,15 @@ export { createSwarmHandler } from "./handler.js";
export type { SwarmHandlerOptions } from "./handler.js";
export { createDeepAgentRunner } from "./runner.js";
export type { DeepAgentRunnerOptions } from "./runner.js";
export { createSwarm, createLLMRouter } from "./swarm.js";
export type {
SwarmAgent,
SwarmRouter,
SwarmRouterInput,
SwarmHandoff,
SwarmOptions,
LLMRouterOptions
} from "./swarm.js";
export { createRubricRunner, createLLMJudge } from "./rubric.js";
export type {
RubricEvaluation,