7 Context management and orchestration
This chapter covers
- Core techniques for context management: selection, writing, compression, and isolation.
- Orchestration as the layer that coordinates context across steps, tools, agents, and interfaces.
- Common patterns for multi-agent collaboration.
- Protocols for agentic interoperability.
Previous chapters described six fundamental context sources that shape LLM behavior: instructions, external knowledge, tools, memory, state, and user prompts. These components provide the raw material for LLM-based systems, but their effectiveness depends on how they are managed during execution. This chapter develops context management, the discipline of selecting, writing, compressing, and isolating context. Context management treats the context window as a scarce execution surface: tokens consume money, long prompts add latency, and excessive material competes for the model’s attention. The chapter then turns to context orchestration, the runtime layer that uses context to coordinate agentic execution and interoperability. The chapter closes by examining multi-agent coordination patterns and protocols for exchanging context across agents, user interfaces, editors, and external components.