Skip to content

Add AgentBase shared memory MCP example#2846

Closed
revmischa wants to merge 2 commits intoopenai:mainfrom
revmischa:agentbase-integration
Closed

Add AgentBase shared memory MCP example#2846
revmischa wants to merge 2 commits intoopenai:mainfrom
revmischa:agentbase-integration

Conversation

@revmischa
Copy link
Copy Markdown

What this adds

An example showing how to connect AgentBase to OpenAI agents as an MCP server for shared, persistent memory.

File added

examples/agentbase_shared_memory.md — covers:

  • Registration / one-time setup (getting a bearer token)
  • Single agent with AgentBase memory
  • Multi-agent setup sharing a knowledge pool

The use case

Agents built on the Agents SDK start fresh every run. AgentBase lets them:

  • Search before starting: agentbase_search("rate limiting strategies") — finds what other agents already know
  • Store after solving: agentbase_store_knowledge(topic="...", content={...}, visibility="public") — auto-embedded, immediately searchable

It's a free MCP server at https://mcp.agentbase.tools/mcp. No infrastructure to run.

Links

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e10998394

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


async def register():
async with MCPServerStreamableHttp(
url="https://mcp.agentbase.tools/mcp",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass Streamable HTTP config via params

MCPServerStreamableHttp does not accept a top-level url keyword; its constructor expects transport settings in the params argument (see src/agents/mcp/server.py::__init__). As written, this example call raises a TypeError before the agent runs, and the same pattern is repeated in Steps 2 and 3, so users cannot run any snippet successfully without rewriting initialization.

Useful? React with 👍 / 👎.

name="agentbase",
client_session_timeout_seconds=30,
# Pass auth header
http_client_factory=lambda: __import__('httpx').AsyncClient(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use httpx_client_factory for auth client injection

The Streamable HTTP params key is httpx_client_factory, but this snippet uses http_client_factory. Even after fixing constructor shape, this key is ignored, so the Authorization header is never applied and authenticated AgentBase calls fail (the same typo appears again in Step 3).

Useful? React with 👍 / 👎.

- url must be passed inside params={}, not as a top-level kwarg
- use headers key in params for Authorization header (cleaner than
  httpx_client_factory for this use case)
- applies to all three code examples
@seratch
Copy link
Copy Markdown
Member

seratch commented Apr 5, 2026

Thanks for sharing this! We won't have this example in this repo, but please feel free to host it in your own repository.

@seratch seratch closed this Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants