Repository navigation
Open
Description
Problem Statement
Cloudflare's Codex agent loop example (changelog) runs the Codex turn loop in a plain DurableObject composed with the Agents SDK Lifecycle, Tasks, Sessions, and Streams capabilities. With @sentry/cloudflare 11.12.0 and sentryCloudflareVitePlugin, a turn runs and request, alarm, and error traces work. The agent loop itself does not show up in traces.
Observed running the example locally in workerd (agents 0.33.0, the example's offline StressModel, a turn with tool calls):
- No
gen_aispans. The harness callsmodel.doStream()on theLanguageModelV4directly, notstreamText/generateText, so the Vercel AI integration does not see model calls. Tools run inside the harness, so there are noexecute_toolspans either. With a real Workers AI binding,instrumentWorkersAiClientmay add bare chat spans (not verified). There would still be no agent or tool spans. - The turn is an anonymous alarm trace.
Tasksenqueues the turn and a Durable Object alarm runs it. The alarm trace links to the request that scheduled it (previous_trace), but nothing marks it as an agent run or shows its Task run and steps. - Lost segment when the object resets. When the Durable Object aborts mid-turn (
ctx.abort), the aborted alarm's child spans arrive without their parent alarm segment, and no error is recorded. The replayed run succeeds in a new alarm trace with nothing that ties it to the aborted attempt.
Solution Brainstorm
Starting points, not a design:
- Recognize
Lifecycle.install(this)Durable Objects and the Task runs and steps they execute, the wayinstrumentAgentWithSentrycoversAgentclasses and PiHarness is covered for pi-durable. - Capture model calls made through
LanguageModelV4.doStream/doGenerate, not only through theaihelpers.
Additional Context
Related: #16966, #18910, #24993
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
via Jan Peer Stöcklmair.
--
Activity
linear-code commentedon Nov 17, 2026
JS-4108