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

# Wiki Context Provider: Sub-Agent Event Streaming

> When the parent agent calls a context provider's query tool, the sub-agent's events (tool calls, content) are streamed back automatically.

When the parent agent calls a context provider's query tool, the sub-agent's events (tool calls, content) are streamed back automatically. This is the context-provider equivalent of Team's delegate\_task\_to\_member.

```python wiki_streaming_events.py theme={null}
"""
Wiki Context Provider — Sub-Agent Event Streaming
==================================================

When the parent agent calls a context provider's query tool, the
sub-agent's events (tool calls, content) are streamed back automatically.
This is the context-provider equivalent of Team's delegate_task_to_member.

Run with `stream=True` and the UI sees sub-agent activity in real-time.

Requires: OPENAI_API_KEY
"""

from __future__ import annotations

import asyncio
import shutil
from pathlib import Path

from agno.agent import Agent
from agno.context.wiki import FileSystemBackend, WikiContextProvider
from agno.models.openai import OpenAIResponses

WIKI_PATH = Path(__file__).resolve().parent / "demo-wiki"
if WIKI_PATH.exists():
    shutil.rmtree(WIKI_PATH)
WIKI_PATH.mkdir()
(WIKI_PATH / "README.md").write_text(
    "# Demo Wiki\n\nA tiny wiki for testing sub-agent streaming.\n"
)
(WIKI_PATH / "architecture.md").write_text(
    "# Architecture\n\n"
    "The system uses a three-tier architecture:\n"
    "1. Frontend (React)\n"
    "2. API (FastAPI)\n"
    "3. Database (PostgreSQL)\n"
)

wiki = WikiContextProvider(
    id="wiki",
    backend=FileSystemBackend(path=WIKI_PATH),
    model=OpenAIResponses(id="gpt-5.4-mini"),
)

agent = Agent(
    model=OpenAIResponses(id="gpt-5.4"),
    tools=wiki.get_tools(),
    instructions=wiki.instructions(),
    markdown=True,
)


async def main() -> None:
    print(f"\nwiki.status() = {wiki.status()}\n")

    prompt = "What is our system architecture? List the tiers."
    print(f"> {prompt}\n")
    await agent.aprint_response(prompt, stream=True)


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 notion-client openai
    ```
  </Step>

  <Step title="Export your API keys">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export NOTION_API_KEY="your_notion_api_key_here"
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:NOTION_API_KEY="your_notion_api_key_here"
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

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

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

Full source: [cookbook/12\_context/22\_wiki\_streaming\_events.py](https://github.com/agno-agi/agno/blob/main/cookbook/12_context/22_wiki_streaming_events.py)
