Skip to content
Membase
Membase x Strands Agents: Long-Term Memory for AI Agents

Membase x Strands Agents: Long-Term Memory for AI Agents

Research
MembaseMembase Team
View the original post on Medium

A user tells your Strands agent which database the team picked, when the launch is and how they like their reports. The next session starts from zero. Or the user opens Claude Code, and none of it is there either.

Membase gives Strands agents long-term memory that every AI tool can share. Before each turn, the agent recalls what the user said before, with each passage citing the Memory it came from. It saves only when the user asks. Membase is listed as a Partner memory store in the Strands Agents integrations catalog, added in PR #5514, next to Mem0, Zep and Hindsight.

Quick answer

  1. Create a Memory and a developer key in the Membase app.
  2. pip install strands-agents membase-strands
  3. Add MembaseMemoryStore to the agent's MemoryManager.
  4. The agent now recalls cited memories before each turn and has membase_search, membase_save and membase_profile.
  5. Ask Claude Code the same question: the memory is the same.

Membase x Strands Agents: the MemoryManager recalls cited memories before each turn, the agent saves when the user asks, and other AI tools read the same memory over MCP

Why Membase for AI agents?

  1. Memory that outlasts the agent. What a user tells one Strands agent is there for every other agent, app and AI tool that reaches the same Memory.
  2. Every recalled passage cites its source. Each passage names the Memory it came from, so the agent can tell the user where it learned a fact.
  3. Saves only what the user asks to keep. Saving is a tool the model calls when the user asks to remember something. Saving every turn is a setting you turn on yourself.
  4. Never slows a turn down. Recall has a time budget, 8 seconds by default. If it runs out, the turn goes on without memory.
  5. Hosted or local. Use the hosted service, or keep memory on your own machine with local mode.

How Membase works with Strands

Strands has a built-in memory layer: a MemoryManager that takes one or more memory stores. MembaseMemoryStore implements Strands' MemoryStore protocol, so it plugs in like any other store:

PartWhat it does
Recall before each turnThe MemoryManager searches Membase before each model call and injects the passages, each tagged with its Memory, for example [Project decisions] We chose Postgres for the ledger.
membase_searchSearches every Memory the key reaches when the agent needs more than the recall gave it.
membase_saveSaves a note when the user asks the agent to remember something.
membase_profileReads the user's profile: standing facts about who they are, newest first.
Turn capture (optional)With capture=True, the manager hands batches of turns to Membase. Off by default.

Memory in practice: Building a Strands agent that remembers

What you will build:

  • An agent that recalls cited memories before each turn.
  • Tools that save only when the user asks, and search when the agent needs more.
  • Claude Code connected to the same memory.

Step 1: Create a Memory and a key

In the Membase app, create a Memory, for example “Project decisions”. Then open Connect › Developer keys and create a key:

  • Choose Read & write if the agent should save memories, or Read if it should only search.
  • A key that should save must reach exactly one Memory, which becomes its write target. A key that reaches several Memories can search them all but cannot save.
  • Tick profile if you want membase_profile to work.

Step 2: Install

pip install strands-agents membase-strands
export MEMBASE_API_KEY=mbk_...

membase-strands needs Python 3.10 or later and strands-agents 1.45.0 or later, the first release with strands.memory. Strands uses Amazon Bedrock by default, so set up your AWS credentials, or pass any other model provider to the agent.

Step 3: Add some memories

from membase import Membase

client = Membase()  # reads MEMBASE_API_KEY from the environment
for note in [
    "We chose Postgres for the ledger.",
    "The launch is planned for April.",
    "Weekly reports should be short, with numbers first.",
]:
    client.memories.add(note)

Membase accepts each note at once and learns it in the background, so give it a short while before you search.

Step 4: Add Membase to the agent

from strands import Agent
from strands.memory import MemoryManager
from membase_strands import MembaseMemoryStore

store = MembaseMemoryStore()  # reads MEMBASE_API_KEY from the environment
agent = Agent(
    memory_manager=MemoryManager(
        stores=[store],
        search_tool_config=False,
    ),
)

agent("Which database did we pick for the ledger?")

Before the model call, the manager searches Membase and injects the cited passage, [Project decisions] We chose Postgres for the ledger. The agent answers Postgres and can say which Memory the fact came from.

search_tool_config=False turns off the manager's built-in search tool, because the store gives the agent its own membase_search, which waits longer on a cold start and says when a Memory could not answer.

Step 5: Save when the user asks

