Title: feat(server-utils): Emit `execute_tool` spans for Anthropic's `beta.messages.toolRunner()` · Issue #25288 · getsentry/sentry-javascript · GitHub
Open Graph Title: feat(server-utils): Emit `execute_tool` spans for Anthropic's `beta.messages.toolRunner()` · Issue #25288 · getsentry/sentry-javascript
X Title: feat(server-utils): Emit `execute_tool` spans for Anthropic's `beta.messages.toolRunner()` · Issue #25288 · getsentry/sentry-javascript
Description: 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, thr...
Open Graph Description: 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 ...
X Description: 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...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25288
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(server-utils): Emit `execute_tool` spans for Anthropic's `beta.messages.toolRunner()`","articleBody":"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()`.\n\nThe runner's chat calls already get spans. What's missing:\n- `execute_tool` spans\n- tool errors, which the runner catches and turns into an `is_error` tool result, so Sentry never sees them\n\nSince 0.129.0, `runToolsEagerly: true` starts tools while the reply is still streaming, so tool spans can overlap the chat span.\n\n**TODO**\n- [ ] Wrap each runnable tool's `run()` with a `gen_ai.execute_tool` span. Cover tools passed to `toolRunner()`, `addTools()`, and `setMessagesParams()`.\n- [ ] Set the span to error when `run()` throws. Decide whether to also capture the exception, since the model gets the error and may recover.\n- [ ] Do it on both paths: orchestrion and `instrumentAnthropicAiClient`.\n- [ ] Tests: multiple tool calls, eager and lazy, a tool that throws, an abort mid-stream, and an incomplete tool call (`max_tokens`).\n- [ ] Check that the AI agents views handle tool spans that overlap the chat span.\n","author":{"url":"https://github.com/RulaKhaled","@type":"Person","name":"RulaKhaled"},"datePublished":"2026-10-12T13:14:45Z","url":"https://github.com/getsentry/sentry-javascript/issues/25288"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3e18be50-298b-8001-a7bd-49c339dfd244 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9696:2F022B:4DD287:6C6D6E:6B0444AD |
| html-safe-nonce | 914f3e628564e4e0ebfb6835a9bdbaea170c0883c92032c9e79c128ad03f1640 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Njk2OjJGMDIyQjo0REQyODc6NkM2RDZFOjZCMDQ0NEFEIiwidmlzaXRvcl9pZCI6IjMwMzA4NzIxNzk2MzkzMzgxNTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fe81a9906d7824318754341dcfa76a866455933654fa46c703b94982612fd534 |
| hovercard-subject-tag | issue:5814366445 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25288/issue_layout |
| twitter:image | https://opengraph.githubassets.com/14c410942b0de8ae9ca1ca01ac22e4ddc44a747cbbb1bfe4856fd42475e98515/getsentry/sentry-javascript/issues/25288 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/14c410942b0de8ae9ca1ca01ac22e4ddc44a747cbbb1bfe4856fd42475e98515/getsentry/sentry-javascript/issues/25288 |
| og:image:alt | 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 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | RulaKhaled |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width