Claude With Amazon Bedrock
← All lessons
Lesson 31Claude With Amazon Bedrock

Sending tool results

Summary audio

Spoken summary — press play to read along: the line being spoken stays near the top.

Study notes

Key Concepts: Integrating Tool Results into Conversation History

  • Goal: To successfully execute a tool and provide the results back to the LLM (Claude) for a final response.
  • Tool Result Integration:
  • The output from running tools (the "tool result parts") must be added to the conversation history.
  • These results are added as a new user message within the message list.
  • Required Message Flow: The final conversation history must contain the following sequence:
  • Original User Message (The initial request).
  • Assistant Message (Containing the tool use request).
  • User Message (Containing the tool result responses).
  • Final API Call Requirement: When sending the complete list of messages to Claude for the final response, the original tool schemas must be included.
  • Importance of Schemas: Including the tool schemas ensures Claude understands the definitions and parameters of the tools it is calling, preventing confusion and ensuring correct interpretation of the tool use request.
  • Verification: A successful integration allows the system to retrieve specific, real-time data (like the current time) that the LLM does not inherently possess.

Takeaways

  • Tool results must be integrated into the conversation history as a new user message.
  • The required message flow is: Original User Message → Assistant Tool Use Request → User Tool Result.
  • Original tool schemas must be included in the final API call to ensure Claude correctly interprets tool definitions.
  • Successful integration allows the LLM to retrieve specific, real-time data it does not inherently possess.
Flashcards 7 cards
Question
click to reveal · ←/→
Answer
click to flip back
Export to Anki (.tsv) ↓
Knowledge check 5 questions