New Tool Radar

AI Agents & Automation

How to Store an Agent Long-Term Memory of a User Preference

Store a durable user preference in agent long-term memory so the agent applies it in later sessions without being told again.

Schematic with three steps: Write the preference into a real conversation; Let the memory base ingest the batch; Start a new session and test the.

Long-term memory is different from the current chat: it is the durable facts about a user that should survive across sessions, such as a preferred format or a standing constraint. A Langflow memory base stores chat history in a vectorized format and retrieves past conversations by meaning, and with LLM preprocessing it can distill each batch into the durable facts worth keeping. Store only facts that stay true, such as a preference, and skip the rest: the preprocessing prompt can return a kill phrase for batches with nothing worth storing, so greetings and filler never reach the store.

What you need

  • A Langflow flow with a memory base attached
  • One durable preference to store, for example a preferred summary format
  • A way to start a new session in the same flow

Step 1: Write the preference into a real conversation

In a chat with the agent, state the preference clearly and ask the agent to confirm it back. A preference the agent never heard cannot be stored.

Step 2: Let the memory base ingest the batch

Wait for the ingestion job to run after the chat completes, then confirm the memory base holds the preference and not the greetings around it. Preprocessing should have distilled the batch to its durable facts.

Step 3: Start a new session and test the preference

Start a new session and ask the agent for something the preference covers. Confirm it applies the preference without being told again. If it does not, check whether the batch was ingested or skipped.

Worked example: synthetic preference check

The table below is a synthetic example. It shows the expected result of long-term memory; no chat was run.

Check Expected Result
Preference stated and confirmed Yes Pass
Batch ingested with the fact Yes Pass
New session applies the preference Yes Pass
Greetings not stored as facts 0 stored Pass

Expected result (UNTESTED). the preference is stored from the first chat and applied in a new session, while greetings are not stored as facts. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Long-term memory stores what was ingested, so a preference stated unclearly is stored unclearly.
  • A memory base is scoped to one flow, so the preference does not travel to other flows.
  • Preprocessing needs an embedding model, and a new memory base stays empty until the first ingestion completes.
  • Stored preferences go stale when the user changes their mind, so re-check them before relying on them.

Sources

See all