Skip to content

feat: sync DurableAgent with latest workflow repo changes#13774

Merged
gr2m merged 2 commits intogr2m/durable-agentfrom
gr2m/durable-agent-sync-workflow
Mar 23, 2026
Merged

feat: sync DurableAgent with latest workflow repo changes#13774
gr2m merged 2 commits intogr2m/durable-agentfrom
gr2m/durable-agent-sync-workflow

Conversation

@gr2m
Copy link
Copy Markdown
Collaborator

@gr2m gr2m commented Mar 23, 2026

Summary

Syncs DurableAgent code with changes from vercel/workflow since PR #12165 was opened (Jan 30, 2026). Key workflow PRs incorporated:

  • #1362 — AI SDK v6 migration, compat tests
  • #1385 — Various compatibility fixes
  • #1389 — Fix prepareStep system message lost when messages also returned
  • #1329 — Client-side tools support

Changes

  • Telemetry: Add recordSpan wrapper around model.doStream() with OTel span attributes (provider, model, generation settings). New telemetry.ts module with lazy OTel API loading.
  • normalizeFinishReason: Handle both v5 string ('stop') and v6 object ({ unified: 'stop', raw: 'stop' }) finish reason formats
  • prepareStep ordering fix: Apply messages override before system so the system message isn't lost when messages replaces the prompt
  • Generic DurableAgentOptions<TTools>: Tools and toolChoice properly typed through the generic parameter
  • Constructor prepareStep: New field on DurableAgentOptions for default step preparation across all stream() calls
  • TelemetrySettings: Add recordInputs/recordOutputs options
  • Type helpers: Export InferDurableAgentTools and InferDurableAgentUIMessage
  • sendStart docs: Explain when to set false (custom pre-stream UIMessageChunks)
  • Telemetry threading: Pass telemetry settings through to executeTool calls

Test plan

  • pnpm type-check — zero production code errors
  • pnpm check — lint passes
  • pnpm build in packages/durable-agent — builds
  • pnpm test:node in packages/durable-agent — 60 passed, 22 expected fail (same as before)

Sync changes from vercel/workflow packages/ai/src/agent since Jan 30
(PR #12165 creation date):

- Add telemetry support via recordSpan wrapper around model.doStream()
  and new telemetry.ts module with OTel span recording
- Add normalizeFinishReason for cross-version compatibility (v5 string
  vs v6 { unified, raw } object)
- Fix prepareStep ordering: messages applied before system so system
  message isn't lost when messages replaces the prompt (#1389)
- Make DurableAgentOptions generic: tools/toolChoice properly typed
- Add prepareStep to DurableAgentOptions constructor for default
  step preparation across all stream() calls
- Add TelemetrySettings.recordInputs/recordOutputs options
- Add InferDurableAgentTools/InferDurableAgentUIMessage type helpers
- Update sendStart docstring explaining when to set false
- Pass telemetry through to executeTool calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tigent tigent Bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. maintenance CI, internal documentation, automations, etc labels Mar 23, 2026
AI SDK v5 support is not needed. Use finishReason.unified directly
instead of the normalizeFinishReason wrapper that handled both v5
string and v6 object formats.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gr2m gr2m merged commit f741eb4 into gr2m/durable-agent Mar 23, 2026
12 of 16 checks passed
@gr2m gr2m deleted the gr2m/durable-agent-sync-workflow branch March 23, 2026 20:52
gr2m added a commit that referenced this pull request Mar 24, 2026
## Summary

Syncs DurableAgent code with changes from
[vercel/workflow](https://github.com/vercel/workflow/tree/main/packages/ai/src/agent)
since PR #12165 was opened (Jan 30, 2026). Key workflow PRs
incorporated:

- [#1362](vercel/workflow#1362) — AI SDK v6
migration, compat tests
- [#1385](vercel/workflow#1385) — Various
compatibility fixes
- [#1389](vercel/workflow#1389) — Fix
prepareStep system message lost when messages also returned
- [#1329](vercel/workflow#1329) — Client-side
tools support

## Changes

- **Telemetry**: Add `recordSpan` wrapper around `model.doStream()` with
OTel span attributes (provider, model, generation settings). New
`telemetry.ts` module with lazy OTel API loading.
- **`normalizeFinishReason`**: Handle both v5 string (`'stop'`) and v6
object (`{ unified: 'stop', raw: 'stop' }`) finish reason formats
- **prepareStep ordering fix**: Apply `messages` override before
`system` so the system message isn't lost when messages replaces the
prompt
- **Generic `DurableAgentOptions<TTools>`**: Tools and toolChoice
properly typed through the generic parameter
- **Constructor `prepareStep`**: New field on `DurableAgentOptions` for
default step preparation across all `stream()` calls
- **`TelemetrySettings`**: Add `recordInputs`/`recordOutputs` options
- **Type helpers**: Export `InferDurableAgentTools` and
`InferDurableAgentUIMessage`
- **`sendStart` docs**: Explain when to set `false` (custom pre-stream
UIMessageChunks)
- **Telemetry threading**: Pass telemetry settings through to
`executeTool` calls

## Test plan

- [x] `pnpm type-check` — zero production code errors
- [x] `pnpm check` — lint passes
- [x] `pnpm build` in packages/durable-agent — builds
- [x] `pnpm test:node` in packages/durable-agent — 60 passed, 22
expected fail (same as before)

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. maintenance CI, internal documentation, automations, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant