Agent Context Management
An agent can have access to far more information than should fit into one model request. Context management selects what matters now.
Separate stable and dynamic context
Stable instructions, tool definitions, recent conversation, retrieved documents, and tool results have different lifecycles. Keep them logically separate so each can be compressed or cached appropriately.
Summarize old history
Preserve decisions, commitments, IDs, and unresolved tasks rather than every token of old conversation.
Trim tool output
Do not feed megabytes of API payload back to the model. Return structured summaries plus identifiers for follow-up retrieval.
Context quality matters more than context volume.