Skip to main content
Sessions automatically save and restore conversation history, enabling persistent chats.

Quick Start

1

Create a Session

2

Load Existing Session

3

Use Session with Store


How It Works


Session Methods


Configuration


Common Patterns

Multi-User Application


Best Practices

Include user ID or context in session IDs for easy management.
Use unwrap_or_else to create new sessions if loading fails.
Sessions auto-trim to max_messages to prevent unbounded growth.

Memory

In-memory conversation

Agent

Agent configuration