[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes - #1608

Merged
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296
Apr 7, 2026
Merged

[ai] Fixes DurableAgent telemetry missing AI SDK-compatible span attributes#1608
VaguelySerious merged 5 commits into
mainfrom
peter/issue-1296

Conversation

@VaguelySerious

Copy link
Copy Markdown
Member

Summary

Closes#1296

DurableAgent created telemetry spans with correct names (ai.streamText.doStream, ai.toolCall) but was missing the response-time attributes that downstream OTel exporters like langfuse-vercel need to render rich traces. This PR adds full AI SDK telemetry attribute parity.

Changes

  • do-stream-step.ts: Restructured recordSpan to wrap the entire stream lifecycle (not just model.doStream()), so response attributes can be set after stream processing completes. Adds: ai.response.text, ai.response.finishReason, ai.response.id, ai.response.model, ai.usage.*, gen_ai.response.*, gen_ai.usage.*, timing attributes (msToFirstChunk, msToFinish, avgOutputTokensPerSecond), and input attributes (ai.prompt.messages, ai.prompt.tools, ai.prompt.toolChoice).
  • durable-agent.ts (executeTool): Records ai.toolCall.result on the tool call span after execution.
  • stream-text-iterator.ts: Adds outer ai.streamText span wrapping the full iteration with aggregated usage.
  • telemetry.ts: Adds createSpan/endSpan helpers for manual span lifecycle management (needed for generator functions), exports Span type.
  • All output-sensitive attributes (ai.response.text, ai.response.toolCalls, ai.toolCall.result) are gated on recordOutputs, and prompt attributes on recordInputs.

Test plan

  • 8 new telemetry-specific tests covering doStreamStep response attributes, tool call result recording, recordInputs/recordOutputs gating, reasoning/cache token emission, and outer span creation
  • All 165 existing tests pass
  • Build passes

🤖 Generated with Claude Code

… spans
Fixes the gap where DurableAgent created telemetry spans with correct
names but missing response-time attributes that downstream OTel exporters
(e.g. langfuse-vercel) need to render traces properly.
Changes:
- doStreamStep: wrap full stream lifecycle in span, add response attrs
(usage, finishReason, response text/id/model, timing, gen_ai.* attrs)
- executeTool: record ai.toolCall.result on span after execution
- streamTextIterator: add outer ai.streamText span with aggregated usage
- telemetry.ts: add createSpan/endSpan for manual span lifecycle, export Span type
- Input attributes gated on recordInputs, output on recordOutputs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-botBot commented Apr 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 464ce46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@workflow/aiPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercelBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

🧪 E2E Test Results

Some tests failed

Summary

PassedFailedSkippedTotal
✅ ▲ Vercel Production868067935
✅ 💻 Local Development84201781020
✅ 📦 Local Production84201781020
✅ 🐘 Local Postgres84201781020
✅ 🪟 Windows770885
❌ 🌍 Community Worlds1346424222
✅ 📋 Other213042255
Total3818646754557

❌ Failed Tests

🌍 Community Worlds (64 failed)

mongodb (4 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

redis (3 failed):

  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • resilient start: addTenWorkflow completes when run_created returns 500

turso (57 failed):

  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • addTenWorkflow | wrun_01KNJ78V53GHXPYXBKZ5SY8SS6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KNJ7A94GJFG2M3A8AFMBAQ3M
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KNJ793STDY5WNTWT3NVBCZ45
  • promiseRaceWorkflow | wrun_01KNJ7998XHEX78KTEN4EGPEEG
  • promiseAnyWorkflow | wrun_01KNJ79B90R046SC7EG3Q051GF
  • importedStepOnlyWorkflow | wrun_01KNJ7ANSTEKMCTDCHV261K0QX
  • hookWorkflow | wrun_01KNJ79RE0Y7KBY78RST44DKV1
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KNJ7A2TRSMQ5Q67334E73KQY
  • webhookWorkflow | wrun_01KNJ7ABGJF2R8V9S7YRZS6AKP
  • sleepingWorkflow | wrun_01KNJ7AJ881P09A4TQ7WVYG1A8
  • parallelSleepWorkflow | wrun_01KNJ7AYEE0QWRQY5R3M322TS3
  • nullByteWorkflow | wrun_01KNJ7B1TX9X9GJ9GC5B602RD6
  • workflowAndStepMetadataWorkflow | wrun_01KNJ7B3ZV09VSG2A0YAJV6NNH
  • fetchWorkflow | wrun_01KNJ7DPXTXNQW30KHGREGJQH1
  • promiseRaceStressTestWorkflow | wrun_01KNJ7DT3G4CKJZMVK75MSDB84
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KNJ7H5C9Q0F0P2Y49KYGEX45
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KNJ7HRPWQ0CEWZW832RB6T6M
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KNJ7JCSZHW6A2AYJA2A63W0H
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KNJ7K08EJ38C64C401K712Y4
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KNJ7K8AEFCG2N4MXFHX8JRYP
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KNJ7KDZ35DRX6Q6WN583MGAP
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KNJ7KG3WG7BH1BTB9HV1SZFV
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KNJ7KY3YHWDY8VYKHE6ZDB2C
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KNJ7M36HMH35JRHYTW3NFVJ1
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KNJ7MKWB17AY644SKENAS0TR
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KNJ7MTAC708X5X91H2WKN7H5
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KNJ7N0PT0F308YEJXTNE3SXZ
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KNJ7N6ZS80H9VJNQPJPH9KTJ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KNJ7NDGCBP6XKH1NN2G1GJZG
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KNJ7NQW7F93T17451S16KXNH
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KNJ7NZ4R0AJ3AYCZXNRVJJ15
  • cancelRun - cancelling a running workflow | wrun_01KNJ7P73N7QKP6GVCE1Q4EXV4
  • cancelRun via CLI - cancelling a running workflow | wrun_01KNJ7PFW0D0XC0GJKNR16C4JH
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KNJ7PVAPRQDQ6VHRCVGRGC3S
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KNJ7QECQ0A8QQPJJD8933F4T
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KNJ7QREHAXECA2GRCS04KCD0
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KNJ7R0RDAN3FC5D45ZTNEF4W
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KNJ7R2S0WDDCWJNH9Z31TXV9
  • resilient start: addTenWorkflow completes when run_created returns 500

Details by Category

✅ ▲ Vercel Production
AppPassedFailedSkipped
✅ astro7807
✅ example7807
✅ express7807
✅ fastify7807
✅ hono7807
✅ nextjs-turbopack8302
✅ nextjs-webpack8302
✅ nitro7807
✅ nuxt7807
✅ sveltekit7807
✅ vite7807
✅ 💻 Local Development
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 📦 Local Production
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🐘 Local Postgres
AppPassedFailedSkipped
✅ astro-stable71014
✅ express-stable71014
✅ fastify-stable71014
✅ hono-stable71014
✅ nextjs-turbopack-canary60025
✅ nextjs-turbopack-stable7708
✅ nextjs-webpack-canary60025
✅ nextjs-webpack-stable7708
✅ nitro-stable71014
✅ nuxt-stable71014
✅ sveltekit-stable71014
✅ vite-stable71014
✅ 🪟 Windows
AppPassedFailedSkipped
✅ nextjs-turbopack7708
❌ 🌍 Community Worlds
AppPassedFailedSkipped
✅ mongodb-dev500
❌ mongodb5748
✅ redis-dev500
❌ redis5838
✅ turso-dev500
❌ turso4578
✅ 📋 Other
AppPassedFailedSkipped
✅ e2e-local-dev-nest-stable71014
✅ e2e-local-postgres-nest-stable71014
✅ e2e-local-prod-nest-stable71014

📋 View full workflow run

@github-actions

github-actionsBot commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

📈 Comparing against baseline from main branch. Green 🟢 = faster, Red 🔺 = slower.

workflow with no steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Nitro0.042s (-3.0%)1.006s (~)0.964s101.00x
💻 LocalExpress0.042s (+1.4%)1.006s (~)0.964s101.00x
💻 LocalNext.js (Turbopack)0.049s1.005s0.957s101.16x
🌐 RedisNext.js (Turbopack)0.053s1.005s0.952s101.27x
🐘 PostgresNext.js (Turbopack)0.056s1.011s0.955s101.34x
🐘 PostgresExpress0.060s (-0.7%)1.009s (~)0.949s101.44x
🐘 PostgresNitro0.061s (-6.3% 🟢)1.009s (~)0.948s101.46x
workflow with 1 step

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)1.118s2.006s0.888s101.00x
🌐 RedisNext.js (Turbopack)1.122s2.006s0.885s101.00x
💻 LocalNitro1.126s (~)2.006s (~)0.880s101.01x
💻 LocalExpress1.135s (~)2.007s (~)0.872s101.01x
🐘 PostgresNitro1.146s (~)2.010s (~)0.864s101.02x
🐘 PostgresExpress1.147s (~)2.009s (~)0.862s101.03x
🐘 PostgresNext.js (Turbopack)1.149s2.009s0.860s101.03x
workflow with 10 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)10.765s11.023s0.258s31.00x
💻 LocalNext.js (Turbopack)10.779s11.023s0.245s31.00x
🐘 PostgresNext.js (Turbopack)10.924s11.352s0.428s31.01x
🐘 PostgresExpress10.924s (~)11.017s (~)0.093s31.01x
💻 LocalNitro10.962s (~)11.025s (~)0.063s31.02x
🐘 PostgresNitro10.962s (+0.7%)11.023s (~)0.060s31.02x
💻 LocalExpress10.972s (+0.6%)11.025s (~)0.052s31.02x
workflow with 25 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)14.215s15.028s0.813s41.00x
🐘 PostgresExpress14.531s (~)15.021s (~)0.490s41.02x
🐘 PostgresNext.js (Turbopack)14.546s15.024s0.478s41.02x
💻 LocalNext.js (Turbopack)14.681s15.027s0.346s41.03x
🐘 PostgresNitro14.707s (+1.4%)15.022s (~)0.315s41.03x
💻 LocalExpress15.038s (+0.7%)15.530s (+3.3%)0.492s41.06x
💻 LocalNitro15.053s (~)15.781s (+3.3%)0.728s41.06x
workflow with 50 sequential steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)13.474s14.024s0.550s71.00x
🐘 PostgresNext.js (Turbopack)13.840s14.024s0.184s71.03x
🐘 PostgresExpress14.145s (+1.5%)15.025s (+6.1% 🔺)0.880s61.05x
🐘 PostgresNitro14.297s (+2.3%)15.022s (+4.0%)0.726s61.06x
💻 LocalNext.js (Turbopack)15.983s16.529s0.546s61.19x
💻 LocalExpress16.787s (+1.1%)17.031s (~)0.244s61.25x
💻 LocalNitro16.855s (+0.7%)17.033s (~)0.178s61.25x
Promise.all with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.240s2.010s0.770s151.00x
🐘 PostgresNitro1.255s (-0.6%)2.010s (~)0.754s151.01x
🐘 PostgresExpress1.258s (-0.6%)2.010s (~)0.752s151.01x
🌐 RedisNext.js (Turbopack)1.281s2.006s0.725s151.03x
💻 LocalNext.js (Turbopack)1.507s2.006s0.499s151.22x
💻 LocalExpress1.538s (~)2.005s (~)0.467s151.24x
💻 LocalNitro1.543s (+1.1%)2.006s (~)0.463s151.24x
Promise.all with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro2.330s (~)3.010s (~)0.680s101.00x
🐘 PostgresExpress2.358s (+1.1%)3.009s (~)0.651s101.01x
🐘 PostgresNext.js (Turbopack)2.456s3.011s0.556s101.05x
🌐 RedisNext.js (Turbopack)2.542s3.008s0.465s101.09x
💻 LocalNext.js (Turbopack)2.874s3.343s0.469s91.23x
💻 LocalExpress2.902s (-3.9%)3.310s (-10.0% 🟢)0.408s101.25x
💻 LocalNitro3.077s (+5.3% 🔺)3.760s (+25.1% 🔺)0.683s81.32x
Promise.all with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.440s (~)4.009s (~)0.569s81.00x
🐘 PostgresExpress3.452s (-0.6%)4.010s (~)0.559s81.00x
🐘 PostgresNext.js (Turbopack)3.710s4.012s0.303s81.08x
🌐 RedisNext.js (Turbopack)4.147s4.582s0.435s71.21x
💻 LocalNext.js (Turbopack)7.892s8.519s0.627s42.29x
💻 LocalNitro8.274s (~)9.025s (~)0.751s42.40x
💻 LocalExpress8.483s (+5.4% 🔺)9.026s (+5.9% 🔺)0.543s42.47x
Promise.race with 10 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)1.224s2.010s0.785s151.00x
🐘 PostgresNitro1.257s (~)2.009s (~)0.751s151.03x
🐘 PostgresExpress1.275s (+1.8%)2.009s (~)0.735s151.04x
🌐 RedisNext.js (Turbopack)1.400s2.073s0.673s151.14x
💻 LocalNext.js (Turbopack)1.506s2.006s0.500s151.23x
💻 LocalNitro1.575s (~)2.007s (-3.2%)0.432s151.29x
💻 LocalExpress1.607s (+4.7%)2.006s (~)0.399s151.31x
Promise.race with 25 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express2.335s (~)3.011s (~)0.676s101.00x
🐘 PostgresNitro2.339s (~)3.009s (~)0.670s101.00x
🐘 PostgresNext.js (Turbopack)2.421s3.010s0.589s101.04x
🌐 RedisNext.js (Turbopack)2.554s3.007s0.453s101.09x
💻 LocalNext.js (Turbopack)2.800s3.209s0.409s101.20x
💻 LocalExpress3.117s (+0.8%)3.887s (~)0.769s81.34x
💻 LocalNitro3.192s (+4.4%)4.011s (+3.3%)0.820s81.37x
Promise.race with 50 concurrent steps

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro3.481s (~)4.011s (~)0.530s81.00x
🐘 PostgresExpress3.492s (~)4.011s (~)0.519s81.00x
🐘 PostgresNext.js (Turbopack)3.666s4.014s0.348s81.05x
🌐 RedisNext.js (Turbopack)4.109s4.868s0.759s71.18x
💻 LocalNext.js (Turbopack)8.434s9.020s0.586s42.42x
💻 LocalExpress9.732s (+12.7% 🔺)10.025s (+11.1% 🔺)0.293s32.80x
💻 LocalNitro10.050s (+12.1% 🔺)10.354s (+8.7% 🔺)0.304s32.89x
workflow with 10 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.686s1.004s0.319s601.00x
🐘 PostgresNext.js (Turbopack)0.786s1.006s0.220s601.15x
🐘 PostgresExpress0.827s (-1.1%)1.006s (~)0.179s601.21x
💻 LocalNext.js (Turbopack)0.834s1.021s0.187s591.22x
🐘 PostgresNitro0.840s (+1.0%)1.007s (~)0.167s601.22x
💻 LocalExpress0.998s (+1.6%)1.250s (+10.0% 🔺)0.252s491.46x
💻 LocalNitro1.095s (+10.6% 🔺)1.881s (+53.0% 🔺)0.787s321.60x
workflow with 25 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.634s2.006s0.371s451.00x
🐘 PostgresNext.js (Turbopack)1.945s2.125s0.180s431.19x
🐘 PostgresExpress1.972s (-1.4%)2.258s (-11.0% 🟢)0.287s401.21x
🐘 PostgresNitro2.050s (+4.5%)2.822s (+24.9% 🔺)0.772s321.25x
💻 LocalNext.js (Turbopack)2.657s3.041s0.384s301.63x
💻 LocalExpress3.018s (~)3.759s (+4.2%)0.740s241.85x
💻 LocalNitro3.274s (+7.5% 🔺)4.054s (+14.3% 🔺)0.780s232.00x
workflow with 50 sequential data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)3.358s4.008s0.650s301.00x
🐘 PostgresNext.js (Turbopack)3.921s4.183s0.262s291.17x
🐘 PostgresExpress4.092s (+2.2%)4.626s (~)0.533s261.22x
🐘 PostgresNitro4.301s (+8.6% 🔺)5.013s (+16.7% 🔺)0.712s241.28x
💻 LocalNext.js (Turbopack)8.564s9.017s0.452s142.55x
💻 LocalNitro9.207s (-0.6%)10.019s (~)0.811s122.74x
💻 LocalExpress9.217s (+0.8%)9.941s (+1.6%)0.725s132.74x
workflow with 10 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Next.js (Turbopack)0.249s1.007s0.758s601.00x
🌐 RedisNext.js (Turbopack)0.277s1.004s0.727s601.11x
🐘 PostgresNitro0.281s (+2.1%)1.007s (~)0.726s601.13x
🐘 PostgresExpress0.281s (+0.5%)1.007s (~)0.725s601.13x
💻 LocalNext.js (Turbopack)0.528s1.004s0.476s602.12x
💻 LocalNitro0.589s (-2.1%)1.005s (~)0.416s602.36x
💻 LocalExpress0.605s (+6.2% 🔺)1.004s (~)0.400s602.43x
workflow with 25 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Nitro0.484s (-0.6%)1.006s (~)0.522s901.00x
🐘 PostgresExpress0.498s (+0.7%)1.007s (~)0.509s901.03x
🐘 PostgresNext.js (Turbopack)0.499s1.007s0.508s901.03x
🌐 RedisNext.js (Turbopack)1.148s2.006s0.857s452.37x
💻 LocalNitro2.548s (~)3.009s (~)0.460s305.27x
💻 LocalExpress2.583s (+0.7%)3.009s (~)0.427s305.34x
💻 LocalNext.js (Turbopack)2.597s3.042s0.445s305.37x
workflow with 50 concurrent data payload steps (10KB)

