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

# Followups: Streaming

> Stream the main response token-by-token and capture followup suggestions via events at the end.

```python followup_suggestions_streaming.py theme={null}
"""
Followups — Streaming
=====================

Stream the main response token-by-token and capture followup suggestions
via events at the end.

Key concepts:
- stream=True, stream_events=True: enables streaming with events
- RunEvent.run_content: tokens of the main response
- RunEvent.followups_completed: carries the finished followup suggestions
"""

import asyncio

from agno.agent import Agent, RunEvent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses

db = SqliteDb(db_file="tmp/agents.db")

# ---------------------------------------------------------------------------
# Create the Agent
# ---------------------------------------------------------------------------
agent = Agent(
    model=OpenAIResponses(id="gpt-4o"),
    instructions="You are a knowledgeable assistant. Answer questions thoroughly.",
    session_id="test-session",
    followups=True,
    num_followups=3,
    markdown=True,
    db=db,
    add_history_to_context=True,
)


# ---------------------------------------------------------------------------
# Stream the response and capture followups from events
# ---------------------------------------------------------------------------
async def main():
    content_started = False
    async for event in agent.arun(
        "Which national park is the best?",
        stream=True,
        stream_events=True,
    ):
        # Stream response tokens
        if event.event == RunEvent.run_content:
            if not content_started:
                print("Response:")
                print("=" * 60)
                content_started = True
            if event.content:
                print(event.content, end="", flush=True)

        # Followups arrive as a single completed event
        if event.event == RunEvent.followups_completed:
            print(f"\n\n{'=' * 60}")
            print("Followups:")
            print("=" * 60)
            if event.followups:  # type: ignore
                for i, suggestion in enumerate(event.followups, 1):  # type: ignore
                    print(f"  {i}. {suggestion}")

    print()


if __name__ == "__main__":
    asyncio.run(main())
```

## Run the Example

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

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

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

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

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

Full source: [cookbook/02\_agents/02\_input\_output/followup\_suggestions\_streaming.py](https://github.com/agno-agi/agno/blob/main/cookbook/02_agents/02_input_output/followup_suggestions_streaming.py)
