output_model to generate the final answer with a second model after the primary model handles the run.
How It Works
- The primary model processes the request and handles tool calls.
- Agno removes the primary model’s final assistant message from the run history.
output_modelgenerates a replacement response from the remaining history, including the user request and tool results.- If
parser_modelis configured, it parses that replacement intooutput_schema.
output_model receives the run history with the primary final response removed. Use parser_model when the next model must transform the generated content into a Pydantic object.Choose a Pipeline
Each secondary model adds a model call to the run.
Parameters
parser_model requires output_schema. Agno logs a warning and skips parsing when no schema is set.
Control the Output Model
output_model_prompt replaces the existing system message for the output-model call. Agno inserts it when the run history has no system message.
Parse into a Schema
The parser model receives the preceding model’s content as its user message.parser_model_prompt is unset. Set a custom prompt for extraction rules such as date formats, item limits, or field-specific constraints.
Combine Output and Parser Models
output_model runs before parser_model. The parser therefore structures the output model’s replacement response.