get_order_status tool to answer.
The bot asks for the ID and email, looks the order up once it has them, and still knows the contents on the next turn because the history is kept. Here’s the whole thing.
The bot
How it works
- The
toolsarray describesget_order_statusto the model. It calls the tool only when it needs order data, and asks for the ID and email first when they’re missing. - The
replyloop runs the model, executes any tool call, feeds the result back, and repeats until the model returns plain text. That’s the standard tool round trip. - The whole conversation, including the system prompt and tool results, lives in
messages, so the bot remembers the order across turns. See Conversations. - Swap
modelfor any of the 300+ models without touching the rest of the code.
What’s next
Tool calling
The full tool-use round trip.
Conversations
Multi-turn chat and message history.
Guard
Block or redact sensitive content before it reaches the model.
Observe
Score every reply and watch quality over time.