Skip to main content
Pass stream=True to receive the validated result through the Agent streaming interface.

Code

structured_output_stream.py
Agno 2.7.2 sets stream_model_response=False when an Agent has output_schema, parse_response=True, and no parser model. Claude completes one non-streaming request. Agno validates it and then emits one TravelPlan result through the Agent streaming interface. Use a standard run() for direct access to the validated object. This buffered path has the same model, schema, refusal, max_tokens, citation, and message-prefill constraints as non-streaming structured output.

Usage

1

Set up your virtual environment

2

Install dependencies

3

Export your Anthropic API key

4

Run the agent

Save the code above as structured_output_stream.py, then run:

Developer Resources