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

Published: 2026-11-13 · Author: Membase Team  
Source: https://membase.com/blog/strands-agents-memory

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](https://strandsagents.com/integrations/), added in [PR #5514](https://github.com/strands-agents/harness-sdk/pull/5514), next to Mem0, Zep and Hindsight.

> **Quick answer**
>
> 1. Create a Memory and a developer key in the [Membase app](https://app.membase.com/).
> 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](https://dmc2j1nsu0tnv.cloudfront.net/1794549235635-1fOe-membase-strands-diagram.png)

## 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.
1. **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.
1. **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.
1. **Never slows a turn down.** Recall has a time budget, 8 seconds by default. If it runs out, the turn goes on without memory.
1. **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:

| Part | What it does |
|---|---|
| **Recall before each turn** | The `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_search` | Searches every Memory the key reaches when the agent needs more than the recall gave it. |
| `membase_save` | Saves a note when the user asks the agent to remember something. |
| `membase_profile` | Reads 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

```bash
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

```python
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

```python
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:

```python
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:

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

## Step 6: Give Claude Code the same memory

```bash
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](https://docs.membase.com/connect/).

## Step 7: Verify that memory is working

1. Run Step 5 and confirm the agent says it saved the new launch date.
1. Wait a short while for Membase to learn it.
1. Create a new agent and ask: “When is the launch?”
1. The answer should say May and cite the Memory it came from.
1. 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 history | Other Strands memory stores | Membase |
|---|---|---|---|
| What it keeps | The messages of one session | Facts saved by your agents | Long-term memory learned from what users save |
| How long it lasts | The session, or as long as you persist it | Until you delete it | Until the user deletes it |
| Shared across | One agent's conversation | The agents that use the store | Agents, apps, frameworks and AI tools |
| Shared with other AI tools | No | Usually no | Yes: ChatGPT, Claude, Claude Code, Cursor and Codex over MCP |
| Sources cited | No | Depends on the store | Yes, each passage names its Memory |
| Good for | Follow-up questions | Memory inside your agents | Memory 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:

```python
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](https://app.membase.com/) under Connect › Developer keys.
1. `pip install strands-agents membase-strands`
1. Follow the steps above, then run the test in Step 7.

All options, tools and error messages are in the [membase-strands README](https://github.com/unibaseio/membase/tree/main/integrations/strands#readme).

## Resources

- [Strands Agents integrations catalog](https://strandsagents.com/integrations/): Membase is listed under Memory Store
- [PR #5514 on strands-agents/harness-sdk](https://github.com/strands-agents/harness-sdk/pull/5514): adding Membase to the Strands catalog, merged
- [membase-strands on PyPI](https://pypi.org/project/membase-strands/): the package
- [membase-strands README](https://github.com/unibaseio/membase/tree/main/integrations/strands#readme): options, tools and errors
- [Membase x Hermes Agent: Long-Term Memory for AI Agents](https://membase.com/blog/hermes-agent-memory): the same memory in Hermes
- [Membase x Agno: Long-Term Memory for AI Agents](https://membase.com/blog/agno-memory): the same memory in Agno

## Quick links

**Get started**

- [Get started with Membase](https://app.membase.com/): create a Memory and connect your first AI. Free during the beta; paid plans are coming soon.
- [Membase Chrome Extension](https://membase.com/chrome-extension): save and reuse context in ChatGPT, Claude, Gemini, Grok, DeepSeek and Kimi
- [Connect your AI](https://docs.membase.com/connect/): setup guides for ChatGPT, Claude, Claude Code, Cursor, Codex and Grok
- MCP server: [setup guide](https://docs.membase.com/connect/clients/membase-mcp/) · endpoint [https://api.app.membase.com/mcp-http](https://api.app.membase.com/mcp-http)
- [Your first Memory](https://docs.membase.com/use/getting-started/quickstart/): the app quickstart
- [What Is Cross-AI Memory?](https://unibase.com/blog/what-is-cross-ai-memory): the idea behind one memory across AI assistants

**For developers**

- Get an API key: [Membase Web App](https://app.membase.com/) → Connect › Developer keys
- Python SDK: [unibaseio-membase on PyPI](https://pypi.org/project/unibaseio-membase/) · pip install unibaseio-membase
- TypeScript SDK: [@unibaseio/membase on npm](https://www.npmjs.com/package/@unibaseio/membase) · npm install @unibaseio/membase
- CLI: [@unibaseio/membase-cli on npm](https://www.npmjs.com/package/@unibaseio/membase-cli) · npm install -g @unibaseio/membase-cli
- [API quickstart](https://docs.membase.com/build/getting-started/api-quickstart/) · [SDK reference](https://docs.membase.com/build/reference/sdk-quickstart/): methods, REST routes and MCP tools
- Source and examples: [github.com/unibaseio/membase](https://github.com/unibaseio/membase) · [Membase use cases on GitHub](https://github.com/unibaseio/membase-use-cases)
- [Membase Research](https://membase.com/research): benchmarking long-term memory for agents

**Videos**

- [How to Add Long-Term Memory to an AI Agent with the Membase SDK in 1 Minute](https://www.youtube.com/watch?v=iN60c5j0vFY)
- [Give Claude Code Permanent Memory in 60 Seconds (MCP)](https://www.youtube.com/watch?v=G6mH6uziDuM)

**Help**

- [Discord](https://discord.gg/nB9EfPGsSf) · [Telegram](https://t.me/unibase_ai) · [Feedback form](https://forms.gle/mXtMLqe4MrRcHyGT9)
- [Privacy policy](https://membase.com/privacy)

## 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.
