Add AgentBase shared memory MCP example#2846
Conversation
There was a problem hiding this comment.
💡 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".
examples/agentbase_shared_memory.md
Outdated
|
|
||
| async def register(): | ||
| async with MCPServerStreamableHttp( | ||
| url="https://mcp.agentbase.tools/mcp", |
There was a problem hiding this comment.
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 👍 / 👎.
examples/agentbase_shared_memory.md
Outdated
| name="agentbase", | ||
| client_session_timeout_seconds=30, | ||
| # Pass auth header | ||
| http_client_factory=lambda: __import__('httpx').AsyncClient( |
There was a problem hiding this comment.
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
|
Thanks for sharing this! We won't have this example in this repo, but please feel free to host it in your own repository. |
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:The use case
Agents built on the Agents SDK start fresh every run. AgentBase lets them:
agentbase_search("rate limiting strategies")— finds what other agents already knowagentbase_store_knowledge(topic="...", content={...}, visibility="public")— auto-embedded, immediately searchableIt's a free MCP server at
https://mcp.agentbase.tools/mcp. No infrastructure to run.Links