MultiAgentContextManager gives each agent isolated context with controlled sharing on handoffs.
The user hands off from a researcher agent to a writer; shared context policies control what crosses the boundary.
How It Works
Quick Start
Architecture
Context Policy
Share Modes
| Mode | Description | Use Case |
|---|---|---|
NONE | No context shared | Independent agents |
SUMMARY | Summarized context | Reduce token usage |
FULL | Full context (bounded) | Continuity needed |
Tool Share Modes
| Mode | Description |
|---|---|
NONE | No tools shared |
SAFE | Only safe tools shared |
FULL | All tools shared |
Policy Configuration
Handoff Preparation
Per-Agent Isolation
Each agent has isolated:- Token budget
- Conversation history
- Optimization state
- Monitoring output
Preventing Context Blow-up
Default policies prevent multiplicative context growth:Integration with Workflow
CLI Usage
Best Practices
Default to isolation
Default to isolation
Keep
share=False until a handoff genuinely needs prior context — unbounded sharing multiplies tokens.Prefer SUMMARY over FULL
Prefer SUMMARY over FULL
ContextShareMode.SUMMARY keeps continuity without copying entire histories into every agent.Always set max_tokens
Always set max_tokens
Hard-cap shared context so downstream agents cannot inherit runaway message lists.
Preserve recent turns selectively
Preserve recent turns selectively
Use
preserve_recent_turns=3 for continuity while still compressing older turns.Related
Handoffs
Delegate tasks between agents with tool and context policies.
Context Manager
Single-agent budgeting and compaction facade.
Multi-Agent Pipelines
Sequential and parallel orchestration patterns.
Workflows
Route, parallel, and loop patterns for agent teams.

