A team is implementing tool use (function calling) with Claude to enable a database query tool. Claude returns a tool_use content block. What must the implementation include to correctly complete the agentic loop?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — the correct agentic loop for tool use requires sending a new messages request that includes: (1) the original conversation history, (2) the assistant's response containing the tool_use content block exactly as returned by the API, and (3) a new user message with a tool_result content block containing the tool_use_id and the tool's output. This multi-turn structure allows Claude to see both its tool call and the result before generating its final response.
Full explanation below image
Full Explanation
The correct agentic loop for tool use requires sending a new messages request that includes: (1) the original conversation history, (2) the assistant's response containing the tool_use content block exactly as returned by the API, and (3) a new user message with a tool_result content block containing the tool_use_id and the tool's output. This multi-turn structure allows Claude to see both its tool call and the result before generating its final response. Option B is wrong — tool results are sent as user role messages, not assistant. Option C is incorrect — there is no separate tool result endpoint; all interaction goes through the Messages API. Option D (system prompt injection) loses the structured tool use/result relationship that Claude's training expects and produces unreliable behavior.