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
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.
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.
Timeline (last 90 days)
After the fix, WorkflowAgent preserves assistant messages with empty text but carrying provider metadata as-is, ensuring the metadata is not truncated.
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).
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.
After the fix f3d7a10, WorkflowAgent's behavior is consistent with ToolLoopAgent.
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.
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.
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.
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.
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.
In WorkflowAgent, a tool call rejected by toolApproval receives an execution-denied tool result but does not pause the entire workflow.
26 more timeline events
All Facts (20)
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%VerifiedTemporal 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%UnverifiedAfter the fix, WorkflowAgent preserves assistant messages with empty text but carrying provider metadata as-is, ensuring the metadata is not truncated.
50%UnverifiedThis 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%UnverifiedAfter 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%UnverifiedBefore 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%UnverifiedAfter 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%UnverifiedAfter 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%UnverifiedIf 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%UnverifiedAfter the fix f3d7a10, WorkflowAgent's behavior is consistent with ToolLoopAgent.
50%UnverifiedBefore 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%UnverifiedThe 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%UnverifiedWorkflowAgent 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%UnverifiedWhen 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%UnverifiedSteps in WorkflowAgent.stream() results now carry the provider name and model ID of the model that was called.
50%UnverifiedWorkflowAgent'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%UnverifiedWorkflowAgent'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%UnverifiedIn WorkflowAgent, a tool call rejected by toolApproval receives an execution-denied tool result but does not pause the entire workflow.
50%UnverifiedWhen 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%UnverifiedWorkflowAgent 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%