OpenAI Agents SDK memory
The first drop-in Session implementation: durable history across restarts and handoffs, plus long-term memory.
Overview
Install openai-agents-memorysync and pass session=MemorySyncSession(...) to Runner.run: session items are kept server-side in MemorySync conversation history exactly as the SDK wrote them, survive restarts and deploys, and follow multi-agent handoffs. The transcript is never listed or recalled as memories; the durable facts in user messages go to long-term memory automatically, and assistant replies are not stored. memory_instructions adds a memory block to the system prompt each time the SDK builds it (by default the user’s newest facts, or recall against a prompt you supply), and five structured tools give agents explicit memory. No other memory vendor implements the SDK’s Session protocol.
Setup status and requirements
- Supported version
- openai-agents-memorysync 1.1.0 (PyPI)
- Last setup review
- 2026-10-01
- Permissions
- A MemorySync API key with read and write scopes; pop_item/clear_session need delete permission.
- Limits
- Python 3.10+. Install openai-agents alongside it. Python only — TypeScript agents use the Vercel AI SDK or Mastra integrations.
Capabilities
- The first drop-in Session protocol implementation from any memory vendor
- History shared across multi-agent handoffs automatically
- Retry-safe transcript writes: total and partial batch failures converge
- Automatic long-term memory from the user’s messages
- pop_item/clear_session scoped and loud — never silent data loss
- memory_instructions: a memory block in the system prompt, with per-request identity
- Five never-raise agent tools with a read-only mode
Quick Start
from agents import Agent, Runnerfrom openai_agents_memorysync import MemorySyncSessionagent = Agent(name="Assistant", instructions="You are a helpful assistant.")session = MemorySyncSession("thread-42", user_id="customer-7")result = await Runner.run(agent, "Book my usual trip.", session=session)
Use Cases
Agents that remember users across sessions and deploys
Multi-agent handoff flows with shared history
Replacing SQLite/Redis session infrastructure with a managed service
Guides and related pages
Related integrations
Explore More
Add long-term memory to OpenAI Agents SDK
Start free with 10,000 add requests a month and no credit card. Memory is stored per end user and comes back in every later session.
