---
source: https://iinventedlight.com/library/notes/agents-sdk-sessions.md
title: "Use session memory to keep conversation history across agent runs"
license: CC-BY-4.0
license_url: "https://creativecommons.org/licenses/by/4.0/"
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-22
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-22
as_of: 2026-11-22
confidence: medium
untested: "Not reproduced (2026-11-22). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coverage-gaps
client: Librarian
source_license: "MIT (OpenAI Agents SDK; Pydantic AI, including associated documentation files); prose restates cited source lines in own words"
license_family: mit
attribution: "Summary by iinventedlight (AI-assisted). Sources: OpenAI Agents SDK Sessions (MIT); Pydantic AI Messages and chat history (MIT). Text was condensed and changed from the originals."
topic_area: "code-ai-eng: agent session memory"
tags: [agents, sessions, memory, conversation-history, openai-agents, pydantic-ai]
sources:
  - id: S1
    title: "Sessions"
    publisher: OpenAI Agents SDK
    url: https://openai.github.io/openai-agents-python/sessions/
    accessed: 2026-11-22
    license: "MIT"
  - id: S2
    title: "Messages and chat history"
    publisher: Pydantic AI
    url: https://pydantic.dev/docs/ai/core-concepts/message-history/
    accessed: 2026-11-22
    license: "MIT"
---

# Use session memory to keep conversation history across agent runs
**Answer:** Built-in session memory maintains conversation history across multiple agent runs, so you do not have to handle that history by hand between turns.

## Why it matters

The Agents SDK provides built-in session memory. It automatically maintains conversation history across multiple agent runs. That removes the need to manually handle `.to_input_list()` between turns. Each session keeps its own conversation history, so agents can keep context without explicit manual memory management. This is particularly useful for chat applications or multi-turn conversations. Use sessions when you want the SDK to manage client-side memory for you. A session cannot be combined, in the same run, with the run-level continuation options `conversation_id` or `previous_response_id`.

Pydantic AI provides access to messages exchanged during an agent run. Those messages can be used to continue a coherent conversation, and to understand how an agent performed. After running an agent, you can access the messages from the result object. `all_messages()` returns all messages, including messages from prior runs. `new_messages()` returns only the messages from the current run.

- `Automatic memory` Built-in session memory automatically maintains conversation history across multiple agent runs
- `Client-side` Use sessions when you want the SDK to manage client-side memory for you
- `Message access` Messages exchanged during an agent run can continue a coherent conversation

## See also

- [openai-agents-tracing](https://iinventedlight.com/library/notes/openai-agents-tracing/)
- [pydantic-ai-mcp](https://iinventedlight.com/library/notes/pydantic-ai-mcp/)
- [inspect-eval-log-viewer](https://iinventedlight.com/library/notes/inspect-eval-log-viewer/)

## Claims

- id: C1
  claim: Built-in session memory maintains conversation history across multiple agent runs.
  source: S1
  evidence: "built-in session memory to automatically maintain conversation history across multiple agent runs"

- id: C2
  claim: Use sessions when you want the SDK to manage client-side memory.
  source: S1
  evidence: "Use sessions when you want the SDK to manage client-side memory for you."

- id: C3
  claim: Messages from an agent run can be used to continue a coherent conversation.
  source: S2
  evidence: "used both to continue a coherent conversation, and to understand how an agent performed."

## Sources

- [S1] Sessions. OpenAI Agents SDK. https://openai.github.io/openai-agents-python/sessions/ . License: MIT. Accessed 2026-11-22.

- [S2] Messages and chat history. Pydantic AI. https://pydantic.dev/docs/ai/core-concepts/message-history/ . License: MIT. Accessed 2026-11-22.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: OpenAI Agents SDK Sessions; Pydantic AI Messages and chat history. MIT. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
