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

# Knowledge Tool Team

> Give a team leader KnowledgeTools over a LanceDB knowledge base of a Paul Graham essay.

```python knowledge_tool_team.py theme={null}
"""
Knowledge Tool Team
===================

Demonstrates this reasoning cookbook example.
"""

from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.models.openai import OpenAIChat
from agno.team.team import Team
from agno.tools.knowledge import KnowledgeTools
from agno.tools.websearch import WebSearchTools
from agno.vectordb.lancedb import LanceDb, SearchType


# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
def run_example() -> None:
    agno_docs = Knowledge(
        # Use LanceDB as the vector database and store embeddings in the `agno_docs` table
        vector_db=LanceDb(
            uri="tmp/lancedb",
            table_name="agno_docs",
            search_type=SearchType.hybrid,
        ),
    )
    # Add content to the knowledge
    agno_docs.insert(url="https://www.paulgraham.com/read.html")

    knowledge_tools = KnowledgeTools(
        knowledge=agno_docs,
        enable_think=True,
        enable_search=True,
        enable_analyze=True,
        add_few_shot=True,
    )

    web_agent = Agent(
        name="Web Search Agent",
        role="Handle web search requests",
        model=OpenAIChat(id="gpt-4o-mini"),
        tools=[WebSearchTools()],
        instructions="Always include sources",
        add_datetime_to_context=True,
    )

    finance_agent = Agent(
        name="Finance Agent",
        role="Handle financial data requests",
        model=OpenAIChat(id="gpt-4o-mini"),
        tools=[WebSearchTools(enable_news=False)],
        add_datetime_to_context=True,
    )

    team_leader = Team(
        name="Reasoning Finance Team",
        model=OpenAIChat(id="gpt-4o"),
        members=[
            web_agent,
            finance_agent,
        ],
        tools=[knowledge_tools],
        instructions=[
            "Only output the final answer, no other text.",
            "Use tables to display data",
        ],
        markdown=True,
        show_members_responses=True,
        add_datetime_to_context=True,
    )

    def run_team(task: str):
        team_leader.print_response(
            task,
            stream=True,
            show_full_reasoning=True,
        )

    if __name__ == "__main__":
        run_team("What does Paul Graham talk about the need to read in this essay?")


# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    run_example()
```

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno beautifulsoup4 ddgs lancedb openai pyarrow
    ```
  </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 `knowledge_tool_team.py`, then run:

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

Full source: [cookbook/10\_reasoning/teams/knowledge\_tool\_team.py](https://github.com/agno-agi/agno/blob/main/cookbook/10_reasoning/teams/knowledge_tool_team.py)
