New Tool Radar

AI Agents & Automation

How to Add a Memory Base to a Langflow Agent

Add a Langflow memory base to an agent so it can recall relevant past conversations across sessions.

Schematic with three steps: Create the memory base; Connect it to the agent as a; Chat twice and check the recall.

A Langflow memory base stores a flow’s chat history in a vectorized format, so an agent can retrieve the most relevant past conversations by meaning, not just the most recent messages. Unlike the Message History component, which returns messages in chronological order, a memory base embeds messages and retrieves by semantic similarity. Create the memory base, then connect it to the agent as a tool.

What you need

  • A Langflow flow with a Simple Agent and a chat model
  • An embedding model configured in Langflow settings
  • A vector database provider configured in Settings, or the default local SQLite store

Step 1: Create the memory base

In the visual editor, open Memories in the left sidebar, click Create, and give the memory base a name, an embedding model and a vector database. Note that a memory base can only be attached to one flow.

Step 2: Connect it to the agent as a tool

Add a Memory Base component to the flow, select the memory base you created, enable Tool Mode, and connect its Toolset output to the Agent component’s Tools input. The flow must contain a Chat Input or Chat Output component so messages are written to the messages table.

Step 3: Chat twice and check the recall

Chat with the agent, start a new session, and ask a question that depends on the first chat. Confirm the agent recalls the relevant fact. By default only chunks from the same session are returned, so disable Filter by Session if the agent should recall across sessions.

Worked example: synthetic two-session check

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

Check Expected Result
First chat stored Yes Pass
Second session recalls the fact Yes Pass
Recall is relevant, not just recent Yes Pass
Unrelated chats not recalled 0 recalled Pass

Expected result (UNTESTED). the agent recalls the relevant fact from the earlier session and does not surface unrelated chats. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A memory base is scoped to a single flow, though one flow can have several memory bases.
  • Once created, you cannot change the vector database for that memory base.
  • A new memory base stays Empty until the first ingestion job completes, so recall will not work immediately.

Sources

See all