This is the tutorial where Springtale's cooperation framework earns its keep. You'll build a 3-agent formation:
- Researcher — pulls source material via the Presearch connector.
- Writer — composes a writeup from the research.
- Critic — reads the writeup and posts a critique back to the blackboard.
The three agents share a blackboard. The writer reads what the researcher posted. The critic reads what the writer produced. They all run on the same formation tick, coordinated by cadence, escalating through momentum tiers as they build coherence.
Time: ~60 minutes. This is genuinely a different shape from the first two tutorials.
You'll need:
- Springtale installed.
- An AI adapter wired. Cheapest path: install
Ollama, pull a small model (
llama3.1:8b), and point Springtale at it. Production path: Anthropic / OpenAI API key. - A Presearch API key (free tier OK — research load is light).
Local-first option (Ollama):
# Install Ollama, pull a model:
ollama pull llama3.1:8b
# Tell Springtale to use it:
cat >> springtale.toml <<'EOF'
[ai_ollama]
base_url = "http://127.0.0.1:11434"
model = "llama3.1:8b"
EOFOr API option (Anthropic):
springtale-cli vault set anthropic.api_key
cat >> springtale.toml <<'EOF'
[ai_anthropic]
model = "claude-sonnet-4-6"
EOFEither way, restart springtaled so it picks up the new config.
Verify:
springtale-cli connector list # not relevant
springtale-cli ai status # shows which adapter is loadedspringtale-cli vault set presearch.api_keyAPI key from presearch.com.
Verify:
springtale-cli connector list | grep presearchShould show connector-presearch as Active.
Use the LLM swarm template:
springtale-cli new llm-swarm
# Creating llm-swarm project in ~/.local/share/springtale/projects/llm-swarm-20260610-091500
cd ~/.local/share/springtale/projects/llm-swarm-*/You now have a working starter. Look at what shipped:
cat springtale.toml
ls rules/The template sets up three agents (researcher, writer, critic) but points them at a placeholder topic. We'll wire it to take real research requests next.
springtale-cli formation deploy-team --from rules/research-swarm.tomlBehind the scenes this:
- Creates a
Formationwith intent"research this topic". - Adds three agents as members, each tied to the configured AI adapter.
- Marks the formation
activeso the cadence bus starts ticking it.
Inspect:
springtale-cli formation list
springtale-cli formation get research-swarmThe formation starts at Cold momentum — its members can read the
shared environment but not yet write to it. As they successfully
cooperate, momentum will climb. See
docs/guide/cooperation.md §3 for the
full momentum mechanic.
The template ships with an HTTP endpoint that accepts research requests and posts them to the formation's blackboard:
curl -X POST http://127.0.0.1:8080/formations/research-swarm/inputs \
-H "Authorization: Bearer $(springtale-cli auth print)" \
-H "Content-Type: application/json" \
-d '{
"topic": "how Wasmtime epoch deadlines work",
"constraints": ["cite official docs", "max 500 words"]
}'What happens in the next ~30 seconds:
- Tick N: The researcher agent (via the
scanstep of its per-agent loop) sees the newtask:researchkey on the blackboard. It claims it (consensus + commit barrier hold while it works). - Tick N+1 through N+3: Researcher calls
connector-presearchto search the topic + scrape top results. Posts findings astask:research:completeon the blackboard. - Tick N+4: The writer's
scanstep finds the research output, composes a writeup using the AI adapter, posts astask:writeup:complete. - Tick N+5: The critic's
scanstep finds the writeup, runs it through the AI adapter with a critique prompt, posts critique astask:critique:complete.
Between each step, the formation's momentum tier may advance:
- Warming after 3 successful ticks — the blackboard becomes writable; agents can post intermediate state.
- Hot after 8 — consensus voting unlocks (the critic can veto a writeup before it gets published).
- Fever after 15 — the orchestrator unlocks; AI-driven intent decomposition becomes available for multi-step research.
In another terminal:
springtale-cli trace --formation research-swarmYou'll see real-time output of each agent's 5-step loop (sense, scan, react, respond_cfp, inbox) and the 14-step formation tick.
The colony canvas at http://127.0.0.1:8080/dashboard shows the
formation as a dashed zone with three members. Click the zone to see
detail: momentum, rally tokens, attention load distribution.
The critique-complete event is the signal that work is done:
curl -X GET "http://127.0.0.1:8080/formations/research-swarm/results" \
-H "Authorization: Bearer $(springtale-cli auth print)" | jq .You'll get the research, the writeup, and the critique as three fields. The writeup is what you'd publish; the critique is what to review before publishing.
Try an unanswerable topic on purpose:
curl -X POST http://127.0.0.1:8080/formations/research-swarm/inputs \
-H "Authorization: Bearer $(springtale-cli auth print)" \
-H "Content-Type: application/json" \
-d '{"topic": "the secret URL of the moon"}'The researcher will fail (no useful search results). Watch what happens:
- Researcher reports failure.
- Tick processor logs interference.
- Supervisor's per-member check fires.
- Cascade detector decides: is this a single failure or a pattern?
- Single failure → rally. A rally token is burned. Attention redirects toward the failing agent. Next tick tries again.
- After 3 rally token burns with no success, the formation escalates to the orchestrator (if at Fever tier) or dissolves (if not).
You'll see this in trace output. See
docs/guide/cooperation.md §4 for the
rally + recovery + supervision model.
springtale-cli formation dissolve research-swarmWhat happens:
- All three agents stop accepting new work.
- One final tick runs to persist the formation's mental model to
the
mental_model_*SQLite tables. - The formation row is marked
dissolved.
The mental model survives. If you re-deploy a formation with the
same formation_id, it warm-starts from what the previous instance
learned (vocabulary, successful patterns, observed conventions). See
docs/guide/mental-model.md.
| Concept | Where it appeared |
|---|---|
| AI adapter wiring | Step 1 |
| Formation deployment from template | Step 4 |
| Blackboard as the coordination medium | Step 5 — task:* keys |
| Per-agent 5-step loop | Step 6 — trace output |
| 14-step formation tick | Step 6 — trace output |
| Momentum tier progression | Step 5 — Cold → Warming → Hot → Fever |
| Rally / recovery / supervision | Step 8 — failure path |
| Mental model persistence across dissolves | Step 9 |
| Add | See |
|---|---|
| Cross-formation gossip (two swarms watching each other) | guide/cross-formation.md |
| Custom roles (translator, code-reviewer, etc.) | guide/cooperation.md §11 |
| Pacing (don't burn API tokens at full speed) | guide/pacing.md |
| Intervention (orchestrator changes intent mid-run) | guide/intervention.md |
| Tool calling (researcher invokes other connectors via AI) | cookbook: LLM with tools |
| Consensus voting (critic vetoes bad writeups) | guide/consensus.md |
- The researcher has
NetworkOutboundcapability for Presearch's domain. It can't reach arbitrary hosts. Capabilities are per-connector, declared in manifest, enforced at dispatch. - AI adapter calls bypass capability for prompt content but tool calls go through the same capability gate. An LLM asking the researcher to "delete all rules" hits the sentinel before it hits the rule engine.
- Mental model contents are sensitive. If your formation
processes data the formation users would not want stored, set the
formation's
[cooperation] persist_mental_model = falseto keep it ephemeral.
springtale-cli formation dissolve research-swarm
springtale-cli rule delete --formation research-swarm
springtale-cli connector remove connector-presearch
# AI adapter stays — useful for other formations