Teams with Knowledge

Attach a knowledge base the team coordinator can search.

Pass knowledge to a team to register its search_knowledge_base 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.hackernews import HackerNewsTools
from agno.vectordb.lancedb import LanceDb

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",
        embedder=OpenAIEmbedder(id="text-embedding-3-small"),
    ),
)

hackernews_agent = Agent(
    name="HackerNews Agent",
    role="Search HackerNews for tech news",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[HackerNewsTools()],
    instructions=["Always include sources"],
)

team_with_knowledge = Team(
    name="Team with Knowledge",
    members=[hackernews_agent],
    model=OpenAIResponses(id="gpt-5.2"),
    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)
uv pip install -U agno lancedb openai

Before running, set OPENAI_API_KEY in the same shell:

export OPENAI_API_KEY="your-openai-api-key"

On Windows PowerShell, use $env:OPENAI_API_KEY = "your-openai-api-key".

The team coordinator can search the attached knowledge base and delegate other work to members. Team.search_knowledge defaults to True.

When multiple Knowledge instances share one vector database, set isolate_vector_search=True and give each data scope a distinct name in that shared vector table. Objects with the same name share a search scope, even if they use different contents databases.

Next Steps

TaskGuide
Add web search to a teamTeam with Knowledge Base
Give members separate knowledge basesDistributed RAG with LanceDB
Configure ingestion and retrievalKnowledge Overview