Implement WorkflowAgent telemetry support#15078
Merged
Merged
Conversation
Adds `runtimeContext` and `toolsContext` to `WorkflowAgent.stream` and constructor options, plus `telemetry.includeRuntimeContext` and `telemetry.includeToolsContext` for telemetry filtering. Tools receive their own validated entry from `toolsContext` as `context` (validated against `tool.contextSchema` when defined). The legacy `experimental_context` is kept as a fallback when no `toolsContext` entry is set.
…ntext and toolsContext The previous `experimental_context` option (and corresponding fields on `PrepareStepInfo`, `PrepareStepResult`, `PrepareCallOptions`, `WorkflowAgentOptions`, `WorkflowAgentStreamOptions`, and `onFinish`) is removed. Shared agent state now lives on `runtimeContext`; per-tool values are passed through `toolsContext`, validated against `tool.contextSchema` when defined.
Wire `runtimeContext` and `toolsContext` through the next-workflow example app, validate per-tool context with `contextSchema`, and use `telemetry.includeRuntimeContext` / `telemetry.includeToolsContext` to scope what's exposed to telemetry. Update the WorkflowAgent docs to cover both APIs and add a migration note from `experimental_context`.
…s-context # Conflicts: # content/docs/03-agents/07-workflow-agent.mdx
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
lgrammel
approved these changes
May 8, 2026
# Conflicts: # packages/workflow/src/workflow-agent.ts
Contributor
|
🚀 Published in:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Implements stable telemetry support for
WorkflowAgentas tracked in #15074.Summary
Adds WorkflowAgent telemetry integrations, focused coverage, a Next Workflow e2e harness, and a patch changeset for
@ai-sdk/workflow.Manual Verification
/telemetryroute in workflow-agent example (examples/next-workflow/app/telemetry/page.tsx)Screen.Recording.2026-05-07.at.1.22.24.PM.mov
Run Locally
Start DevTools from the example workspace:
Open http://localhost:4983 to inspect captured telemetry.
In a second terminal, run the Workflow example:
cd examples/next-workflow pnpm devOpen http://localhost:3000/telemetry and run the scenarios from the sidebar.
Checklist
pnpm changesetin the project root)Related Issues
Closes #15074