Run the agent and return when complete.
Same augmented shape as generateText: result, cost, merged sources.
Optionaloptions: OutputAgentGenerateParametersRun the agent over streaming transport and return a completed response.
onChunk runs as parts arrive. Provider and transport errors reject with the mapped error.
Use Agent.stream when you need onEnd / onError stream observers.
Optionaloptions: OutputAgentGenerateWithStreamingParametersStream the agent's response.
onEnd receives WrappedStreamTextOnEndEvent (result, cost, sources), matching streamText.
Optionaloptions: OutputAgentStreamParameters
Agent wraps an internal AI SDK ToolLoopAgent with Output.ai prompt loading and validation.
Example: Workflow step - variables per call, stateless
Example: Interactive - fixed setup, message history