Customize your agent memory
Letta agents have programmable in-context memory. This means a section of the context window is reserved for editable memory: context that can be edited by memory editing tools. Like standard system prompts, the memory also can be used to define the behavior of the agent and store personalization data. The key distinction is that this data can be modified over time.
Memory
The in-context (i.e. core) memory of agents is represented by a Memory
object. This object contains:
- A set of
Block
objects representing a segment of memory, with an associated character limit and label - A set of memory editing tools
Agent Core Memory
The core memory of an agent is a set of blocks, with an associated character limit, label, and value. The value is stored in the agent’s context window, so that information is always provided to the LLM.
Blocks
Blocks are the basic unit of core memory. A set of blocks makes up the core memory. Each block has:
- A
limit
, corresponding to the character limit of the block (i.e. how many characters in the context window can be used up by this block) - A
value
, corresponding to the data represented in the context window for this block - A
label
, corresponding to the type of data represented in the block (e.g.human
,persona
)
Creating agents with memory
Shared Memory
You can create blocks independently of agents. This allows for multiple agents to be attached to a block. This allows of synchronized context windows accross agents, enabling shared memory.