💻 Local Development

WorldFrameworkWorkflow TimeWall TimeOverheadSamplesvs Fastest
🐘 Postgres🥇 Express0.794s (+1.6%)1.016s (+0.8%)0.222s1191.00x
🐘 PostgresNitro0.797s (+4.4%)1.008s (~)0.211s1201.00x
🐘 PostgresNext.js (Turbopack)0.814s1.016s0.203s1191.02x
🌐 RedisNext.js (Turbopack)2.662s3.007s0.345s403.35x
💻 LocalNext.js (Turbopack)10.530s11.209s0.679s1113.26x
💻 LocalNitro11.154s (-1.6%)11.848s (-1.5%)0.695s1114.05x
💻 LocalExpress11.469s (+2.8%)12.029s (+2.3%)0.560s1014.44x
Stream Benchmarks(includes TTFB metrics)
workflow with stream

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
💻 Local🥇 Next.js (Turbopack)0.168s1.003s0.012s1.017s0.850s101.00x
🌐 RedisNext.js (Turbopack)0.171s1.001s0.002s1.007s0.836s101.02x
🐘 PostgresNext.js (Turbopack)0.198s1.001s0.001s1.011s0.813s101.18x
🐘 PostgresExpress0.201s (-3.1%)0.999s (~)0.002s (~)1.009s (~)0.808s101.20x
💻 LocalExpress0.207s (+2.8%)1.004s (~)0.013s (+9.6% 🔺)1.019s (~)0.812s101.24x
🐘 PostgresNitro0.207s (-12.4% 🟢)0.995s (~)0.001s (-85.7% 🟢)1.011s (~)0.803s101.24x
💻 LocalNitro0.212s (+4.8%)1.004s (~)0.012s (+3.4%)1.018s (~)0.806s101.27x
stream pipeline with 5 transform steps (1MB)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.478s1.002s0.003s1.011s0.533s601.00x
🐘 PostgresExpress0.617s (+2.2%)1.006s (~)0.004s (-7.1% 🟢)1.022s (~)0.405s591.29x
🐘 PostgresNext.js (Turbopack)0.623s1.010s0.004s1.022s0.399s591.30x
🐘 PostgresNitro0.633s (+6.0% 🔺)1.004s (~)0.004s (-3.0%)1.022s (~)0.390s591.32x
💻 LocalNitro0.830s (+14.5% 🔺)1.012s (~)0.010s (+10.3% 🔺)1.116s (+9.1% 🔺)0.286s541.74x
💻 LocalExpress0.834s (+15.8% 🔺)1.030s (+2.0%)0.010s (+10.9% 🔺)1.136s (+11.1% 🔺)0.302s531.74x
💻 LocalNext.js (Turbopack)0.859s1.011s0.009s1.227s0.368s491.80x
10 parallel streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)0.899s1.035s0.000s1.039s0.139s581.00x
🐘 PostgresNext.js (Turbopack)0.938s1.154s0.000s1.162s0.223s521.04x
🐘 PostgresExpress0.949s (-2.0%)1.194s (-5.8% 🟢)0.000s (+Infinity% 🔺)1.209s (-6.0% 🟢)0.260s501.06x
🐘 PostgresNitro0.952s (~)1.225s (+11.1% 🔺)0.000s (-23.6% 🟢)1.255s (+12.3% 🔺)0.303s481.06x
💻 LocalNext.js (Turbopack)1.278s2.019s0.000s2.022s0.744s301.42x
💻 LocalNitro1.296s (+4.8%)2.023s (~)0.000s (-37.5% 🟢)2.024s (~)0.729s301.44x
💻 LocalExpress1.409s (+12.2% 🔺)2.021s (~)0.000s (-4.8%)2.202s (+8.8% 🔺)0.793s281.57x
fan-out fan-in 10 streams (1MB each)

