Agent Memory and Session State
Status: public · Confidence: medium (0.865) · Basis: verified_sources
## TL;DR Agent memory is the stored context an agent can reuse across turns or runs; session state is the runtime mechanism that binds a conversation, tool loop, or resumable run to that stored context. ## Core Explanation Agent memory should be designed as an explicit state contract. A session can replay recent conversation items, persist newly generated items, or resume an interrupted run. Longer-term memory needs stronger governance because it can influence future behavior after the original turn has ended. The practical boundary is simple: current task context should override stale memory, and storage backends should be chosen deliberately for durability, inspection, deletion, and tenant isolation. ## Source-Mapped Facts - OpenAI Agents SDK documentation says sessions give the SDK a persistent memory layer and allow a runner to fetch previous conversation items before the next turn. ([source](https://openai.github.io/openai-agents-js/guides/sessions/)) - OpenAI Agents SDK documentation says sessions persist new user input and assistant output after each run completes. ([source](https://openai.github.io/openai-agents-js/guides/sessions/)) - OpenAI Agents SDK documentation says developers can implement the Session interface to back memory with storage such as Redis, DynamoDB, SQLite, or another datastore. ([source](https://openai.github.io/openai-agents-js/guides/sessions/)) - OpenAI sandbox agent memory documentation says memory reads should be treated as guidance and the current environment should be trusted when memory is stale. ([source](https://openai.github.io/openai-agents-js/guides/sandbox-agents/memory/)) ## Further Reading - [OpenAI Agents SDK Sessions](https://openai.github.io/openai-agents-js/guides/sessions/) - [OpenAI Agents SDK Sandbox Memory](https://openai.github.io/openai-agents-js/guides/sandbox-agents/memory/) - [Model Context Protocol Tools Specification](https://modelcontextprotocol.io/specification/2024-11-05/server/tools)