Memory
In one sentence
Memory is what lets your agent remember things — like a good assistant who knows your name, recalls what you discussed last week, and doesn’t ask you the same question twice. By default, an AI model forgets everything the moment a conversation ends. Memory fixes that.The 30-second version: Add a
memory block to your agent, point it at a database, and your agent now remembers users across conversations — automatically. No extra code. Everything else on this page is optional fine-tuning.Why it matters
Think about the difference between two customer-service experiences:- Without memory: “Hi, can I get your name? And your order number? And what was the issue again?” — every single time, even if you called yesterday.
- With memory: “Hi Akash — is this about the delayed order ORD-7421 we discussed yesterday? I see it shipped this morning.”
The mental model
Think of memory as a smart filing cabinet that sits behind your agent:- Every conversation, the agent opens the relevant drawers before answering (“what do I know about this person?”).
- After the conversation, it files away anything new it learned (“they mentioned they prefer email”).
- The cabinet has separate drawers for separate things — one for chat history, one for facts about the person, one for company knowledge, and so on.
- Each person’s drawers are private — your data never shows up in someone else’s folder.
storage backend.
Quick Start
storage, you get:
- Session persistence — message history saved across runs
- Summaries — overflow messages automatically summarized
Full Configuration
Architecture
Memory is a layered subsystem, not a single store. One orchestrator (MemoryManager) coordinates up to nine specialized stores, each owning its own schema, extraction prompt, and scope rules, all sitting on a shared StorageDriver.
The nine “drawers” (stores)
Each store is one drawer in the filing cabinet. You turn on the ones you need.
You don’t need all of them. Most agents use Sessions + Summaries (on by default) plus User Facts. Turn on the rest only when your use case calls for it — the table later in this page tells you when.
How It Works
Every time your agent answers, two things happen automatically — like an assistant glancing at their notes before speaking, then jotting down anything new afterward:- Before answering → the agent reads its memory and brings the relevant bits into the conversation.
- After answering → the agent quietly files away anything new it learned.
1. Before the answer: gather what we know (buildContext())
MemoryManager.buildContext() gathers relevant data from all enabled stores and creates a context string injected into the system prompt:
2. After the answer: remember what’s new (afterRun())
The user already has their answer — so this step runs in the background and never slows down the response. It quietly re-reads the conversation (using a cheaper model to keep costs low) and files away anything worth remembering:
- New user facts and profile updates
- Entity mentions (companies, people, projects)
- Decision records
- Learnings worth remembering
3. Keeping it from getting too big (session overflow)
A conversation can’t grow forever — that would blow past the model’s limits and cost. So when a chat gets long (pastmaxMessages), the oldest messages are summarized into a short recap and then removed. The agent keeps the gist without carrying every word. Think of it as turning ten pages of notes into a single sticky note.
Works Everywhere
The samememory config works across all agent types:
Simplified API
For quick operations without dealing with individual stores, use the high-levelremember, recall, and forget methods:
Default Feature States
Accessing Stores Directly
You can access individual stores via theMemoryManager:
Inspecting Memory Context
You can callbuildContext() directly to see what the model receives:
Multi-User Isolation
The short version: one user’s memory never leaks into another user’s conversation. Akash’s data stays in Akash’s drawers. This is enforced automatically — you don’t have to do anything to get it. This matters because the moment you have more than one user (every real product), a memory system that mixes people’s data is a privacy incident waiting to happen. Agentium treats memory as a security boundary, not just a feature. Every memory store is scoped to the calling user by default. Two tenants whose users happen to share auserId collision still cannot see each other’s
data, because every read and write includes the relevant scope key.
Learnings and Procedures support an explicit scope hierarchy so that
genuinely shared knowledge — like “invoice reconciliation workflow” or
“refunds > $500 need VP approval” — can be saved once and seen by every
authorised user. See Multi-User Isolation for the
full contract and a worked example.
When you call MemoryManager.buildContext(sessionId, userId, ...) without a
userId, stores that require one return empty strings rather than risk
surfacing another user’s data.
Observability
Memory subsystem failures emit events on the agent’sEventBus so they don’t
silently disappear. The most useful one is memory.error:
memory.fact.added/memory.fact.invalidated— fact-store mutations.memory.extract— background extraction triggered.memory.context.built—buildContextreturned (withtotalTokensand per-section breakdown).
Cross-References
- Multi-User Isolation — Security guarantees and the user-scoping contract
- Memory Stores — Deep dive into each store type
- Graph Memory — Knowledge graph with traversal
- Temporal Awareness — Fact validity and contradiction detection
- Composite Scoring — How memories are ranked
- Procedural Memory — Learning multi-step workflows
- Simplified API — remember/recall/forget convenience methods
- Cross-Agent Sharing — Shared memory in teams
- Context Budget — Token-aware allocation
- Memory Curator — Pruning, dedup, consolidation, and maintenance
- Storage Backends — MongoDB, Postgres, in-memory options