Skip to main content
Sessions give your Agents memory across multiple interactions. Users can have ongoing conversations, and Agents remember the context from previous messages.
Looking for “reopen a previous chat”? The Agent-level Chat History Restore API (getHistory / setHistory) is the direct primitive. Session / SessionManager on this page is a higher-level container built around the same idea — pick this page when you want a session object with metadata, runs, and shared context across multiple agents.
Python-only for now: save_state, restore_state, add_memory, search_memory, and chat have no TypeScript counterpart on Session. Use SessionManager and session.addMessage(...) shown below for persistence and history; see the SDK parity baseline for the full list.

Quick Start

1

Simple Usage

2

With Configuration

Use SessionManager or Postgres storage — see sections below.

Multi-Turn Conversations

Agent with Persistent Sessions

Sessions that survive server restarts:

Multi-Agent Shared Sessions

Multiple Agents sharing conversation context:

Session with Run Tracking

Track individual Agent executions:

Session Context Window Management

Handle long conversations:

Session Metadata

Store user and context information:

Core Concepts

Memory

Semantic memory

Redis

Fast session storage