feat(telemetry): record tool call arguments in logfire spans - #368
Merged
Conversation
Add the tool call arguments (args dict) to observability spans so telemetry captures what parameters each tool was invoked with. - ToolInterceptCapability.wrap_tool_execute opens a 'tool.call' span with tool_name, tool_call_id, and the validated args dict — the unified interception layer for all tool sources (direct, MCP, ACP). - ToolDisplayCapability.wrap_tool_execute includes the same attributes on its existing instrumentation span. - Add regression test asserting the span carries tool_name, tool_call_id, and the full args dict. Previously the only tool instrumentation recorded the tool name without its parameters, leaving tool call arguments missing from telemetry. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tool call arguments were missing from telemetry: the only instrumentation on the tool execution path recorded the
tool_namebut not the parameters passed to the tool. This PR records the fullargsdict in logfire spans so every tool invocation exports its parameters.Changes
ToolInterceptCapability.wrap_tool_execute()— opens atool.calllogfire span carryingtool_name,tool_call_id, and the validatedargsdict. This is the unified interception layer for all tool sources (direct, MCP, ACP), so arguments are captured regardless of how the tool was registered.ToolDisplayCapability.wrap_tool_execute()— includes the same attributes on its existing instrumentation span (rich/diff display path).tool_name,tool_call_id, and the fullargsdict.changelog/unreleased/2026-08-11-tool-call-telemetry-args.md.Verification
ruff check+ruff formatcleanmypy --strictclean on changed source filesNotes
Args are written as a single span attribute (JSON-serialized by logfire). If per-argument structured attributes are desired for querying, that can be a follow-up.