WEBVTT

NOTE AI Engineering Visualised: https://understandingdata.com/ai-engineering-visualised/tool-calling-round-trip/

1
00:00:00.070 --> 00:00:12.067
A language model can only write text, so when a customer asks where order A-1042 is and when it will arrive, the model has no way to look it up by itself.

2
00:00:12.067 --> 00:00:25.663
So instead of answering, it writes a tool call that fits the schema you gave it: a small card naming get_order_status with the order id A-1042, and its reply text is empty.

3
00:00:25.663 --> 00:00:39.301
The card crosses to your application, and it is your code, not the model, that parses the arguments string, checks the id, reads the order table, and gets back shipped with DPD, arriving 14 September.

4
00:00:39.301 --> 00:00:53.174
Only when that result goes back into the conversation as a tool message with the same call id does the model write the answer: your order A-1042 has shipped via DPD and should arrive on 14 September.

5
00:00:53.174 --> 00:01:03.156
Here is the first failure mode: stop after the first turn, and the customer gets an empty reply, because that turn was only a tool call.

6
00:01:03.156 --> 00:01:14.231
Worse, send the result back empty, and the model does not report an error: it tells the customer it could not find an order that shipped two days ago.

7
00:01:14.231 --> 00:01:26.398
Errors travel the same road: a customer types A-1402, your code returns order not found, and the model turns that into a request to double-check the number, which is exactly right.

8
00:01:26.398 --> 00:01:38.894
Cancelling shows who is in charge: the model asks to cancel A-1042, your code refuses because it has shipped, so validate every call on your side and always send the result back.
