Anatomy of context
What an agent sees is not one thing. It splits into five types of context, and knowing which type a piece belongs to tells you how to manage it: whether to write it once, fetch it, truncate it or look it up.
| Type | What it is | Examples | Lives |
|---|---|---|---|
| 1 Static | Fixed system prompts | Persona, rules, tool schemas | Written once, same on every call |
| 2 Dynamic | The trigger context | User query, API response, sensor reading | This turn |
| 3 Episodic | Short-term memory | History of the current interaction, the last 10 messages (managed) | This conversation |
| 4 Retrieved | Knowledge fetched just in time from outside | RAG documents, API calls, web search | Fetched per step |
| 5 Stateful | Long-term memory from a permanent external source | What is known about the user and their state | Across conversations |
Which ones grow
Static is the only type you write by hand; the rest are gathered at run time by the context assemblerThe context assemblerThe step that builds the prompt from scratch on every loop.Opens in a new tab. Episodic grows with every turn, and retrieved and dynamic content can be large, so those are where overflow managementContext overflowWhen the history outgrows the window: cut the oldest, or summarize them.Opens in a new tab, compressionContext compressionShrink what goes in, using a smaller model whose only job is to summarize.Opens in a new tab and rerankingContext rerankingModels read the middle of a long context worst, so put what matters at the edges.Opens in a new tab earn their keep. Stateful is where long-term memory enters the window, and it is the raw material of personalizationThe dynamic expert agentPersonalize with what the agent knows about the user, then assemble the right expert for the question.Opens in a new tab.
Two kinds of episodic
The word is used twice in this set. Here, episodic context is only the recent conversation: what is in the window right now. In agent memoryAgent memoryWhat an agent remembers: the thread it is in, and what it keeps across threads.Opens in a new tab, episodic is a kind of long-term memory, past events kept between conversations.
Sources
- Effective context engineering for AI agents, Anthropic Engineering · accessed October 5, 2026
- Memory overview, LangChain Docs · accessed October 5, 2026