Skip to main content
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

1

Create the manager

2

Set a handoff policy

3

Prepare handoff context

Architecture

Context Policy

Share Modes

Tool Share Modes

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

Keep share=False until a handoff genuinely needs prior context — unbounded sharing multiplies tokens.
ContextShareMode.SUMMARY keeps continuity without copying entire histories into every agent.
Hard-cap shared context so downstream agents cannot inherit runaway message lists.
Use preserve_recent_turns=3 for continuity while still compressing older turns.

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.