Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mastra-ai/mastra/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Agent execution options control how agents process and respond to prompts. These options can be passed toagent.generate() and agent.stream() methods.
AgentExecutionOptions
Base execution options used by bothgenerate() and stream() methods in v2+ mode.
Type Parameters
The structured output type (when using structured output)
Properties
Optional instructions to override the agent’s default instructions
Additional tool sets that can be used for this execution
Client-side tools for user confirmation workflows
Additional context messages to include
Memory options for this execution
Unique ID for this execution run
Maximum number of steps allowed for execution
Controls how tools are selected during execution
RequestContext for dependency injection
Scorers to use for this execution
Whether to return the input required to run scorers for agents
Whether to save messages incrementally on step finish
Input processors to use for this execution (overrides agent’s default)
Output processors to use for this execution (overrides agent’s default)
Maximum number of times processors can trigger a retry. Overrides agent’s default maxProcessorRetries.
Tracing options for starting new traces
Provider-specific options for supported AI SDK packages (Anthropic, Google, OpenAI, xAI)
Configuration for structured output generation
Callbacks
Callback fired after each execution step completes
Callback fired when execution completes
Callback fired for each stream chunk (streaming only)
Callback fired when an error occurs
Callback fired when execution is aborted
Advanced Options
Signal to abort the execution
Observability context for tracing
Temperature parameter for controlling randomness
Top-p sampling parameter
Frequency penalty parameter
Presence penalty parameter
Maximum tokens in the completion
Random seed for deterministic generation
AgentGenerateOptions (Legacy)
Legacy options for thegenerateLegacy() method.
Type Parameters
Schema type for structured output
Schema type for experimental structured output generation alongside tool calls
Properties
Includes all properties fromAgentExecutionOptions plus:
Schema for structured output (does not work with tools, use experimental_output instead)
Schema for structured output generation alongside tool calls
AgentStreamOptions (Legacy)
Legacy options for thestreamLegacy() method.
Type Parameters
Schema type for structured output
Schema type for experimental structured output generation alongside tool calls
Properties
Includes all properties fromAgentExecutionOptions plus:
Schema for structured output
Experimental schema for structured output
Temperature parameter for controlling randomness
NetworkOptions
Options for multi-agent network execution via thenetwork() method.
Properties
Maximum number of network iterations
Routing configuration for agent selection
Completion detection configuration
Callback fired after each network iteration