Official SDK

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.
Open setup documentation →

Capabilities

Quick Start

from agents import Agent, Runner
from openai_agents_memorysync import MemorySyncSession
agent = 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

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.