TOOLS = [{
"type": "function",
"name": "inspect_image",
"parameters": { ... }
}]
response = client.responses.create(
model="gpt-5",
input=items,
tools=TOOLS,
)
for call in response.tool_calls:
result = inspect_image(
call.arguments["path"],
call.arguments["question"],
)
items.extend([call, tool_result(call, result)])
Walkthrough mode
This is the key transition from chat to agency: the model can now ask the harness to do structured work.
Declare the tool
The schema tells the model what the tool is called and what arguments it expects.
Expose it to the model
Passing tools=TOOLS means the next response may include a tool call instead of only plain text.
Execute the requested action
The harness reads the arguments, runs the tool, and turns the outside world into an observation.
Feed the result back
The loop continues only after the tool result is appended and returned to the model.