Skip to main content
A professor uploads N student papers. Each paper gets its own swrm: three specialist agents run concurrently (editor, AI detector, grader), and a synthesis step folds their verdicts into a single grade report. The factory collects all N reports; a gradebook compiler assembles the final markdown table. This is the swrm factory pattern — every for_each item spawns a complete mini-swrm, not just a single agent.

What it demonstrates

  • FactoryNode.swrm — each item in for_each spawns a full swrm instead of a single agent
  • {{ item }} / {{ index }} / {{ total }} inside swrm agent prompts and the synthesis prompt
  • Per-item synthesis: each paper gets its own grade report before results are collected
  • on_failure: continue — a single bad paper does not abort the rest of the batch
  • concurrency: 3 — at most 3 papers graded simultaneously, each paper’s 3 agents run fully in parallel

Run it

Workflow

docs/cookbook/grading-factory/workflow.yaml

Graph

How the swrm factory works

For a batch of 3 papers, the executor runs:
Up to concurrency: 3 papers run simultaneously. Within each paper, all three swrm agents run fully in parallel. The synthesis step fires once all three agents for that paper have finished. The factory’s writes path receives the collected list of per-paper grade reports.

Next steps

1000 Monkeys

Pure swrm fan-out: the same prompt sent to N agents simultaneously.

GitHub Issues Triage

Classic factory with a single agent per item.

Factory Reference

Full FactoryNode YAML reference including swrm mode.

Swrm Reference

Full swrm node documentation.