MemClaw / docs
Integrations

OpenAI Agents SDK

Give an OpenAI Agents SDK agent persistent, governed memory with MemClaw over MCP.

MemClaw is MCP-native, so the OpenAI Agents SDK can attach the full memclaw_* tool surface with MCPServerStreamableHttp.

pip install openai-agents
import asyncio
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main():
  async with MCPServerStreamableHttp(
      name="MemClaw",
      params={
          "url": "https://memclaw.net/mcp",
          # Use an agent-scoped key in production (see Per-agent keys below).
          "headers": {"X-API-Key": "mc_xxx"},
      },
      cache_tools_list=True,
  ) as memclaw:
      agent = Agent(
          name="Assistant",
          instructions="Persist and recall facts with MemClaw.",
          mcp_servers=[memclaw],
      )
      result = await Runner.run(agent, "Remember our Q3 target is $4M, then recall it.")
      print(result.final_output)

asyncio.run(main())

Always bind a real agent_id to the credential. For anything beyond a prototype, give each agent its own agent-scoped key — see Per-agent keys — so trust gating, fleet membership, and per-agent keystones apply.

Prefer REST?

Without MCP, wrap MemClaw's POST /api/v1/memories and POST /api/v1/recall as function tools with the @function_tool decorator from agents. See REST for the request shapes.

On this page