while True: response = model(context) if response.has_tool_calls(): context += run_tools(response.tool_calls) else: break