AI engineering glossary · Agents tools MCP

What is context compaction?

Context compaction: Shrinking an agent's working context, by summarising or dropping older steps and tool outputs, so a long task can continue without exceeding the context window. Done poorly it removes facts the agent still needs.

Level: advancedTopic: Agents tools MCP

Context compaction: an example

When the transcript nears the limit, the agent replaces raw tool logs with a 300-word summary and keeps the last five turns.

Related terms

More Agents tools MCP terms

Where you learn it

Context compaction is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.