Skip to main content
This example demonstrates how to use tool hooks to dynamically manage session state. It shows how to create a customer management system that updates session state through tool interactions rather than direct modification.
1

Create a Python file

dynamic_session_state.py
2

Set up your virtual environment

3

Install dependencies

4

Export your OpenAI API key

Set OpenAI Key

Set your OPENAI_API_KEY as an environment variable. You can get one from OpenAI.
5

Run Agent