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

# Knowledge Tools

> Agent thinks, searches, and analyzes over Agno docs stored in a LanceDB knowledge base.

```python knowledge_tools.py theme={null}
"""
Knowledge Tools
===============

Demonstrates this reasoning cookbook example.
"""

from agno.agent import Agent
from agno.knowledge.embedder.openai import OpenAIEmbedder
from agno.knowledge.knowledge import Knowledge
from agno.models.openai import OpenAIChat
from agno.tools.knowledge import KnowledgeTools
from agno.vectordb.lancedb import LanceDb, SearchType


# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
def run_example() -> None:
    # Create a knowledge containing information from a URL
    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,
            embedder=OpenAIEmbedder(id="text-embedding-3-small"),
        ),
    )
    # Add content to the knowledge
    agno_docs.insert(url="https://docs.agno.com/llms-full.txt")

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

    agent = Agent(
        model=OpenAIChat(id="gpt-4o"),
        tools=[knowledge_tools],
        markdown=True,
    )

    if __name__ == "__main__":
        agent.print_response(
            "How do I build a team of agents in agno?",
            markdown=True,
            stream=True,
        )


# ---------------------------------------------------------------------------
# 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 lancedb openai pyarrow
    ```
  </Step>

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

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

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

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

Full source: [cookbook/10\_reasoning/tools/knowledge\_tools.py](https://github.com/agno-agi/agno/blob/main/cookbook/10_reasoning/tools/knowledge_tools.py)
