Description:
Instrument tool calling to track tool invocations, arguments, and results.
Detailed Requirements:
- Add spans for tool operations:
tool.call - Tool invocation
- Add attributes:
tool.name - Name of the tool being called
tool.arguments_hash - Hash of arguments (for privacy)
tool.status - success/error
- Add span events for:
- Tool call start with argument summary (redacted)
- Tool call completion with result summary
- Tool call error with exception details
- Handle tool call extraction from model responses
- Track multiple tool calls in single response
Files to Modify:
mellea/stdlib/tools/interpreter.py - Tool execution instrumentation
mellea/backends/tools.py - Tool call extraction
mellea/helpers/openai_compatible_helpers.py - OpenAI tool handling
Span Hierarchy Example:
backend.request
├── [model returns tool calls]
└── tool.call (tool_1)
└── [tool execution]
└── tool.call (tool_2)
└── [tool execution]
Acceptance Criteria:
Description:
Instrument tool calling to track tool invocations, arguments, and results.
Detailed Requirements:
tool.call- Tool invocationtool.name- Name of the tool being calledtool.arguments_hash- Hash of arguments (for privacy)tool.status- success/errorFiles to Modify:
mellea/stdlib/tools/interpreter.py- Tool execution instrumentationmellea/backends/tools.py- Tool call extractionmellea/helpers/openai_compatible_helpers.py- OpenAI tool handlingSpan Hierarchy Example:
Acceptance Criteria: