Context Hierarchy
How to manage different types of information for Letta agents
Letta offers multiple abstractions for how to contextualize agents with additional external context and long-term memory:
- You can create a memory block that persists information in-context
- You can create a file which the agent can read segments of and search
- You can write to archival memory for the agent to later query via built-in tools
- You can use an external DB (e.g. vector DB, RAG DB) to store data, and make the data accessible to your agent via tool calling (e.g. MCP)
In general, which abstraction to use depends on the scale of data and how important it is for the agent. For smaller amounts of data, it is best to simply place everything into the context window with memory blocks. For larger amounts of data, you may need to store data externally and retrieve it.
See the feature sets and recommended size limit (per block/files/archival memory) and count limits (total blocks/files/archival memories) below:
Examples
Below are examples of when to use which abstraction type: