Build with SwarmBuild guide

Multi-agent orchestration: several agents, one goal, a real run

Multi-agent orchestration means splitting one goal across several AI agents and coordinating what comes back. With Swarm, the AI you already use (Claude Code, Codex or ChatGPT) is the orchestrator: it starts a research agent and a coding agent at the same time, each on its own branch, waits for both, has a reviewer check the code, and merges what passes. In our run the research cost $0.03, the code $0.21, and the review passed in about a minute.

Who orchestrates

Frameworks make you write the orchestrator in code. With Swarm, the orchestrator is the AI you are already talking to. It reads the goal, decides the parts, and calls Swarm's tools to run them. Swarm does the rest: every agent runs on your machine, on its own branch, with its own record of what it did and cost.

PartWho does itSwarm tool
Split the goalYour AI(its own reasoning)
ResearchSwarm's finderswarm_run_task with role finder
CodeSwarm's coder, on its own branchswarm_run_task with role coder
CheckA reviewer, started by a workflowswarm_set_workflow
Wait and readYour AIswarm_wait_task, swarm_task_result
MergeYour AI, when you say soswarm_integrate_task

The goal we gave it

Say this to your AI

Add a --csv flag to tally.sh, document it, and before settling the name check how other command-line tools name a CSV option. Run the research and the code at the same time.

  • swarm_run_task × 2
  • swarm_wait_task
  • swarm_task_result

Two tasks started in the same second:

JSON
// finder: reads and reports, changes nothing
{ "role": "finder", "title": "How CLIs name CSV output",
  "brief": "How do common command-line tools name an option that prints CSV (for example cloc, psql, sqlite3, kubectl, gh)? Recommend one name for tally.sh and say why in three sentences. Change nothing." }

// coder: works on its own branch
{ "role": "coder", "title": "CSV output",
  "brief": "Add a --csv flag to tally.sh that prints the same rows as comma-separated values with a header line file,lines,words,chars. Document it in README.md with an example. Add checks to test.sh." }

What came back

AgentResultCost
FinderSurveyed five tools and recommended --csv, "a simple boolean flag", over a --format=csv selector for a small single-purpose tool$0.026 (10,994 tokens)
CoderAdded --csv with a header row, documented it with an example, added checks to test.sh; tests pass. One commit on agent/add-csv-flag-…$0.21 (37,358 tokens, 43 turns)
ReviewerStarted by the folder's workflow when the coder finished: VERDICT: OK, 61 seconds laterpart of the run

The finder and the coder agreed on the name independently, which is the check you want from parallel research: if they had not, your AI would have sent the coder a correction before merging.

When branches collide

Parallel agents can touch the same lines. In our run another coder had already changed how the total line prints, and that change was merged first. When we asked Swarm to merge the CSV branch, it refused before touching the folder and named the file:

text
Swarm rejected the request (HTTP 400): prepare integration failed: ...
CONFLICT (content): Merge conflict in tally.sh

Your folder stays as it was. The fix is to send the coder a message in the same session ("main moved; rebase onto it and keep both behaviors") with swarm_send_message; it updates its own branch, and the review runs again before anything is merged. Keeping parallel tasks on separate files avoids most of this.

Rules that keep orchestration sane

  • Split by files, not by steps. Parts that edit different files merge cleanly; parts that wait on each other gain nothing from running in parallel.
  • Research changes nothing. A finder only reads and reports, so it can always run alongside the coders.
  • Review before merge. One workflow puts every coder task in the folder through a reviewer, with a cap on send-back rounds.
  • Watch the bill. Every task reports tokens and cost; swarm_set_limits caps concurrent jobs and daily spend.

Questions

What is multi-agent orchestration?

Splitting one goal across several AI agents, running them (often in parallel), checking what they return and combining it into one result.

Do I need a framework like LangGraph or CrewAI?

Not with Swarm. The AI you already use orchestrates by calling Swarm's tools; Swarm runs the agents on your machine, each on its own branch. Frameworks are the better fit when you want to build the orchestration into your own Python code.

How many agents can run at once?

As many as your limits allow: swarm_set_limits caps concurrent jobs and spending. The practical limit is your machine and your model plan.

What happens when two agents change the same file?

Each works on its own branch, so nothing collides while they work. If two branches conflict, Swarm refuses the second merge and names the file; you send that agent a message to update its branch.

What did this run cost?

The research agent $0.026 and the coding agent $0.21, on Gemini 3.8 Flash, plus the reviewer step on Gemini 4 Argon.

Updated 28 October 2026