Tool-response loop

The tool-response loop chains the exchanges: the model requests a tool, the application runs it and returns the result, then the model answers or requests another tool. It stops when the model produces a final answer or a step limit is reached.

Example

while step < MAX_STEPS:
    rep = model(messages)
    if not rep.tool_calls: break

Related concepts

The whole glossary