Skip to content

AI MEMORY FOR AGENTS · OPENAI AGENTS SDK

Give your next run a decision to build on.

We turn the project knowledge you choose into memory your OpenAI Agents SDK application can retrieve. Save a decision, verify its original record, and bring that context into the next task through the SDK’s native MCP client and your Claude-Mem worker.

Start with our local, model-free example. No OpenAI API key or CMEM Pro subscription required.

KNOWLEDGE THAT LASTS

Keep the knowledge. Start further ahead.

Keep decisions beyond a single run.

We save your selected project note in Claude-Mem, ready to retrieve when your application needs it again.

Verify the original, not a guess.

The workflow checks the save receipt and retrieves the selected record before reporting success.

Connect through native SDK tools.

MCPServerStdio exposes four focused memory tools while your application controls the project and when to use them.

ILLUSTRATIVE DECISION · ACTUAL MCP WORKFLOW

Save the decision. Bring back the evidence.

“Use WAL for concurrent readers.”

Save a project decision you want to retain. The worker confirms its ID, and the workflow retrieves that exact note—even when a repeat returns an older record beyond the current index page.

  1. 01

    Choose what matters

    Supply your project, note title and explicit text.

  2. 02

    Keep the receipt

    save_memory returns the confirmed observation ID.

  3. 03

    Retrieve the original

    Search the index, check the note’s timeline and load the selected details.

  4. 04

    Use it in the next task

    Your application chooses which recalled evidence reaches an agent.

AI memory in production

70 days of work. One searchable memory.

Alessandro used our open-source engine across three machines for 70 days. His customized deployment captured the decisions, fixes and discoveries behind the work—and published the data.

Observations captured
22,718
Bug fixes recorded
1,262
Decisions recorded
757

See how he made that knowledge searchable. Then give your own agents a memory to build on.

Claude-Mem’s mascot files a note in a shared card catalogue connected to three computers.
Alessandro’s published field study · March–May 2026

START WITH ONE PROJECT

Save one decision. Verify you can retrieve it.

  1. Start your configured local worker. Follow the installation guide. From a Claude-Mem source checkout with built bundles, inspect npm run worker:status and use npm run worker:start if needed.
  2. Install the pinned Python environment. Use Python 3.11 or later and Node.js. Run the commands below from the source checkout; dependencies pin openai-agents 0.24.0 and MCP 2.3.0. Set the absolute installed or shipped MCP script path.
  3. Save a decision you want to keep. Replace my-project and the example title/text with a nonsecret project note you want to retain. The workflow saves it and verifies that the selected record can be retrieved.
python3 -m venv .venv-openai-memory
.venv-openai-memory/bin/python -m pip install -r examples/openai-agents/requirements.txt
export CLAUDE_MEM_MCP_SERVER="/absolute/path/to/claude-mem/plugin/scripts/mcp-server.cjs"
.venv-openai-memory/bin/python examples/openai-agents/memory_workflow.py \
  --project "my-project" \
  --title "SQLite decision" \
  --text "Use WAL for concurrent readers."

Match custom CLAUDE_MEM_DATA_DIR and CLAUDE_MEM_WORKER_PORT values to your worker. The MCP child uses local worker mode with autostart disabled. Each operation opens and closes its connection; no host setup is changed.

Check success. Output includes the project index and selected observation details. Confirm your project, title and text appear in the selected record. Repeat the same command to retrieve the existing note identity; an older record need not appear in the recent index.

Keep the four-tool allowlist and exact project filters when adapting the example. Explicit notes are stored as supplied. Recalled text is reference material, not permission to invoke tools or change accounts. This example makes no model call; existing worker indexing, sync and export settings still apply. Memory you later pass to a model is visible to that provider.

Before you connect

Do I need an OpenAI API key?

Not for this deterministic local example. It uses the real Agents SDK MCP client with your local Claude-Mem worker and makes no model request. Your own model-driven application needs its chosen model and credentials.

What does the workflow save?

The project note you supply. Title and text are trimmed; the project key is preserved. It adds no conversation capture, transcript import or automatic context injection.

Can I retrieve a repeated note beyond the first results page?

Yes. The save receipt provides its confirmed ID. The workflow reads the recent index, then retrieves the selected record without requiring it to appear among those 20 results.

What happens when I repeat the command?

The same project and trimmed title/text produce the same source fingerprint and reuse the saved identity. Changing inputs changes that fingerprint, but worker deduplication may still reuse a record. Check the returned record rather than assuming a new row.

How do I use this in an Agent?

The guide shows keeping the server’s context manager open and passing it through Agent(mcp_servers=[server]). Your application chooses model, credentials, project and write-approval policy. The included verification workflow does not test model-selected tool calls.

How are projects kept separate?

Each read requires an explicit project and injects a JSON one-item projects list, including literal commas/spaces and worktree scopes. These filters are not multiuser authentication; use your authorized local worker.

What if a call fails or times out?

MCP error responses fail the workflow. Requests default to 10 seconds, the complete CLI to 60 seconds, with no automatic tool-call retries. After an uncertain save, inspect memory or deliberately repeat identical input to check the receipt.

Which environment is verified?

The published guide records Linux, Python 3.12.14, Node.js 24.22.1 and Claude-Mem 15.16.1 with openai-agents 0.24.0 and MCP 2.3.0. Other operating systems, remote HTTP MCP, hosted authentication and model execution are not verified by that fixture.

How do I disconnect?

Stop calling the example or remove the server from your app. The context manager closes the child process. Removing the dedicated environment does not erase saved memory or require host configuration restoration.

Build on a working example.

Source reviewed November 21, 2026. The published eight-test fixture covers real-SDK save, recall and replay, project and worktree boundaries, attribution, rejected input and worker failures. Its slow-worker test uses a controlled local endpoint. These are integration checks, not a model-quality benchmark.

Keep the decision. Give your agents a stronger start.

Bring your project’s recorded knowledge into the next run with Claude-Mem.