You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(server-utils): Emit execute_tool spans for Anthropic's beta.messages.toolRunner() #25288
Our Anthropic integration creates chat spans but no execute_tool spans. With .create() and .stream(), user code runs the tools, so we can't see them. beta.messages.toolRunner() is the one place in the SDK that calls tool code itself, through each tool's run().
The runner's chat calls already get spans. What's missing:
execute_tool spans
tool errors, which the runner catches and turns into an is_error tool result, so Sentry never sees them
Since 0.129.0, runToolsEagerly: true starts tools while the reply is still streaming, so tool spans can overlap the chat span.
TODO
Wrap each runnable tool's run() with a gen_ai.execute_tool span. Cover tools passed to toolRunner(), addTools(), and setMessagesParams().
Set the span to error when run() throws. Decide whether to also capture the exception, since the model gets the error and may recover.
Do it on both paths: orchestrion and instrumentAnthropicAiClient.
Tests: multiple tool calls, eager and lazy, a tool that throws, an abort mid-stream, and an incomplete tool call (max_tokens).
Check that the AI agents views handle tool spans that overlap the chat span.
Activity
linear-code commentedon Oct 12, 2026
JS-3916