Repository navigation
feat(server-utils): Emit execute_tool spans for Anthropic's beta.sessions.events.toolRunner() - #25554
Open
RulaKhaled wants to merge 1 commit into
Open
RulaKhaled wants to merge 1 commit into
RulaKhaled wants to merge 1 commit into
Conversation
…ions.events.toolRunner() `beta.sessions.events.toolRunner()` runs the user's tools for a Managed Agents session, but its tool calls got no span. The runner turns a throw into an error result for the model, so nobody saw a failing tool either. #25320 only covered `beta.messages.toolRunner()`. The session runner calls the same `run(input, ctx)` as the messages runner and keeps its tools on a public `tools` field, so this reuses the wrapping from #25320. It has no `addTools()`, so it can only run the tools it was created with. On the orchestrion path the hook sits on the `SessionToolRunner` constructor instead of `toolRunner()`, because the SDK's `EnvironmentWorker` creates runners with `new SessionToolRunner()` directly. `instrumentAnthropicAiClient` can only wrap `toolRunner()`, so it doesn't see those runners. Supported from SDK 0.97.0, the first version with the session runner. Fixes #25446 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
Collaborator
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit da32a71. Configure here.
RulaKhaled
marked this pull request as ready for review
October 20, 2026 12:59
RulaKhaled
requested review from
JPeer264 and
isaacs
and removed request for
a team
October 20, 2026 12:59
This branch has not been deployed
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.
beta.sessions.events.toolRunner()runs the user's tools for a Managed Agents session, but its tool calls got no span. The runner turns a throw into an error result for the model, so nobody saw a failing tool either. #25320 only coveredbeta.messages.toolRunner().The session runner calls the same
run(input, ctx)as the messages runner and keeps its tools on a publictoolsfield, so this reuses the wrapping from #25320. It has noaddTools(), so it can only run the tools it was created with. On the orchestrion path the hook sits on theSessionToolRunnerconstructor instead oftoolRunner(), because the SDK'sEnvironmentWorkercreates runners withnew SessionToolRunner()directly.instrumentAnthropicAiClientcan only wraptoolRunner(), so it doesn't see those runners. Supported from SDK 0.97.0, the first version with the session runner.Known limitation. A tool that stops on the session runner's 120s timeout is recorded as cancelled, like a user abort, because the SDK aborts the same signal for both.
Fixes #25446
🤖 Generated with Claude Code