💻 Local Development

WorldFrameworkWorkflow TimeTTFBSlurpWall TimeOverheadSamplesvs Fastest
🌐 Redis🥇 Next.js (Turbopack)1.595s2.035s0.000s2.039s0.445s301.00x
🐘 PostgresNitro1.708s (-10.1% 🟢)2.139s (-8.7% 🟢)0.000s (-100.0% 🟢)2.168s (-8.0% 🟢)0.460s281.07x
🐘 PostgresExpress1.800s (+3.9%)2.100s (~)0.000s (-100.0% 🟢)2.141s (+1.3%)0.342s291.13x
🐘 PostgresNext.js (Turbopack)1.829s2.181s0.000s2.188s0.359s281.15x
💻 LocalExpress3.549s (-1.6%)4.099s (~)0.000s (-50.0% 🟢)4.101s (~)0.552s152.23x
💻 LocalNext.js (Turbopack)3.613s4.098s0.000s4.101s0.488s152.27x
💻 LocalNitro3.756s (+8.6% 🔺)4.318s (+7.1% 🔺)0.000s (-59.8% 🟢)4.321s (+7.1% 🔺)0.565s142.36x

Summary

Fastest Framework by World

Winner determined by most benchmark wins

World🥇 Fastest FrameworkWins
💻 LocalNext.js (Turbopack)17/21
🐘 PostgresNext.js (Turbopack)11/21
Fastest World by Framework

