| Example | Description |
|---|---|
| Agentic Session State | Let the agent update its own session_state shopping list with enable_agentic_state. |
| Chat History | Persist chat history in Postgres and read it back with get_chat_history() between turns. |
| Dynamic Session State | Update session state inside a tool hook during an agent run. |
| Last N Session Messages | Search a user’s previous sessions with search_past_sessions, capped at the last two by num_past_sessions_to_search. |
| Persistent Session | Persist agent sessions in Postgres with a fixed session_id so history carries across runs. |
| Session Options | Simple example demonstrating store_history_messages option. |
| Session State Advanced | Manage a shopping list in session_state with tools that add, remove, and list items through RunContext. |
| Session State Basic | Maintain a shopping list in session state and update it from a tool through RunContext. |
| Session State Events | Stream an agent run and read the final session state from RunCompletedEvent. |
| Session State Manual Update | Modify session state between runs with get_session_state() and update_session_state(). |
| Session State Multiple Users | Maintain state for each user in a multi-user environment. |
| Session Summary | Use the session summary to store the conversation summary. |
| Search Session History | Demonstrates the two-step list-then-read pattern for accessing previous sessions. |
State & Session
State And Session
Examples for session state management, chat history, and session persistence.