Title: feat(server-utils): Parent the tool spans of an Anthropic session runner under one span per session · Issue #25768 · getsentry/sentry-javascript · GitHub
Open Graph Title: feat(server-utils): Parent the tool spans of an Anthropic session runner under one span per session · Issue #25768 · getsentry/sentry-javascript
X Title: feat(server-utils): Parent the tool spans of an Anthropic session runner under one span per session · Issue #25768 · getsentry/sentry-javascript
Description: #25554 gives each tool call of a Managed Agents session runner an execute_tool span, but nothing parents them. When EnvironmentWorker drives the runners from its own poll loop (lib/environments/worker.mjs, for await (const _ of runner)),...
Open Graph Description: #25554 gives each tool call of a Managed Agents session runner an execute_tool span, but nothing parents them. When EnvironmentWorker drives the runners from its own poll loop (lib/environments/wor...
X Description: #25554 gives each tool call of a Managed Agents session runner an execute_tool span, but nothing parents them. When EnvironmentWorker drives the runners from its own poll loop (lib/environments/wor...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25768
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(server-utils): Parent the tool spans of an Anthropic session runner under one span per session","articleBody":"#25554 gives each tool call of a Managed Agents session runner an `execute_tool` span, but nothing parents them. When `EnvironmentWorker` drives the runners from its own poll loop (`lib/environments/worker.mjs`, `for await (const _ of runner)`), no user span is active, so every tool call becomes its own root segment. The `agent.tool_use` event has no session id and tool objects are shared across runners, so the spans can't be tied back to a session either. The same happens when `beta.sessions.events.toolRunner()` is iterated outside a span.\n\nAnthropic's own OTel tracing already groups them. `EnvironmentWorker` runs each work item inside an `anthropic.environment.work` span that carries `anthropic.session.id`, and the session runner parents its tool spans to the context active when its loop starts. We could do the same: start one span per runner and set `gen_ai.conversation.id` from `runner.sessionId`, so its tool spans nest under it.\n\nOpen questions:\n- Which op and name the span should have, and whether `invoke_agent` fits a session runner.\n- Where to start it. The tool calls run from the runner's background loop, which begins on the first `next()`, not when `[Symbol.asyncIterator]()` is called.\n- How a span that lasts a whole session (hours, with reconnects and idle waits) behaves under span streaming.\n- What happens when the user already has a span active around the loop.\n\nFollow-up to #25554, raised in review by @isaacs.\n","author":{"url":"https://github.com/RulaKhaled","@type":"Person","name":"RulaKhaled"},"datePublished":"2026-10-27T15:49:00Z","url":"https://github.com/getsentry/sentry-javascript/issues/25768"}
| 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:e71b93ad-b8ac-f64b-c218-f236989748bc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84CA:72891:1548DF7:1C4AE3A:6B0412C0 |
| html-safe-nonce | a80c1ef17aa3f95f1266f2e99dc69ec468216b8c0b6e1988654aff2cc799e5a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NENBOjcyODkxOjE1NDhERjc6MUM0QUUzQTo2QjA0MTJDMCIsInZpc2l0b3JfaWQiOiI4NTU0NTA4NzA3MTA1NjA4Mzg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 60b4ad4ee6fe546ddc1c5f6e209c4cf39130303af881801201ad92a7036dbea0 |
| hovercard-subject-tag | issue:6062696948 |
| 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/25768/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ef31af677f515860eccd9a86fad753d86b03e4473dedd1f2791bb4428774c50b/getsentry/sentry-javascript/issues/25768 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ef31af677f515860eccd9a86fad753d86b03e4473dedd1f2791bb4428774c50b/getsentry/sentry-javascript/issues/25768 |
| og:image:alt | #25554 gives each tool call of a Managed Agents session runner an execute_tool span, but nothing parents them. When EnvironmentWorker drives the runners from its own poll loop (lib/environments/wor... |
| 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 | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| 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