Skip to content

How memory works

For most use cases, memory just works. Your agent learns as it goes and pulls in relevant context on its own — you don’t have to wire anything up. This page explains what’s happening behind that.

As your agent works, Alfe watches its conversations and periodically distills the durable, reusable facts into the agent’s memory — the decisions, preferences, and details worth keeping. This happens in the background, a short time after a conversation goes quiet, so it doesn’t slow down the live interaction.

You don’t have to tell the agent to “save” something for it to be remembered. That said, when you’re building on the agent you can store facts explicitly — see Using memory from the Agent API.

When a new question or task comes in, the agent looks for memories that are relevant to what’s being discussed and brings them into its working context before it answers. Recall is based on meaning, so a memory can surface even when its original wording is different from the current question.

The result is an agent that carries context forward: it can reference an earlier decision, remember a customer’s preference, or avoid re-asking something you already told it — across sessions, days, and channels.

Memories are grouped into a simple three-level hierarchy so related knowledge stays together:

  • Topic — the broad area, e.g. billing or product.
  • Subtopic — a narrower grouping within a topic, e.g. invoicing.
  • Tag — a short label for the kind of memory, e.g. preference or fact.

Each memory also carries an importance — a hint about how significant the fact is — which helps the most relevant, highest-value memories surface first.

This structure is mostly invisible during normal use, but it’s what lets you filter recall to a specific area when you query memory through the Agent API.

Alongside individual memories, an agent also tracks facts about the people and things it interacts with — for example, that a particular customer prefers email over calls. These facts are recalled together with related memories, which is why an agent can answer “what do we know about Acme?” with a coherent picture rather than a pile of raw messages.

The automatic behaviour covers most needs. You’d reach for the API when you want to:

  • Seed an agent with knowledge up front (say, from a document or a knowledge base).
  • Store a specific fact you want guaranteed to be remembered.
  • Search memory yourself to build a feature on top of it.
  • Remove a memory that’s no longer accurate.

All of that is covered in Using memory from the Agent API.