Winner determined by most benchmark wins

Framework🥇 Fastest WorldWins
Express🐘 Postgres19/21
Next.js (Turbopack)🌐 Redis9/21
Nitro🐘 Postgres18/21
Column Definitions
  • Workflow Time: Runtime reported by workflow (completedAt - createdAt) - primary metric
  • TTFB: Time to First Byte - time from workflow start until first stream byte received (stream benchmarks only)
  • Slurp: Time from first byte to complete stream consumption (stream benchmarks only)
  • Wall Time: Total testbench time (trigger workflow + poll for result)
  • Overhead: Testbench overhead (Wall Time - Workflow Time)
  • Samples: Number of benchmark iterations run
  • vs Fastest: How much slower compared to the fastest configuration for this benchmark

Worlds:

  • 💻 Local: In-memory filesystem world (local development)
  • 🐘 Postgres: PostgreSQL database world (local development)
  • ▲ Vercel: Vercel production/preview deployment
  • 🌐 Turso: Community world (local development)
  • 🌐 MongoDB: Community world (local development)
  • 🌐 Redis: Community world (local development)
  • 🌐 Jazz: Community world (local development)

📋 View full workflow run

@karthikscale3karthikscale3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review

Comment threadpackages/ai/src/agent/telemetry.ts Outdated
options.attributes
);