The same agent already has membase_search, membase_save and membase_profile:

agent("Remember that we moved the launch to May.")

The model calls membase_save with the new fact, and it lands in the key's write target. To give an agent search only, for example with a Read key, choose its tools:

store = MembaseMemoryStore(tools=("search", "profile"))

Step 6: Give Claude Code the same memory

claude mcp add --transport http membase https://api.app.membase.com/mcp-http

Claude Code opens your browser to approve access. Tick “Project decisions” and approve. This connection is read-only, so Claude Code can search the memory but not change it. Setup for Cursor, Codex, ChatGPT and other clients is in Connect your AI.

Step 7: Verify that memory is working

  1. Run Step 5 and confirm the agent says it saved the new launch date.
  2. Wait a short while for Membase to learn it.
  3. Create a new agent and ask: “When is the launch?”
  4. The answer should say May and cite the Memory it came from.
  5. Ask Claude Code, connected in Step 6, the same question. The answer is the same, because the fact lives in Membase, not in the agent.

Memory types in Strands: Sessions, memory stores and Membase

Session historyOther Strands memory storesMembase
What it keepsThe messages of one sessionFacts saved by your agentsLong-term memory learned from what users save
How long it lastsThe session, or as long as you persist itUntil you delete itUntil the user deletes it
Shared acrossOne agent's conversationThe agents that use the storeAgents, apps, frameworks and AI tools
Shared with other AI toolsNoUsually noYes: ChatGPT, Claude, Claude Code, Cursor and Codex over MCP
Sources citedNoDepends on the storeYes, each passage names its Memory
Good forFollow-up questionsMemory inside your agentsMemory that every tool should know

Keep Strands’ session management for the current conversation. Add Membase when the memory should reach every agent and tool the user works with.

Common mistakes

The key reaches several Memories, so nothing is saved

A key can save only when it reaches exactly one Memory. If it reaches several, search works but membase_save is refused, and the tool says so. Give writer agents a key with one Memory in reach.

Expecting recall on the very first turn

The first search after a quiet spell takes longer while the memory wakes up. Recall gives up after its 8-second budget, so the first turn may run without it. The search keeps running in the background, so later turns find the memory awake. membase_search waits longer.

Sharing one store across all users

One key is one person’s memory, and Strands’ memory protocol does not pass a user to the store. In an app with many users, build the store and the agent per user, from that user’s own key:

def agent_for(user_key: str) -> Agent:
    store = MembaseMemoryStore(api_key=user_key)
    return Agent(memory_manager=MemoryManager(stores=[store], search_tool_config=False))

Saving every turn

Saving everything fills memory with noise, and it can teach the agent’s own answers as facts. Keep capture off unless you need it, and let the model call membase_save when the user asks.

Building better agents with long-term memory

Agents feel forgetful when every session starts from zero. With Membase, a fact is saved once and every Strands agent, every app and every AI tool the user works with starts from the same context, with the source of each fact cited. Strands keeps orchestrating the agent, sessions keep the conversation, and Membase keeps what your users told you.

What teams build with it:

  • Project assistant. Save decisions as the team makes them. Every agent recalls them, and so does Claude Code.
  • Customer support agent. Give each customer their own key. Recall their preferences before every reply, so they never repeat themselves.
  • Research agent. Save sources and conclusions as you go, then pick up next week in Strands, ChatGPT or Cursor.

Getting started

  1. Create a free key in the Membase app under Connect › Developer keys.
  2. pip install strands-agents membase-strands
  3. Follow the steps above, then run the test in Step 7.

All options, tools and error messages are in the membase-strands README.

Resources

Get started

For developers

Videos

Help

Frequently Asked Questions

Does Strands Agents have long-term memory?
Yes. Strands has a MemoryManager that recalls from one or more memory stores before each turn. Membase is one of the memory stores in the Strands integrations catalog.
Is Membase an official Strands integration?
Membase is listed as a Partner memory store in the Strands Agents integrations catalog, added in PR #5514 and listed next to Mem0, Zep and Hindsight.
Can each user have their own memory?
Yes. One Membase key is one person’s memory. Build the store and the agent per user, from that user’s own key.
Can I keep memory on my own machine?
Yes. Install membase-strands[local] and create the store with a local directory instead of a key. Memory stays on your machine.
Does Membase save every message?
No, not by default. The agent saves when the user asks. Automatic capture is a setting you turn on with capture=True.
Is Membase free?
Membase is free during the beta. Paid plans are coming soon.
Back to all posts