[KongchangAI]
Product@ai-sdk/workflow

WorkflowAgent

A workflow orchestration module within the Vercel AI SDK ecosystem. It provides a WorkflowAgent abstraction that supports organizing AI capabilities into multi-step orchestrable workflows, making it suitable for complex task scenarios that require tool collaboration.

Core Facts

Timeline (last 90 days)

Nov 25

After the fix, WorkflowAgent preserves assistant messages with empty text but carrying provider metadata as-is, ensuring the metadata is not truncated.

Unverified50%
Nov 25

This 2.0.114 version fixes the issue where assistant messages with empty text but carrying provider metadata were dropped from WorkflowAgent response messages (corresponding to GitHub commit 8a75476).

Unverified50%
Nov 17

After the fix 7655f47, WorkflowAgent passes the tool metadata, dynamic flag, and title of server-side tool definitions to the toolApproval policy, both for newly initiated tool calls and for calls re-approved from message history replay.

Unverified50%
Nov 17

After the fix f3d7a10, WorkflowAgent's behavior is consistent with ToolLoopAgent.

Unverified50%
Nov 17

If a policy that progressively tightens permissions step by step uses the old context, subsequent steps will still be allowed according to the loose initial permissions, making the restrictions effectively useless.

Unverified50%
Nov 17

After the fix f3d7a10, WorkflowAgent passes the runtimeContext returned by prepareStep to that step's approval policy, instead of continuing to use the context from when the call started.

Unverified50%
Nov 17

Before the fix b3588dc, WorkflowAgent would pass assistant replies containing tool calls to the toolApproval approval function, causing the approval logic to see pending, rejected, and invalid sibling calls and treat them as completed history messages.

Unverified50%
Nov 17

After the fix b3588dc, the toolApproval approval function receives only the messages actually sent to the model in this step, excluding system messages and excluding the current response, aligning with the documented conventions of generateText and streamText.

Unverified50%
Nov 17

Before the fix, policies that rely on toolCall.toolMetadata to protect tools might directly allow calls, while policies that no longer require approval might still judge calls as pending approval.

Unverified50%
Nov 13

In WorkflowAgent, a tool call rejected by toolApproval receives an execution-denied tool result but does not pause the entire workflow.

Unverified50%

26 more timeline events

All Facts (20)

Verified

ToolLoopAgent is the agent abstraction in the AI SDK for multi-step tool calls, responsible for scheduling between the model and tools until the model no longer requests tools or the step limit is reached; WorkflowAgent targets persistable, orchestration-capable multi-step workflows, and the two share underlying mechanisms such as model calls and tool execution, but historically differ in edge-case behaviors such as approval, timeouts, and streaming aborts.

85%
Verified

Temporal abstracts workflows into persistent, resumable code execution units, so that even if a process crashes or a machine goes down, the workflow execution state can be saved and resumed from the point of interruption.

75%
Unverified

After the fix, WorkflowAgent preserves assistant messages with empty text but carrying provider metadata as-is, ensuring the metadata is not truncated.

50%
Unverified

This 2.0.114 version fixes the issue where assistant messages with empty text but carrying provider metadata were dropped from WorkflowAgent response messages (corresponding to GitHub commit 8a75476).

50%
Unverified

After the fix 7655f47, WorkflowAgent passes the tool metadata, dynamic flag, and title of server-side tool definitions to the toolApproval policy, both for newly initiated tool calls and for calls re-approved from message history replay.

50%
Unverified

Before the fix b3588dc, WorkflowAgent would pass assistant replies containing tool calls to the toolApproval approval function, causing the approval logic to see pending, rejected, and invalid sibling calls and treat them as completed history messages.

50%
Unverified

After the fix b3588dc, the toolApproval approval function receives only the messages actually sent to the model in this step, excluding system messages and excluding the current response, aligning with the documented conventions of generateText and streamText.

50%
Unverified

After the fix f3d7a10, WorkflowAgent passes the runtimeContext returned by prepareStep to that step's approval policy, instead of continuing to use the context from when the call started.

50%
Unverified

If a policy that progressively tightens permissions step by step uses the old context, subsequent steps will still be allowed according to the loose initial permissions, making the restrictions effectively useless.

50%
Unverified

After the fix f3d7a10, WorkflowAgent's behavior is consistent with ToolLoopAgent.

50%
Unverified

Before the fix, policies that rely on toolCall.toolMetadata to protect tools might directly allow calls, while policies that no longer require approval might still judge calls as pending approval.

50%
Unverified

The semantics of WorkflowAgent's prepareStep return value have been aligned: the returned instructions (or the deprecated system) replace the current step's instructions and propagate onward, providerOptions are merged with the agent options, and headers override the call's own headers.

50%
Unverified

WorkflowAgent supports experimental_refineToolInput in the constructor and per call, and the refined tool input is used for tool execution, step results, callbacks, and the next model call.

50%
Unverified

When the model calls an unknown tool or passes input that does not match the schema, WorkflowAgent's stream() now retains that tool call, marks it as invalid, and produces a tool-error part in the step, matching the behavior of generate() and ToolLoopAgent; the model still receives the error as the tool result.

50%
Unverified

Steps in WorkflowAgent.stream() results now carry the provider name and model ID of the model that was called.

50%
Unverified

WorkflowAgent's generate() and stream() now log warnings for each model call via the AI SDK warning logger, with output globally controlled by AI_SDK_LOG_WARNINGS; generate() also prints a warning when it stops at the default step limit.

50%
Unverified

WorkflowAgent's toolApproval configuration can be passed in the constructor or on each generate() or stream() call, and it takes precedence over the tool's own needsApproval setting.

50%
Unverified

In WorkflowAgent, a tool call rejected by toolApproval receives an execution-denied tool result but does not pause the entire workflow.

50%
Unverified

When WorkflowAgent is interrupted during a model step by an abort with a custom abort reason, it now calls onAbort instead of onError; generate() rejects with that reason, while stream() resolves with the completed steps as it does for aborts without a reason.

50%
Unverified

WorkflowAgent now uses the last value yielded by an async generator tool as the tool result, consistent with ToolLoopAgent; if the generator throws after yielding, a tool error is produced.

50%

Source Articles