Build with SwarmBuild guide

An agentic workflow, built and run: coder, reviewer, send it back

An agentic workflow is a set of steps where AI agents act on each other's work without you in the loop: one agent does the job, another checks it, and the result decides what happens next. In Swarm it is one call: when a coder task ends in a folder, a reviewer reads the change against its brief, and a BLOCK verdict sends the findings back to the same coder, with a limit on rounds. We ran it on two changes; each review took 35 to 61 seconds.

What an agentic workflow looks like

A chat with one AI is a loop you drive: you ask, read, correct, ask again. An agentic workflow moves the checking into the system. The steps are decided up front; the agents run them.

  1. Work: a coding agent makes the change on its own branch.
  2. Review: a second agent reads the change against the original brief and gives a verdict, OK or BLOCK, with findings.
  3. Decide: OK goes on to you (or to a merge or deploy step). BLOCK sends the findings back to the same agent, in the same session, to fix its own work.
  4. Stop: after a set number of rounds the work ends as blocked instead of looping forever.

Build it

You need Swarm on a Linux machine with a model connected and a project for your code; the first guide covers that in a few minutes. Then say what you want:

Say this to your AI

After every coder task in this folder, have a reviewer check it and send it back if it is not right. Two rounds at most.

  • swarm_set_workflow

Your AI saves this workflow. It is plain JSON, kept with its history, and you can read or change it any time:

swarm_set_workflow
{
  "name": "review-coder-work",
  "project": "tally",
  "scope": { "role": "coder", "folder": "/srv/tally" },
  "when": "succeeded",
  "steps": [
    { "id": "review", "type": "agent", "worker": "reviewer",
      "brief": "Check the change against its brief: does it do exactly what was asked, does test.sh cover it, and is anything risky or out of scope? Give an OK or BLOCK verdict with concrete findings." },
    { "id": "send-back", "type": "reopen", "from": "review",
      "if": [{ "step": "review", "verdict": "block" }],
      "max_rounds": 2,
      "message": "The reviewer found problems. Fix them on the same branch:" }
  ]
}

Run it

Now any coder task in that folder goes through the workflow. We gave the coder a small fix in a bash tool called tally:

Say this to your AI

Fix the FIXME in tally.sh: print the total line only when more than one file is given. Add a check for it in test.sh.

  • swarm_run_task

The coder worked on its own branch, ran the tests and committed: 35 model turns, $0.14 on Gemini 3.8 Flash. Its change:

tally.sh
-# FIXME: the total line is printed even for a single file
-printf '%-30s %8d %8d %8d\n' "total" "$total_l" "$total_w" "$total_c"
+if [ $# -gt 1 ]; then
+  printf '%-30s %8d %8d %8d\n' "total" "$total_l" "$total_w" "$total_c"
+fi

The workflow started the reviewer (Gemini 4 Argon) the moment the task ended. Its verdict came back 35 seconds later, quoted as written:

text
VERDICT: OK
SUMMARY: The commit accurately resolves the FIXME in tally.sh by guarding the "total" output line
with if [ $# -gt 1 ]; then ... fi. test.sh covers both the single-file case (asserting no total line
is printed) and the multi-file case (asserting the total line is printed). [...] Non-blocking note:
in test.sh:9, anchoring the single-file pattern as ^total would avoid a theoretical false positive.
FINDINGS: None

Because the verdict was OK, the send-back step was skipped, and the run record says why: condition not met: step review verdict is ok, not block. A BLOCK would have sent the findings into the coder's own session and started a second round.

Every run is on the record

swarm_list_workflows shows each workflow with its latest runs: which job it followed, each step's state and outcome, the reviewer's report and verdict, and when it started and finished. Ask "what did the reviewer say about the last change?" and your AI reads it from there.

Other steps you can add

  • deliver: merge the work into the folder's branch, open a pull request, or save the result to a directory.
  • run: your own script on the machine, for example to deploy or to post an alert. Only the machine's owner can add one.
  • agent: any agent on the result: a finder to write a summary, a designer to check a page, or one of your own workers.
  • if: run a step only when an earlier one succeeded, failed, or got a given verdict.

Questions

What is an agentic workflow?

A fixed set of steps in which AI agents act on each other's work: one does the job, another checks it, and the outcome decides the next step, such as sending it back, merging it or deploying it.

What does an agentic workflow look like in practice?

In this guide: a coder fixes a bug on its own branch, a reviewer checks the change against the brief and returns OK or BLOCK, and a BLOCK sends the findings back to the coder for at most two more rounds.

How long does the review step take?

In our run, 35 and 61 seconds for two small changes, with Gemini 4 Argon as the reviewer. It depends on the model and the size of the change.

Can the workflow merge or deploy by itself?

Yes, if you add those steps: a deliver step merges or opens a pull request, and a run step calls your own script. Without them the work stops at its branch for you to merge.

Does this need code?

No. You describe the workflow to your AI and it saves it with swarm_set_workflow. The workflow is JSON you can read, change and restore to an earlier version.

Updated 28 October 2026