Skip to main content
The Interactions API keeps conversation history server-side. After the first turn, the model sends only the new message and references the prior turn via previous_interaction_id. Multi-turn needs a database so the interaction ID from each response is persisted and read back on the next turn.

Code

multi_turn.py

Usage

1

Set up your virtual environment

2

Set your API key

3

Install dependencies

4

Run Agent

Save the code above as multi_turn.py, then run: