Appendix FFor builders
Under the hood: a tool call
A tool call is two short messages: the model's request, and the result the harness sends back, tied together by an ID. Here they are in two companies' formats.
Chapter 10 walks through the agent loop in plain words. This page shows what actually passes between the model and the harness at steps 3 and 6, using the made-up budget-file example. The shapes follow each company's documentation; the ID, the file and the numbers are made up.
Anthropic. The model's request is a tool_use block with an id, the tool's name and its input. Your software runs the tool and answers with a tool_result that names the same ID.1 Anthropic's documentation puts it plainly: "The model never runs anything on its own."2
The request (step 3)
{
"type": "tool_use",
"id": "toolu_01A2…",
"name": "search_files",
"input": { "query": "Q3 budget" }
}The result (step 6)
{
"type": "tool_result",
"tool_use_id": "toolu_01A2…",
"content": "Q3-budget.xlsx: travel 18% over plan; software 4% under"
}OpenAI. The request is a function_call with a call_id; the arguments arrive as a string of JSON. Your application runs the code and answers with a function_call_output carrying the matching call_id.3
The request (step 3)
{
"type": "function_call",
"call_id": "call_9xQ…",
"name": "search_files",
"arguments": "{\"query\": \"Q3 budget\"}"
}The result (step 6)
{
"type": "function_call_output",
"call_id": "call_9xQ…",
"output": "Q3-budget.xlsx: travel 18% over plan; software 4% under"
}Why it matters. The result goes back as plain text in the context. A web page or file the tool returns can contain instructions, which is why harnesses treat tool output as data, not orders, and why permission prompts matter (Chapter 10).4
Back to the plain version: Chapter 10, the agent loop.
Notes (4)
- 1Anthropic, “Handle tool calls,” Claude Platform Docs, https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls (accessed October 26, 2026).
- 2Anthropic, “How tool use works,” Claude Platform Docs, https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works (accessed October 26, 2026).
- 3OpenAI, “Function calling,” OpenAI API docs, https://developers.openai.com/api/docs/guides/function-calling (accessed October 26, 2026).
- 4Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, and Mario Fritz, “Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection,” in Proceedings of the 16th ACM Workshop on Artificial Intelligence and Security (November 30, 2023), 79–90, https://doi.org/10.1145/3605764.3623985.
Appendix F · page 3 of 3
Turn pages with the ← and → keys.