Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Multi-agent context sits on a spectrum from fully shared (every agent reads/writes one blackboard) to fully isolated (agents communicate only through explicit messages). Shared context maximizes coordination but blows up budget and couples agents; isolated context keeps each agent lean and decoupled but risks duplicated work and lost coordination. Most real systems are in between, and choosing where on the spectrum each piece of state lives — global, group, or private — is the core design decision. Defaulting to 'share everything' is the most common and most expensive mistake.
The demo implements a tiered context store: global (all agents), group (a subteam), and private (one agent). Each agent assembles its window from the tiers it's entitled to, so coordination happens only where needed.
Use these three in order. Each builds on the one before.
What's the spectrum from fully-shared to fully-isolated context in multi-agent systems, and what does each extreme cost me?
Explain a tiered context model (global/group/private) and how each agent assembles its window from the tiers it's entitled to.
Design the context-sharing tiers for a multi-agent customer-support system (triage, specialist, QA) where some data is tenant-private and some is team-wide. How do I prevent leakage and minimize duplicated context cost?
class TieredContext:
def __init__(self):
self.global_ = {} # visible to all agents
self.group = {} # visible to a named subteam
self.private = {} # visible to one agent
def view_for(self, agent, group):
return {**self.global_, **self.group.get(group, {}), **self.private.get(agent, {})}
ctx = TieredContext()
ctx.global_["goal"] = "Ship the report"
ctx.group["research"] = {"sources": "..."}
ctx.private["writer-1"] = {"draft": "v1"}
print(ctx.view_for("writer-1", group="research").keys()) # goal + sources + draft
print(ctx.view_for("planner", group="ops").keys()) # only goal (no research/private)python3 main.py