Swarms
A swarm is a team of a workspace's agents in a shape — who leads, who works, how work moves between them — sent on one long task under a budget and a time cap. The lead plans the work, the team does the pieces in parallel, the lead checks every piece against what it was for, and writes the answer. Every step is a real turn of a real agent, governed and on the ledger.
Code: modules/svc-core/app/services/swarms/. Routes: /app/swarms (app/router/app/swarms/router.py). Switched off unless SWARMS_ENABLED (SSM features/), until verified live.
When to use one, and when not
A swarm earns its cost on work that splits into pieces that can be done apart — research across several sources or markets, a comparison, a review of several documents — where more tokens spent in parallel buy a better answer. It costs more than one agent: several turns, a review and an answer, each a full agent turn.
It does not help, and can hurt, where each step needs the last one's result, or the task is small. The lead may then plan one piece, which runs alone and is the answer (Approach.one_agent): no review, no synthesis.
Shapes
A shape is one registered class in swarms/topologies/, served as a catalogue (GET /app/swarms/topologies): its roles, its settings (each bounded, choices from the enum that defines them) and its presets.
| Shape | How it runs | Presets |
|---|---|---|
hierarchy — Team hierarchy | The lead splits the task into parts, one per manager; each manager plans its part for its workers (or takes a piece itself), reviews their pieces and reports up; the lead reviews the reports and writes the answer. With three levels, a manager's part goes to sub-managers in turn. See Teams. | Pyramid (1 → 3 → 9); Middle-heavy (1 → 4 → 8: many managers over few pieces each); Deep (1 → 2 → 4 → 8) |
mixture_of_experts — Mixture of experts | A router splits the task into questions and sends each to its top_k best-suited experts, who answer in parallel (each samples times; with two layers, again after reading every first answer); the router writes the answer from theirs. See A mixture of experts. | Routed experts (up to four questions, two experts each); Mixture of agents (the whole task to three experts, two layers); Self-MoA (the one best expert, three times) |
council — Council | Every seat answers the whole task on its own; members then vote for the best answer (their own left out, the chair breaking a tie), or the chair writes the answer from all of them; optional debate rounds first. See A council. | Committee (strong agents answer once, then vote); Deliberation (one debate round, then the chair writes); Self-consistency (each answers three times, then vote) |
pipeline — Pipeline | Stages in the order the person put them, each with a note for its job, each working on the last stage's work; the last stage's is the answer. As a chain of agents, the stages read the attached documents part by part, passing notes on. See A pipeline. | Research, draft, check, edit; Chain of agents |
supervisor and hierarchy are made of the same nested units (topologies/units.py): a shape says only how deep its teams go, how wide each level is, and which model and effort each role's pieces run under, and the engine writes each step's prompt. A shape whose steps are something else — a routing, a vote, a stage — writes what each of them is asked itself (Topology.ask, returning an Ask: the prompt, the schema, the documents, whether it may ask the person, which part of the documents it reads, or why it has nothing to do), so a new shape is still one class. Two new kinds of task carry them (route, vote; stored as strings, no migration). A shape also declares whether it plans (plans, served on the catalogue: a council or a pipeline has nothing to approve), checks its settings and roster together (Topology.check: a council of one answer) and a dispatch (dispatch_problems: a chain of agents with no documents), and says what its first tasks share (seed_pool, work_pool).
A setting may depend on another (Param.shown_when, served on the catalogue): a hierarchy's third span applies only with three levels, and the form shows it only then.
The roster is which agents play which part (Swarm.roster: [{role, agent_id, spawn, note}]). Agents must be in the swarm's own workspace (or be CHAINR Bot). A spawn entry is a template: the lead may brief it as several workers, each with a specialism it writes, every one running and governed as that agent. Other members keep the role they have. A note (up to 300 characters) is what the person wants of that agent here — a pipeline stage's job, a council member's angle, an expert's field — and is shown to whoever assigns work; one agent may play a role twice with different notes. A role may be ordered (RoleSlot.ordered: a pipeline's stages), and its members run in the order given. Members reach the lead by handle (A1, A2…), never by id. The roster is stored as checked: notes tidied, unknown keys dropped.
A run
POST /app/swarms/{id}/runs with the task (and optionally budget, time cap, parallelism, documents) starts a run (swarm_runs) whose work is a tree of tasks (swarm_tasks):
Plan (
P1): the lead fillsSwarmPlan— an approach, then each piece with its objective, what to hand back, where to look, what is not its business, how it will be judged done, its effort and which earlier pieces it needs. The schema is built per run: assignees are aLiteralof the roster's handles,afterof the plan's own pieces.Approval (optional, on by default): the plan waits with its estimate.
Work (
T1…): each piece's agent gets its brief and a<swarm_context>: the team's task, the plan with who does what and how far it has got, and the run's ledger (what the team has established, assumed and left open). Pieces run in parallel up tomax_parallel; pieces another needs are attached to it.Review (
R1): the lead reads the finished pieces as attached documents (read whole, or searched and read on) and fillsSwarmReview: accept, or redo with an instruction. A piece is sent back once; its redo is read in its place. A piece that did not finish is listed with why ("Not finished: …"). A review with nothing finished to read is skipped, and what waited on it starts at once: the coordinator looks again after every task it skips or fails before it starts. The first live follow-up (30 October 2026) went on with the tasks that had been ready before, so a last round's skipped review left the answer unwritten and the finished pieces were given as they were.Answer (
S1): the lead writes the answer from the pieces, keeping their citations, saying plainly what was not established.
The coordinator (engine._Coordinator) is generic: it starts every task whose dependencies have settled, records each as it finishes and asks the shape what follows (Topology.advance).
A run ends completed, partial (the answer was written from part of the work — a cap, Stop, or pieces or teams that failed, were refused or were skipped; or no answer could be written and the finished pieces are given as they are), failed, blocked (a rule refused the plan) or cancelled.
Follow-ups: a thread of requests
swarms/thread.py, migration 120 (30 October 2026). After reading a run's answer, a person may follow it up: the same swarm, as it is now, sent on the next request of the run's thread, building on what the thread has done. So sequential work (research, then the brief from it, then a shorter version) is a thread, each request traceable to the one before.
A thread is a line.
swarm_runs.parent_run_idnames the run a follow-up follows up;thread_idis the thread's first run,thread_seqits place, unique per thread. Only the thread's latest run may be followed up (ThreadMovedOn, 409: another follow-up came first), once it has finished, however it went. A thread holdsMAX_THREAD_RUNS(20) requests. A run an evaluation started cannot be followed up, nor one whose swarm was deleted. A scenario's thread stays the scenario's.It starts where the thread is. The parent's ledger (established, assumed, still open) seeds the follow-up's. The person's documents of the earlier requests go after the new ones (at most 10; Keep the documents from earlier requests,
carry_files), sent as the conversation's (attached_in=earlier).What every step receives is the work itself, never a summary a model wrote of it:
the earlier requests, as the person wrote them (the previous one whole, older ones to 2,000 characters), with how each went, and how to build on them (
<earlier_requests>, in every shape's prompts: inside<swarm_context>, the plans, and the task block of councils and pipelines);the previous answer, attached to every step ("Answer to request N (previous)"; for a request that did not answer, the pieces it finished);
older answers, up to four, newest first, to the steps that plan and that write the answer;
the earlier pieces a piece builds on: the lead's plan is shown the previous request's finished pieces (
2.T1…) and may say each new piecebuilds_onsome (four at most, aLiteralof those refs in its schema, asked only when there are any); only those go to that piece's worker, in full ("Earlier work: request 2 · T1 …"), and the brief keeps them.
svc-ai shows a short document whole and lets an agent search and read on in a long one, so this costs no extra model call.
What it was sent with is kept:
config.threadsnapshots the earlier requests, their outcomes and the pieces offered. Earlier runs are finished and never change, so what each step was given can be derived again — the decision record lists each task's documents from its thread.One step's documents fit svc-ai's limit (
thread.fit, 20 documents): its own inputs first, then the previous answer, the person's documents, the pieces it builds on and older answers; what is left out is named in its prompt. Each document is cut to what svc-ai takes of one (markedtruncated). This also fixed a review of twelve pieces with ten of the person's documents, which svc-ai would have refused.Routes:
POST /swarms/runs/{run_id}/follow-up(a dispatch's body pluscarry_files; 202, 422, 409);GET /swarms/{swarm_id}/threadsandGET /swarms/threads(the 20 threads with the newest activity, each its runs first to latest,requests,open, total spend); every run read carriesthread_id,thread_seqandparent_run_id, and a run's detail its thread's requests (thread).Advice reads first requests only: a follow-up is small by nature.
Measured in a scenario (30 October 2026): a scenario run may have
follow_ups, sent in turn throughengine.follow_up, and its export says for each follow-up where it is in its thread, which earlier pieces each new piece builds on, the earlier documents each task read, and how many of its answer's sources the thread had cited before. Checks:min_builds_on,cites_pages,cites_carried.samples/scenarios/swarms.jsonfollows its lead and analysts' comparison up as a CFO's brief (docs/guides/scenario-runs.md#swarms-in-a-file).
Sources carried through
Migration 121, svc-ai app/util/attachments.gather (30 October 2026). A piece reached the lead as a document with no URL, and svc-core dropped what svc-ai said each answer cited, so every swarm answer — and its PDF — cited its own pieces ("T1 UK spend") and never the pages they read, and a follow-up cited the earlier answer the same way. Now:
Kept. An agent turn's
cited_citations(each source with the number its text cites it by) ride on the invocation (Invocation.citations, fromai_client._turn_detail), redacted by the turn's Output rules as a chat answer's are (agents.transformers.stored_cited_sources), none for an answer withheld or a question. A finished task keeps them (swarm_tasks.citations), and a run its answer's (swarm_runs.citations; an answer assembled from pieces keeps theirs in its text).Handed on. Every document that is an answer — each piece a review or the answer reads, a piece a later piece needs, the previous and older answers and the pieces a follow-up builds on — goes with its sources (
TurnDocument.sources, the sharedattachment_wire.carried_sources: the number, and what names the source, at most 100). A person's own documents never carry any.Given the run's ids. At svc-ai's boundary each carried source takes the next id after the documents (
S1… the documents, then their sources), one id however many documents cite it (source_registry.source_key); the document's text cites them so ([1]→[S3], a number naming no carried source taken out, code and link targets left alone) and its own Sources block goes (with_ids). The registry holds them (attachments.citations→seed), so an answer that cites[S3]ends with CHAIN-R's Sources block naming the page, its URL and date, and the quality check counts the id as real. The document itself is still a source, for what it says in its own words. The answering note says to cite a document's ids as it does.
Teams: a hierarchy of units
A unit is a plan, its pieces, a review and an answer (topologies/units.py). The lead's plan is the root unit. In a hierarchy each of its pieces is a team: a manager's plan for its part, the pieces it gives its workers (or, with three levels, sub-teams), its review of them, and its report up. A lead and its workers is one level of units; a lead over managers over workers is two, on the same machinery.
Whom a plan may assign (
Units.assignable): the role below it — managers above the last level, workers at it — and, for a manager, itself. A manager with no workers on the roster does its part's pieces itself. The plan's schema is built from those members' handles, so a model cannot assign anyone else.What a manager reads: its part's brief (
<your_part>), the whole task (<whole_task>), its team (<team>) and the run's<swarm_context>, so each level knows what its work is for.Handles: the root's pieces are
T1…, its reviewR1and answerS1; a team's pieces areT1.1…, its reviewT1rand its reportT1s; a redo takes ab(T1.2b,T1sb).A plan of one piece (
Approach.one_agent) is done alone, and its result is the team's: no review, no report.Reviews read results, each as an attached document: a piece of work as last done, a team's report as last written. A team that never planned, or whose work all failed, reads as missing. The review above a team waits for that team's result (
Step.wait_also), so it never judges a part before its report is written.Sent back once: a piece of work is done again, with a share of what is free (see Budget and time); a team's report is written again with the reviewer's note and the share it had (its pieces are not redone). Either records the review that asked for it (
asked_byon its brief).More rounds (the lead's progress check, after Magentic-One): the lead's review fills
SwarmReviewRound— its verdicts, then whether the answer can be written (answer) or another round of work is worth its cost (more_work), with the new pieces. At mostMAX_ROUNDS(2) more rounds, never while wrapping up; each round is reviewed on its own (R2,R3) and the answer waits for all of them. Each new piece records the review that asked for it (asked_by). The lead is told the money for new work — what is not reserved for the answer, spent, held by open tasks or kept for the next round's review (Units._pool,PlanSpec.pool) — and the time left, never the budget with the answer's reserve in it. It is offered more work only from the members one new piece of whom that money covers (a small piece at the agent's typical turn, or a whole team's turns in a shape of teams), and no more pieces than it covers of the cheapest (engine._affordable): when it covers none, the review's schema has nomore_work. A piece that did not finish cannot be sent back, and the review is told to ask for it as new work, smaller if money stopped it. Team reviews do not ask for rounds.Model and effort per level (
level_settings): a hierarchy sets the managers' model, and the workers' model and effort; the lead runs as configured. A lighter model is chosen per agent (lighter_model.choose), as Economy does.The shape's checks (
Topology.params_problems,warnings): a hierarchy whose spans could plan more than 48 tasks (each team's plan, review and report, and every bottom piece) is refused, leaving room for redos and rounds within the run's 80; spans four or more times apart (say 1 → 8 → 1) are allowed, with a warning on the run: balanced spans coordinate better.
A mixture of experts
topologies/experts.py. A router (one) and experts (one to twelve; a template is briefed as a different specialist per question).
Routing (
P1, kindroute): the router fillsSwarmRouting— the questions the task splits into (at mostquestions; one when it does not split), each briefed as a piece is, with its experts ranked best-suited first, by what each agent says it is for and its note. The experts are aLiteralof the run's own; one it names that the run lacks is dropped. The routing waits for approval like a plan, its answers the pieces.Answers (
Q1.1,Q1.2…): the firsttop_kexperts of each question answer it, eachsamplestimes on its own — the same expert sampled several times is Self-MoA — each told how many other answers are being written to its question, and to write its own as if none were.A second layer (
layers2;Q1.1r…): once every first answer to a question has settled, each expert answers it again with every finished first answer in hand (its own marked), within the share its first had.The answer (
S1): the router writes it from each question's final layer — where the experts agree, rely on it; where they differ, weigh them by their sources and say which it follows.
One question to one expert, answered once, is that expert's answer. Settings that could ask for more than 40 answers are refused.
A council
topologies/council.py. A chair (one: it answers like every member, breaks a tied vote, and writes the answer when the council does not vote) and members (up to six). Nothing is planned, so nothing is approved.
Answers (
P1…Pn): every seat — each member,samplestimes — answers the whole task on its own, never seeing another's.Debate rounds (
debate_rounds, 0–2;P1.2…): each member reads every answer of the round before, numbered and never named (its own marked), and writes its own again — told to keep a view its sources support, since agreeing is not the aim.The decision (
decision): by vote (V1…, kindvote), each member chooses among the last round's finished answers (CouncilVote, aLiteralof them), its own left out where there are others; the answer chosen most is the run's, a tie going to the chair's choice, else the first-numbered, and the count is on the run's ledger ("The council chose P2: 2 of 3 votes"). The votes share the review's share of the budget. Or aggregate: the chair writes the answer from them all (S1). With no vote to count, or a run stopped before its vote, the chair writes it.
A council needs at least two answers (a chair alone answering three times is self-consistency); more than 40, every round counted, is refused.
A pipeline, and a chain of agents
topologies/pipeline.py. Stages (one to eight, ordered), each with its job as its note. Nothing is planned, so nothing is approved.
Stages (
T1…): each is handed the latest finished stage's work and told where it stands among the stages; a stage that fails is passed over; the last stage's work is the answer — or, if it fails, the latest finished stage's. Stopped early, the last stage's agent finishes the answer from the latest work (S1). Stages share all the budget not kept for the answer: there is no review. A pipeline of stages needs two.A chain of agents (
modechain; Zhang et al., NeurIPS 2024): the stages read the documents attached to the task a part at a time (swarms/parts.py: about 40,000 characters a part, cut at a paragraph, twelve at most, a part that begins inside a document saying which), in turn, every stage but the last reading (C1,C2…), each handed the notes before it; the last stage writes the answer from the last notes alone (S1). The parts are cut in the worker from the documents as the workspace holds them, the same cut every time; a reader reports how many there are ({"part", "parts"}on its result). If the first reader fails, the last stage reads the documents whole. Dispatching a chain with no documents is refused.
Measuring a swarm
A swarm costs several agents' turns where one agent costs one; whether that buys a better answer is measured, not assumed. A swarm is an evaluation target (targets.SwarmTarget, {"type": "swarm", "swarm_id", "budget_usd"?, "time_cap_s"?}), beside models and agents:
A cell is one whole run of the swarm on the case (
engine.startthenengine.execute, on the cell's own thread), started unattended — no plan to approve, no questions, whatever the swarm's defaults say — with the variant's budget and time cap a case, else the swarm's. Its answer is what is graded; a run that does not answer fails the cell, saying why.Its spend is the evaluation's (the user's choice): the run's origin (
engine.Origin.evaluation,config.origin) makes every task ledger as it finishes with sourceexperimentand execution typeevaluation(tasks.LedgerAs,engine._ledger_as), and svc-ai's traces carry the evaluation's ids. The cell'sInvocationcarries the run's measured figures (cost per answer on the leaderboard) and is marked ledgered, so nothing is counted twice; each task stays governed by its own agent's rules, and the budgets are asked as for any evaluation.Its runs are hidden from the Swarms lists (
engine.listed), linked from the cell instead (run_metadata.swarm_run), do not count against a person's two runs at once, and tell nobody's inbox. A run whose evaluation went away (a restart) is finished by the watchdog, not resumed: nobody would read its answer.What a swarm cannot take is refused: a variant's knowledge, tools, model or temperature (its agents answer as they are), a case's scripted tools, and a schema. A case's conversation and data go into the task.
The preset "Swarms against single agents" (
presets.SwarmsPreset) puts each chosen swarm beside single agents — by default each swarm's own lead alone (presets.lead_of: the first member of its shape's first role), the question a swarm has to answer. Its preview says what the swarm runs may spend: their budgets a case, every case.A swarm is its own target when regressions compare runs (
swarm_idinregression._target_identity).
What its record says
swarms/advice.py, GET /app/swarms/{id}/advice: advice on a swarm's shape read from the record — the viewer's own finished runs of it (an evaluation's included, newest 20) and the evaluations of its workspace that ran it — never asked of a model (the user's choice). One registered class a kind, each saying what it saw in figures and what to try, and nothing when it has too little to go on:
| Kind | Says so when | Try |
|---|---|---|
sequential | half of 6+ pieces waited on another | a pipeline, or one agent |
sent_back | reviews sent back 30% of 5+ pieces | each agent's own model (if workers ran lighter), or notes |
stopped_early | half of 2+ runs wrapped up for budget or time | a larger cap, fewer pieces |
idle_members | members never given a piece in 3+ team runs | remove them, or a note |
measured | an evaluation ran it beside single agents | a single agent that did as well (with both costs an answer), or that it beats them |
fe-core shows it at the top of a swarm's Overview (What its record says), with a link to change the swarm, open the evaluation, or evaluate it with the preset.
Budget and time
swarms/budget.py. A run keeps a reserve for its answer: 10% of the budget or 1.5 of the lead's typical turns, whichever is more (at most half); 10% of the time cap, at least five minutes.
Shares. The plan has 15% of what is not reserved, the review 10%, and the pieces split what is left in proportion to their estimates (their agent's p90 turn cost,
usage.typical_turn_cost, × 1, 2 or 4 for small, medium or large).Team budgets. A team's share is its whole budget, kept on its plan's brief (
team_budget): its plan, review and report keep 15%, 10% and 10% of it, and its pieces split the rest by estimate, as the root's do (Step.pool), with what the plan did not spend of its part. A team's estimate is its manager's typical turn × the turns the team would take: its plan, review and report, and two turns a piece — or a sub-team's turns, one level down (Units._team_turns).Money follows the work (30 October 2026). What a settled task did not spend of its share — done, failed, skipped or refused — goes to the work still waiting in its unit (the queued pieces, pieces done again and teams not yet planned under the same lead or manager), in proportion to their estimates (
Units.release, applied byengine._pass_onbefore the shape says what follows, so nothing is counted twice). Once a team's plan and everything under it have settled, what the team left goes to the work waiting beside it, once (a team not yet planned grows itsteam_budget, and its plan's part with it). A share only ever grows. Reviews keep their fixed shares, the answer its reserve, and the plans give nothing: a plan's leftovers reach its pieces through their pool. Each end is recorded on the task's brief:passed_on_usdon what gave,topped_up_usdon what was given, and a task keeps its share on record, so "Spent $x of $y" still reads what it was given. Running calls keep their lease; nothing moves while the run wraps up. Experts, councils and pipelines keep the shares they are given up front (Topology.releasereturns nothing).Nothing promised twice. What a unit splits between new pieces leaves out what its open tasks still hold (
budget.held: each open task's share less what it spent; a team not yet planned, its whole budget). A piece done again is shared out of that, like a new piece of the same step; it used to bring a copy of its original's share on top of what the round split (the live run's redo took about $0.47 beside the $0.62 the round's four pieces split). A team's report written again keeps its fixed share.Leases. The most one call may spend is the share left, or what is left of the run less the reserve and the other running tasks' leases, whichever is less. Only the run's answer may draw on the reserve; a team's report, which had, may not (
budget.run_left). svc-ai stops a call past it (X-Spend-Limit, viatargets.spend_ceiling), as it stops one past a budget rule, and the rules' own limit still applies. A stop says what ran out (SpendLimit.kind = "swarm", itscap_usdwhat the share had left when the call started): "it reached its share of the swarm's budget ($X)", or, when the run had less than the share, "the swarm had only $X left for it, less than its share ($Y)". A piece whose share is used up before it can start (a retry that spent it) fails alone, with "Its share of the budget was used up before it could start." (engine.SHARE_USED_UP); the run wraps up only when it has no money left to lease.Wrap-up. When no work can be leased, when only the answer's time is left, or when someone presses Stop, the run stops starting work: what has not started is skipped, and the answer is written from what is done, told what is missing. The answer may run until ten minutes past the deadline; after that the finished pieces are given as they are.
The time cap is the team's working time (30 October 2026, migration 119). While the run waits on a person (the plan's approval, or answers nothing else can go on without), its clock is stopped (
paused_at), and the deadline moves on by the wait when it resumes (engine._pause/_resume). The plan's approval used to count against the cap. The first live run's plan was approved late, so its first piece had minutes left until the wrap-up point. Its call was cut off there, and the run failed with "The agent or model could not answer". The page shows "Paused while it waits for you" with the time left held still. A wait is bounded instead byWAIT_TTL(a day; see Durability).A call past its time. A piece's call may run until the wrap-up point (
budget.timeout, at most 30 minutes). svc-core tells svc-ai to stop a little before it stops waiting (time_limit_s,ai_client.time_limit). svc-ai cancels the run and answers 504 with what it spent, so the spend is on the ledger. The task reads "It was still working when its time ran out (N minutes)" (ai_client.AIServiceTimeout), never "could not answer", and is not tried again.A call that failed in passing (svc-ai unreachable, or a 5xx:
tasks.transient) is made once more (engine.TRANSIENT_TRIES) while the run would still start it. A refusal, a block, a timeout or a request svc-ai rejected is not retried. Every failed task is logged with its id, its run, its kind and what was raised. svc-ai logs a run that fails for no reason it names (routers.agent._failed); before, it answered 500 and logged nothing.
A person's part
Approve the plan (
POST …/runs/{id}/approve): drop pieces, give a piece to another member of the same role (a part to another manager, a piece to another worker), change the budget (shares, and each team's budget, are recomputed). Or reject it: nothing more is spent. Only the lead's plan is approved; managers' plans run as they come.Answer a worker (
POST …/runs/{id}/tasks/{task}/respond): a worker may ask (ask_user, or its scope check) once per piece. Its piece pauses while the others go on; the answer, checked byhitl.validate_response, sends it round again with the answers in its brief. It is a fresh turn, not a resume of svc-ai's checkpoint, so it survives a restart.Stop (
POST …/runs/{id}/stop): wrap up and answer from what is done. A plan never approved ends with nothing more spent.Inbox: a plan to approve or a question (
swarm_attention), and the run finishing (swarm_finished).
Governance and cost
Every task is its agent's governed turn, through the path evaluations and dashboard tiles use (
evaluation.targets.AgentTarget): its own model, knowledge, tools and skill graph; its rules before and after (budgets, rate limits, the evaluation gate, redaction, withholding);execution_typeandpurposeswarm, so a rule or a budget can single swarms out. Memory is off for every task.Ledgered as it happens (
tasks._ledger_as_it_goes): each call in its own transaction, sourceswarm(the swarm, whichever agent did the piece) — orexperiment, for a run an evaluation started (see Measuring a swarm) — scope the agent, as the person who dispatched it. The workspace's budgets are asked before a run starts (budgets.gate.check). Pathswarminllm_paths.pyand cost monitoring.Every task has its own
invocation_id, minted before its call: its ledger rows, rule activity and svc-ai's traces share it.History: a swarm is versioned (
resource_versions, typeswarm); a run keeps the version and a copy of the configuration it ran. Swarms and runs are in the data export.Access: swarms are in the Agents & skills area; runs belong to the person who started them.
Durability
The rows are the truth: a finished task is committed before anything is decided from it. A coordinator writes a heartbeat each tick; the swarm_watchdog job (every minute) resumes a run silent for two minutes from its last finished task — a task cut off mid-call has what it spent ledgered from svc-ai's trace (tasks.ledger_interrupted, by its pre-minted id) and runs again, at most three times. It also cancels a plan not approved within a day (WAIT_TTL), and wraps up a run whose question nobody answered within a day (WrapUpReason.unanswered), its clock started again so the answer has the time the run had left.
Where it lives in fe-core
A Swarms tab on the Inference page, beside Skills (?section=swarms, apps/user/pages/swarms/SwarmsContent.tsx), offered only where the deployment has swarms on (it asks the catalogue first). It lists the workspace's swarms and the caller's runs, newest first — a run and its follow-ups one row (ThreadRow, from GET /app/swarms/threads).
A thread's row (
ThreadRow.tsx, the Swarms tab and a swarm's Runs): it reads as its first request, says how many requests it holds, and opens the latest — where the next follow-up goes — with the latest's status and the thread's total spend. Show N follow-ups opens every request below it, in order, each linking to its run. A run of one request reads as before.New and Edit (
NewSwarm.tsx,EditSwarm.tsx, oneSwarmForm): the shape, its settings and presets, who plays each part (a role of one agent is a radio; a template is a checkbox on its member; an ordered role is a list of rows, each an agent and its job, moved up or down —OrderedRolePicker) and what a run starts from — all drawn fromGET /app/swarms/topologies, svc-core's 422 shown by field. Approval is offered only for a shape that plans.A swarm's page (
SwarmViewer.tsx): Runs (where it opens) sends it on a task — the request, documents to attach (uploaded, or from the workspace's library;RequestForm, shared with the follow-up), budget, time cap and (for a shape that plans) approval starting from its defaults — and lists the caller's threads of it (GET /app/swarms/{id}/threads); Overview shows its shape, roster (an ordered role's members numbered, each with its job; any other member's note beside it), defaults and aResourceCostCard(sourceswarm); its edit history below.A run's page (
run/SwarmRunViewer.tsx,/inference/swarms/runs/<id>, where the inbox's notices land): a sentence on where it stands, the lead's plan to approve (PlanApproval: drop a piece, give it to another member, change the budget, or decline), money and time against their caps (MeterBars; a tick where the answer's reserve begins), the answer (with its PDF), the team's work as a tree (SwarmTree:FlowFrame+layeredLayout, a task's column one past the latest task it follows, ringed bySWARM_TASK_STATUS) and the same tasks as a list, set in by how deep their team sits, and the task opened from either (TaskPanel: its brief, output, spend against its share, the answer form when its agent asked, and "Why did it do this?"). Below the lead a plan reads "Team plan" and an answer "Report" (taskKindLabel); a routing and a vote have their own label and icon. Approval offers each piece only to members of its role. It polls while the run is open; Stop asks first.Rounds in order (30 October 2026, G2). The first live follow-up's tree drew a piece done again and two further rounds beside the first round, hung from the plan, as if they had run alongside it. Now:
The tree (
swarmDisplay.treeOf) places what a review asked for after that review: each task follows what it needs (solid), the piece it redoes (dotted) and the review that asked for it (dashed;askedBy, frombrief.asked_by, else — for a run from before — the first review that read the piece a redo redoes, or the review of the round before under the same plan). A legend under the frame names the lines it draws. Each node carries chips for its round past the first, the piece it redoes and how many tries it took (taskChips); the frame grows with its busiest column (h-80toh-[36rem]). A council's rounds already chain, so they get no dashed line.The list (
roundGroups) is grouped by round — "Round 2 · asked for by R1" — each in the order made, the answer (and a council's votes) last; one round is one list. A redo stays in its piece's round and reads "redo of T2"; a retried task "2 tries". A team's tasks take the round their plan was asked in (roundOf).The opened task (
TaskPanel) says where it came from — "Round 2", "Asked for by R1 …", "Redo of T2 …", each opening that task in place — "tried N times", and where its money came from and went: "$x of it from finished work" (topped_up_usd), "$y passed on to waiting work" (passed_on_usd).
A run in a thread (30 October 2026, F2):
the header says "Request 2 of 3" and steps to the previous and next request;
This thread (
run/ThreadPanel.tsx) lists every request in order, this one marked, each other one read in place — what it asked and what it answered, with its documents' downloads — or opened as its own page;the request opens the page (it had closed it), with the documents it was given, each opened from the library, those carried from an earlier request marked;
Follow up (
run/FollowUpForm.tsx) under the answer, only on the thread's latest finished request whose swarm still exists: the request, documents, budget and time from this run's, approval where the shape plans, and Keep the documents from earlier requests; refusals as svc-core writes them. An earlier request says where the thread went on instead; a running one offers nothing yet;a piece says what it builds on, each a link to the earlier piece (
swarmRunHref(run, task)opens a run's page on a piece,?task=T1), and the plan to approve says it too.
The decision record reads a swarm task (
DecisionEnum.Kind.swarm_task): its brief as the request, its output as the answer, its agent, model and role, its questions and answers, its rules, calls and cost; the record links back to the run.The answer as a PDF:
GET /app/swarms/runs/{id}/document.pdfrenders adocumentthe lead made, else the answer, from what the run stored, for a run that answered (completedorpartial); its footer names the swarm version and says when the answer is partial.
What the design rests on
The literature reviewed on 30 October 2026, and the rule each finding set. Figures marked † were read from abstracts or secondary summaries.
| Finding | Rule here |
|---|---|
| Anthropic, How we built our multi-agent research system (2025): lead + subagents beat a single agent by 90.2% on research; token use explains ~80% of the variance; ~15× the tokens of chat; effort scaled to the task; briefs need objective, output format, tools and boundaries; outputs passed by reference; resume rather than restart. | Budget shares; the full brief; pieces as attached documents; durable resume. |
| Cemri et al., Why Do Multi-Agent LLM Systems Fail? (MAST, NeurIPS 2025): 14 failure modes in specification, inter-agent misalignment and verification — design, not the model. | done_when on every brief; a shared ledger; a review step. |
| Magentic-One's task and progress ledgers. | The run's ledger; the lead's review is its progress check, asking for at most two more rounds of work. |
| Cognition, Don't Build Multi-Agents: share context; actions carry implicit decisions. | <swarm_context> gives every agent the plan and what is known, not only its piece. |
| Wang et al., Mixture-of-Agents (ICLR 2025); Li et al., Rethinking Mixture-of-Agents (Self-MoA, TMLR 2026): layered proposers and an aggregator gain, and one strong model sampled several times beats mixing in weaker ones. | The mixture of experts gates each question to its top-k experts rather than asking all, offers a second layer, and a Self-MoA preset (one expert sampled). |
| Choi et al., Debate or Vote (NeurIPS 2025): voting explains most of debate's gains; debate alone is a martingale. | The council votes by default; debate is opt-in, two rounds at most, and told agreeing is not the aim. |
| Zhang et al., Chain of Agents (NeurIPS 2024)†: agents reading a long input in turn, passing notes, then a manager answering from them, beat one agent reading it whole and retrieval. | The pipeline's chain-of-agents mode. |
| OrgAgent (arXiv 2604.01020)†: company-style hierarchy +102.7% with −74.5% tokens over flat; ORCH (arXiv 2609.11737)†: balanced spans of control coordinate better; TalkHier (arXiv 2502.11098): structured messages and an evaluation supervisor both matter. | Messages between levels are schemas; every team has a reviewing manager; hierarchy presets keep spans balanced, and uneven spans are warned of. |
| Qian et al., MacNet (ICLR 2025): quality grows logistically with agent count. | Caps on pieces, tasks and parallelism; small defaults. |
| Dochkina, Drop the Hierarchy and Roles (arXiv 2603.28990)†: strong models gain from choosing their own roles within a constrained protocol; weaker ones do better with fixed roles. | Roster agents keep their roles; templates are given specialisms by the lead. |
| AgentBalance (arXiv 2512.11426), BAMAS (AAAI 2026): pick each role's model first, then the topology. | A model tier per level: Fat-tailed puts workers on a lighter model; a hierarchy sets managers' and workers' models, and workers' effort. |
The orchestration loop is svc-core Python over relational rows, not one LangGraph graph: governance, live budget checks and the audit trail need each task as a row. Every agent in a swarm runs as its own LangGraph graph in svc-ai, and the engine mirrors LangGraph's multi-agent semantics — delegation as a structured call, fan-out as parallel tasks, a parent's review as a deferred join, approval and questions as interrupts. No new orchestration dependency (langgraph-supervisor was reportedly archived in September 2026).
Limits and what comes next
Five shapes:
supervisor(S0),hierarchy(S2),mixture_of_experts,councilandpipeline(S3), each measurable against single agents as an evaluation target (S4). Every preset's claim rests on the literature until someone runs that evaluation.An evaluated swarm's tool calls are not graded: a case's
must_use_toolschecks read the cell's tool calls, and a swarm's are its tasks', which the cell does not gather.Advice reads a person's own runs, since runs belong to whoever dispatched them: a teammate's runs of a shared swarm do not count.
Self-MoA's warning is not enforced: nothing reads which models a mixture's or council's agents run on, so a panel mixing strong and weak models is not flagged.
A council's and a pipeline's answers are not reviewed by a parent the way a plan's pieces are: a vote or the next stage is their check.
A chain of agents reads at most twelve parts, of documents cut to a million characters each when attached; its readers have no share of their own (how many there are is learnt as they read), only what the run has left.
Teams are as deep as three levels below the lead, eight wide a level, and 48 planned tasks at most.
Only the lead's plan is approved, and only the lead asks for more rounds: a manager's plan runs as it comes, and a team cannot ask for more work of its own.
A team sent back rewrites its report, from the pieces it has; it does not redo them.
Unspent money moves only within shapes of units: experts, councils and pipelines keep the shares they are given up front, and a pipeline's later stage does not grow when an earlier one spends less.
A call keeps the lease it started with: money a sibling leaves while it runs reaches the work still waiting, not a call already under way.
The review's gate prices one small piece: a larger piece it then asks for may still stop at its share. The member and span limits reach the review through its schema and prompt; the round itself keeps the shape's own span.
A task's record is its latest attempt's: a piece run again (after a restart, or with a person's answer) takes a new
invocation_id, and the earlier attempt's rows are found by that id only, not from the task.Roster agents must be the swarm's own workspace's (or CHAINR Bot), as a dashboard tile's; an inherited agent is refused.
A worker's approval gate (a skill graph's) fails its piece: nobody can approve inside a swarm.
Concurrent leases keep a run's own tasks within its budget; other work in the workspace still sees the whole of what a budget has left (Known gap 20).
Follow-ups go to the latest request only: a thread is a line, never a tree, and an earlier request cannot be followed up again to try another way.
A follow-up's pieces read the previous request's pieces only: a piece of an older request reaches it through that request's answer, not whole.
A source a piece cited is carried, never re-read: a follow-up that relies on it cites what the earlier piece said of it; to rely on it directly an agent fetches it again.
Not verified live, follow-ups included: the scenario sample's follow-up is the measure (
cites_carried,min_builds_on).