> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Structured Outputs with stream=True

> Use the Agent streaming interface with a Claude output schema and receive one validated result.

Pass `stream=True` to receive the validated result through the Agent streaming interface.

## Code

```python structured_output_stream.py theme={null}
from agno.agent import Agent
from agno.models.anthropic import Claude
from pydantic import BaseModel


class TravelPlan(BaseModel):
    destination: str
    days: int
    activities: list[str]


structured_output_agent = Agent(
    model=Claude(id="claude-sonnet-4-6"),
    description="You create concise travel plans.",
    output_schema=TravelPlan,
)

if __name__ == "__main__":
    structured_output_agent.print_response(
        "Plan a three-day trip to Kyoto.",
        stream=True,
    )
```

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](https://agno-v2.mintlify.site/models/providers/native/anthropic/usage/structured-output.md).

## Usage

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

```bash theme={null}
uv pip install -U "agno[anthropic]"
```

**2. Export your Anthropic API key**

```bash Mac/Linux theme={null}
export ANTHROPIC_API_KEY="your_anthropic_api_key_here"
```

```powershell Windows theme={null}
$Env:ANTHROPIC_API_KEY="your_anthropic_api_key_here"
```

**3. Run the agent**

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

```bash theme={null}
python structured_output_stream.py
```

## Developer Resources

* [Non-streaming structured outputs](https://agno-v2.mintlify.site/models/providers/native/anthropic/usage/structured-output.md)
* [Anthropic streaming](https://platform.claude.com/docs/en/build-with-claude/streaming)
* [Anthropic structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.