Team with Knowledge Base

Combine a team-level LanceDB knowledge search with a web-search member.

Attach Agno documentation to the team and give one member a web-search tool.

from pathlib import Path

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

cwd = Path(__file__).parent
tmp_dir = cwd.joinpath("tmp")
tmp_dir.mkdir(parents=True, exist_ok=True)

agno_docs_knowledge = Knowledge(
    vector_db=LanceDb(
        uri=str(tmp_dir.joinpath("lancedb")),
        table_name="agno_docs",
        search_type=SearchType.hybrid,
        embedder=OpenAIEmbedder(id="text-embedding-3-small"),
    ),
)

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

team_with_knowledge = Team(
    name="Team with Knowledge",
    members=[web_agent],
    model=OpenAIResponses(id="gpt-5-mini"),
    knowledge=agno_docs_knowledge,
    show_members_responses=True,
    markdown=True,
)

if __name__ == "__main__":
    agno_docs_knowledge.insert(url="https://docs.agno.com/llms-full.txt")
    team_with_knowledge.print_response("Tell me about the Agno framework", stream=True)

Usage

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno lancedb openai ddgs

Set environment variables

export OPENAI_API_KEY=your_openai_api_key_here

Run the team

python team_with_knowledge.py

Next Steps

TaskGuide
Give members separate knowledge tablesDistributed RAG with LanceDB
Store distributed knowledge in PostgreSQLDistributed RAG with PgVector
Review team-level knowledge behaviorTeams with Knowledge