ToolLoopAgent
An agent abstraction in the AI SDK for multi-step tool calling that schedules the loop between model and tools until the model no longer requests tools or the step limit is reached. It is oriented toward automatic looping within a single session.
Timeline (last 90 days)
After the fix f3d7a10, WorkflowAgent's behavior is consistent with ToolLoopAgent.
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.
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.
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.
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.
All Facts (5)
After the fix f3d7a10, WorkflowAgent's behavior is consistent with ToolLoopAgent.
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%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%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%UnverifiedToolLoopAgent 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.
50%