Practical Model
For most applications:- Store conversation history in your own application’s database or memory.
- Send the relevant context back on each new turn using the
inputarray. - Use structured
messageitems to represent the back-and-forth dialogue.
Example: Multi-Turn Conversation
Here is how you pass previous context back to the model for a follow-up question:What to keep between turns
- recent user and assistant messages that still matter
- any tool calls and tool results the model needs for continuity
- any reasoning items you want to preserve across tool turns on reasoning-capable models
Common mistakes
- assuming the server remembers earlier turns automatically
- replaying too much old context and inflating token cost
- dropping tool or reasoning items that the next turn still depends on