Skip to content

scatter

scatter is a three-phase map-reduce pattern: the map phase decides what to process in parallel, workers handle each item concurrently, and the reduce step synthesizes the results.

  • Research across multiple sources or angles simultaneously
  • Batch processing where item count is determined at runtime
  • Tasks that can be decomposed into independent parallel subtasks
---
name: deep-research
description: Researches a topic from multiple angles in parallel.
version: "1.0.0"
pattern: scatter
worker: research-angle
call:
model:
role: thinker
uses:
- search-web
---
You are a research coordinator. Given a topic:
1. Identify 3-5 distinct research angles (e.g., technical, economic, historical, social)
2. Call finish with key="parallel" and value as a JSON array of strings, one per angle
Example:
finish(key="parallel", value='["technical feasibility", "economic impact", "regulatory landscape"]')
---
call:
model:
role: thinker
---
You have received research from multiple parallel workers covering different angles.
Synthesize all findings into a comprehensive, well-structured report.
Integrate the perspectives, resolve any contradictions, and present unified conclusions.
Call finish with key="done" and the full synthesized report.
  • reduce.md — system prompt for the reduce step
Terminal window
tama add scatter my-agent
Phase 1 — Map (react atom, AGENT.md body):
start() → topic
agent reasons about what to fan out
finish(key="parallel", value='["angle-1", "angle-2", "angle-3"]')
Phase 2 — Parallel workers:
worker agent runs 3 times, each with a different angle as input
all workers run concurrently
Phase 3 — Reduce (react atom, reduce.md):
start() → JSON map of { "angle-1": "...", "angle-2": "...", ... }
synthesize results
finish(key="done", value=<synthesis>)

The map phase controls whether fan-out happens:

  • finish(key="parallel", value='[...]') → fan out, spawn one worker per item
  • finish(key=anything_else, value=...)skip fan-out, return the value directly

This lets the map agent decide dynamically: if the input doesn’t need parallel processing, it can return a direct answer.

The worker: field names the agent used for each parallel item. It’s a full agent — any pattern, any skills:

# agents/research-angle/AGENT.md
---
name: research-angle
description: Researches a single angle of a topic.
version: "1.0.0"
pattern: react
call:
model:
role: thinker
uses:
- search-web
---
Research the assigned angle thoroughly. Use search-web to find relevant sources.
Provide a comprehensive summary with key findings and sources.
Call finish with key="done" and your research summary.
agents/
deep-research/
AGENT.md ← pattern: scatter, worker: research-angle
reduce.md ← synthesis prompt
research-angle/
AGENT.md ← pattern: react, uses: [search-web]