This example demonstrates how to create a team with knowledge base integration. The team has access to a knowledge base with Agno documentation and can combine this knowledge with web search capabilities.
"""This example demonstrates how to create a team with knowledge base integration.The team has access to a knowledge base with Agno documentation and can combinethis knowledge with web search capabilities."""from pathlib import Pathfrom agno.agent import Agentfrom agno.knowledge.embedder.openai import OpenAIEmbedderfrom agno.knowledge.knowledge import Knowledgefrom agno.models.openai import OpenAIChatfrom agno.team import Teamfrom agno.tools.duckduckgo import DuckDuckGoToolsfrom agno.vectordb.lancedb import LanceDb, SearchType# Setup paths for knowledge storagecwd = Path(__file__).parenttmp_dir = cwd.joinpath("tmp")tmp_dir.mkdir(parents=True, exist_ok=True)# Initialize knowledge base with vector databaseagno_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"), ),)# Add content to knowledge baseagno_docs_knowledge.add_content(url="https://docs.agno.com/llms-full.txt")# Create web search agent for supplementary informationweb_agent = Agent( name="Web Search Agent", role="Handle web search requests", model=OpenAIChat(id="gpt-5-mini"), tools=[DuckDuckGoTools()], instructions=["Always include sources"],)# Create team with knowledge base integrationteam_with_knowledge = Team( name="Team with Knowledge", members=[web_agent], model=OpenAIChat(id="gpt-5-mini"), knowledge=agno_docs_knowledge, show_members_responses=True, markdown=True,)if __name__ == "__main__": team_with_knowledge.print_response("Tell me about the Agno framework", stream=True)