Output Schema
This example shows how to use the output_model parameter to specify the model that will be used to generate the final response.
1"""2Output Schema3=============================45This example shows how to use the output_model parameter to specify the model that will be used to generate the final response.6"""78from kern.agent import Agent9from kern.models.openai import OpenAIResponses10from kern.tools.websearch import WebSearchTools1112# ---------------------------------------------------------------------------13# Create Agent14# ---------------------------------------------------------------------------15agent = Agent(16 model=OpenAIResponses(id="gpt-5.2"),17 output_model=OpenAIResponses(id="gpt-5-mini"),18 tools=[WebSearchTools()],19)2021# ---------------------------------------------------------------------------22# Run Agent23# ---------------------------------------------------------------------------24if __name__ == "__main__":25 agent.print_response("Latest news from France?", stream=True)Run the Example
1# Clone and setup repo2git clone https://github.com/kern-ai/kern.git3cd kern/cookbook/02_agents/02_input_output45# Create and activate virtual environment6./scripts/demo_setup.sh7source .venvs/demo/bin/activate89python output_schema.py