> ## 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.

# Team Streaming Metrics

> Capture metrics from team streaming responses.

Capture metrics from team streaming responses. Use yield\_run\_output=True to receive a TeamRunOutput at the end of the stream.

```python team_streaming_metrics.py theme={null}
"""
Team Streaming Metrics
=============================

Demonstrates how to capture metrics from team streaming responses.
Use yield_run_output=True to receive a TeamRunOutput at the end of the stream.
"""

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.run.team import TeamRunOutput
from agno.team import Team
from rich.pretty import pprint

# ---------------------------------------------------------------------------
# Create Members
# ---------------------------------------------------------------------------
assistant = Agent(
    name="Assistant",
    model=OpenAIChat(id="gpt-5.6-luna"),
    role="Helpful assistant that answers questions.",
)

# ---------------------------------------------------------------------------
# Create Team
# ---------------------------------------------------------------------------
team = Team(
    name="Streaming Team",
    model=OpenAIChat(id="gpt-5.6-luna"),
    members=[assistant],
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run Team (Streaming)
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    response = None
    for event in team.run("Count from 1 to 5.", stream=True, yield_run_output=True):
        if isinstance(event, TeamRunOutput):
            response = event

    if response and response.metrics:
        print("=" * 50)
        print("STREAMING TEAM METRICS")
        print("=" * 50)
        pprint(response.metrics)

        print("=" * 50)
        print("MODEL DETAILS")
        print("=" * 50)
        if response.metrics.details:
            for model_type, model_metrics_list in response.metrics.details.items():
                print(f"\n{model_type}:")
                for model_metric in model_metrics_list:
                    pprint(model_metric)
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno openai
```

**2. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

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

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

Full source: [cookbook/03\_teams/22\_metrics/02\_team\_streaming\_metrics.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/03_teams/22_metrics/02_team_streaming_metrics.py)


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