Everything *[NYC] 2026: see what we announced. →
Skip to content

Agent context compression definition

Agent context compression is the practice of shrinking the history, tool output, and retrieved material an AI agent carries in its context window, so the agent stays within the model's token limit and costs less to run, while keeping the information it needs to finish the task.


A diagram explaining Agent context compression in terms of related concepts.

Why do AI agents need context compression?

What are the main methods of agent context compression?

How does context compression work during a long agent run?

What are the tradeoffs of agent context compression?

How does structured content reduce the need for context compression?

Discover More with Sanity

Now that you've learned about agent context compression, why not start exploring what Sanity has to offer? Dive into our platform and see how it can support your content needs.

Last updated: