How it works
- Primary model generates response (Optionally feed this as intermediate response to the secondary model)
- Optional Secondary model processes intermediate response, formats and returns the final response
- Optionally, the final response can be further custom styled and validated
Model Selection
Design your agent based on three dimensions: Reasoning (Logic), Presentation (Style), and Structure (Schema).- Single model (
model): Select the ‘doer’ or ‘pipeline brain’ based on reasoning capability (for example, GPT-4o for complex tasks, Claude-3 for simple ones). - Single model with output refinement (
output_model): In single model pipeline, select the ‘formatter’ or ‘pipeline stylist’ based on formatting capability (for example, Claude Opus 4.5 for prose, GPT-5-mini for cost optimization). - Multi-model (
parser_model): Add a secondary model if the primary model is weaker or the output is not structured or needs refinement.(For example, with OpenAI/Anthropic, useparser_modelwith a smart model (for example, Claude 4.5 or later) to “fix” or “extract” desired output).
model: Mandatory, specifies the primary model to generate a responseoutput_schema: The schema to validate the response againstoutput_model: When using single model, if the model does not support structured output, use this to validate the responseoutput_model_prompt: Optional, used in conjunction withoutput_modelto specify additional custom formatting to refine outputparser_model: The secondary model used to further refine the intermediary response for better outcomesparser_model_prompt: Optional, used in conjunction withparser_modelto specify additional instructions to control theparser_modeloutput
Use cases
| Model Design | Use Case | Configuration |
|---|---|---|
| Single Model | Need better prose quality | output_model = Claude Opus 4.5 |
| Single Model | Need to reduce costs | output_model = GPT-5-mini |
| Single Model | Primary model lacks structured output or lacks desired formatting | parser_model = GPT-4o, output_schema = your desired schema, output_model = Claude Opus 4.5 |
| Single Model | Need custom formatting style | output_model = Claude Opus 4.5, output_model_prompt = your desired formatting instructions |
| Single Model | Simple structured data extraction | output_schema = your desired schema |
| Multi Model | Standard Agent | model = OpenAIResponses(id=“gpt-5.2”) |
| Multi Model | Strict JSON | model = OpenAIResponses(id=“gpt-5.2”) and output_schema = your desired schema |
| Multi Model | Strict JSON (Weak Model) | model = OpenAIResponses(id=“gpt-5.2”) and parser_model = GPT-4o and output_schema = your desired schema |
| Multi Model | Reasoning + Great Prose | model = OpenAIResponses(id=“gpt-5.2”) and output_model = Claude Opus 4.5 |
| Multi Model | Cost Efficient | model = OpenAIResponses(id=“gpt-5.2”) and output_model = GPT-5-mini |
Custom Output Style
output_model_prompt
Use output_model_prompt optionally whenever you use an output_model to set the style,
tone, and format for the final output. It replaces the default System Prompt for the specified output_model.
Default Behavior (if you don’t set
output_model_prompt):Without output_model_prompt, the
output_model will just summarize/rewrite the content in its default voice, which may not be what you want.When to use it:Use it to set the tone (Write a professional, executive summary), format (Format as technical documentation with code examples where relevant), or audience (Explain to a layman or ELI5) for the response.parser_model_prompt
The parser_model_prompt is optional. In most cases,the default system prompt works well for secondary model.
Use it optionally whenever you use a secondary parser_model to set the style, tone, and format for the final output.
Default Behavior (if you don’t set
parser_model_prompt):The specified parser_model
prompt defaults to: “You are tasked with creating a structured output from the provided user
message.” (or similar).When to use it:You only need to set this if the default extraction fails or
if you need to provide specific rules for how to extract the final output data (for example, “Extract
dates in YYYY-MM-DD format” or “Extract only the first 3 items”).Examples
| Use Case | Example |
|---|---|
| Better writing | Research with GPT-5.2, write with Claude Opus 4.5 |
| Cost optimization | Reason with DeepSeek, format with GPT-5-mini |
| Structured output | Use a model without native support, format with one that has it |
Better Writing
GPT-5.2 excels at research and tool use, but Claude Opus 4.5 produces better prose. Combine them:Cost Optimization
Use a capable but expensive model for complex reasoning, a cheaper model for formatting:Structured Output Support
Some models lack native structured output. Use an output model that supports it:Related
- Structured Output: Get validated Pydantic objects
- Structured Input: Pass validated input to agents