> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/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](/models/providers/native/anthropic/usage/structured-output).

## Usage

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U "agno[anthropic]"
    ```
  </Step>

  <Step title="Export your Anthropic API key">
    <CodeGroup>
      ```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"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the agent">
    Save the code above as `structured_output_stream.py`, then run:

    ```bash theme={null}
    python structured_output_stream.py
    ```
  </Step>
</Steps>

## Developer Resources

* [Non-streaming structured outputs](/models/providers/native/anthropic/usage/structured-output)
* [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)