return tracer.startSpan(options.name, { attributes: attrs });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review: startSpan here does not use otelApi.context.with() for parent context propagation, unlike recordSpan which calls context.active() + context.with(). This means spans created via createSpan won't automatically parent under the currently active span — they may appear as root spans in your trace tree instead of nesting under the caller's context.

If that's an intentional trade-off for generator/yield boundaries, worth adding a brief doc comment noting it. Otherwise, consider capturing otelApi.context.active() and using otelApi.trace.setSpan(ctx, span) to set the parent.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 663d33b. createSpan now captures the active context via otelApi.context.active() and passes it to tracer.startSpan(), so spans created for generator functions will correctly parent under the caller's span rather than appearing as root spans.

@VaguelySerious
VaguelySerious marked this pull request as ready for review April 3, 2026 22:39
@VaguelySerious
VaguelySerious requested a review from a team as a code ownerApril 3, 2026 22:39
Resolves merge conflict in stream-text-iterator.ts, keeping both
the telemetry outer span additions and main's reasoning preservation
changes. Also fixes createSpan to capture the active OTel context so
spans parent correctly in the trace tree (review feedback).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>

@TooTallNateTooTallNate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All issues from my previous review have been addressed across commits 0e608852 and 464ce463:

Blocking issues — both fixed:

  1. createSpan context propagationcreateSpan now returns a SpanHandle { span, context } where context = otelApi.trace.setSpan(parentCtx, span). New runInContext(handle, fn) wraps fn in otelApi.context.with(handle.context, fn). Both doStreamStep and executeTool calls are wrapped. The spanHandle is passed through the yield value to durable-agent.ts so tool execution across yield boundaries also parents correctly. The trace tree is now hierarchical:
