The tool-use loop

Step through how an application and a model trade messages to use tools, and switch on failures to see how the loop copes.

AdvancedExplained in Models that use tools

The tool-use loop, one step at a time

A scripted run of the loop an application drives. No live model is called; the control flow is the real thing.

Steps

Conversation so far, sent in full on every model call

Tools offeredget_weather(city: string)calculator(expression: string)
  1. Instructions

    You can call tools. Reply with a tool call or a final answer.

  2. User

    What's the temperature right now in the city where the Eiffel Tower is, in Fahrenheit?

6
Model calls so far0 of 6 allowed
Messages in the conversation2
OutcomeRunning

Try this

  • Step through a normal run and note who acts at each step: the model only ever writes messages.
  • Turn on the landmark error and watch the model use the error message to correct itself.
  • Lower the step limit until the program stops the loop before an answer.

The model responses are scripted for teaching; the loop, the message formats, and the failure handling mirror how real tool-using applications work.

Try "embedding", "softmax", "overfitting", or "backpropagation".