Principle:Cohere ai Cohere python Tool Result Submission
| Property | Value |
|---|---|
| Type | Principle |
| Domain | Tool Use, Conversation Management, Agentic Patterns |
| Source | Cohere Python SDK |
| Last Updated | 2026-02-15 |
| Implemented By | Implementation:Cohere_ai_Cohere_python_ToolMessageV2_Model |
Overview
A messaging pattern for sending tool execution results back to the language model to continue the conversation.
Description
Tool Result Submission is the process of appending tool execution results to the conversation history and sending it back to the model. After executing tool functions, the results are wrapped in ToolChatMessageV2 (role="tool") messages with the matching tool_call_id. The conversation is then re-sent to the chat API with the full history: original user message, assistant message with tool_calls, and tool result messages. The model uses these results to generate a final text response.
Usage
After executing tool functions, create ToolChatMessageV2 for each result. Include the assistant's tool_call message in the history. Send the complete conversation back to client.chat().
- Execute the tool functions locally using the parsed arguments
- Wrap each result in a ToolChatMessageV2 with the corresponding tool_call_id
- Include the assistant's original message (with tool_calls) in the conversation history
- Re-send the full message list to the chat API for the model to synthesize a response
Theoretical Basis
This implements the observation phase of the ReAct loop. The tool_call_id matching ensures correct association between calls and results in multi-tool scenarios. The full conversation replay provides the model with complete context for synthesizing a final response.
- Multi-tool scenarios require explicit ID matching to avoid ambiguity
- Conversation replay maintains the full reasoning chain for the model
- The tool role distinguishes execution results from user or assistant messages