ai.streamText
├── ai.streamText.doStream (via runInContext in streamTextIterator)
├── ai.streamText.doStream (second iteration)
└── ai.toolCall (via runInContext in durable-agent)
  1. Outer span error captureouterSpanError assignment moved from the inner per-step catch to an outer try/catch wrapping the entire generator body. Errors from the final yield, onStepFinish, or prepareStep are now captured on the span.

Non-blocking suggestions — all addressed:

  1. endSpan defensive try/catch — Now wraps recordErrorOnSpan in try and span.end() in a nested try/finally with catch. Exact pattern suggested.

  2. Redundant chunk iterationchunksToStep is now called before the telemetry block, and step.text/step.reasoningText are reused. No more double iteration.

  3. New test for runInContext integration — verifies that executeTool calls in durable-agent.ts are wrapped with the spanHandle from the iterator yield value.

LGTM.

@VaguelySerious
VaguelySerious merged commit 70e89bf into mainApr 7, 2026
101 of 105 checks passed
@VaguelySerious
VaguelySerious deleted the peter/issue-1296 branch April 7, 2026 18:00
@ghostghost mentioned this pull request Apr 7, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DurableAgent experimental_telemetry does not emit AI SDK spans for LLM or tool calls

3 participants

@VaguelySerious@TooTallNate@karthikscale3