Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
A single agent has one context window you manage. A multi-agent system has many windows, and the hard part becomes what each agent sees, what it shares, and what it must never see. Naively giving every agent the full shared history reproduces the single-agent context-bloat problem N times over and leaks information across roles. The discipline shifts from 'manage one window' to 'design an information architecture across agents' — who knows what, when, and why. Getting this wrong causes both runaway cost and subtle correctness bugs where one agent acts on another's half-finished reasoning.
The demo models two agents with deliberately scoped contexts: a researcher that sees raw sources, and a writer that sees only the researcher's distilled findings — not the raw dump. Scoping context per role is the foundational multi-agent move.
# Each agent gets a CONTEXT SCOPE, not the whole shared state.
researcher_ctx = {"role": "researcher", "can_see": ["raw_sources", "task"]}
writer_ctx = {"role": "writer", "can_see": ["findings", "task"]} # NOT raw_sources
shared = {"task": "Summarize the Q2 risks.",
"raw_sources": ["...50k tokens of documents..."],
"findings": None}
def researcher(shared):
# sees raw_sources, produces compact findings
shared["findings"] = "Top risks: supply delay, FX exposure, churn uptick."
return shared
def writer(shared):
# sees ONLY findings + task — never the 50k-token raw dump
return f"Report on '{shared['task']}': {shared['findings']}"
print(writer(researcher(shared)))python3 main.py