Team with Knowledge Tools
This is a team reasoning example with knowledge tools.
Tip
Enabling the knowledge option on the team leader helps optimize delegation and enhances multi-agent collaboration by selectively invoking deeper knowledge when required.
Add the following code to your Python file
1from kern.agent import Agent2from kern.knowledge.knowledge import Knowledge3from kern.models.openai import OpenAIResponses4from kern.team.team import Team5from kern.tools.hackernews import HackerNewsTools6from kern.tools.knowledge import KnowledgeTools7from kern.vectordb.lancedb import LanceDb, SearchType89agno_docs = Knowledge(10 # Use LanceDB as the vector database and store embeddings in the `agno_docs` table11 vector_db=LanceDb(12 uri="tmp/lancedb",13 table_name="agno_docs",14 search_type=SearchType.hybrid,15 ),16)17# Add content to the knowledge18agno_docs.insert(url="https://www.paulgraham.com/read.html")1920knowledge_tools = KnowledgeTools(21 knowledge=agno_docs,22 think=True,23 search=True,24 analyze=True,25 add_few_shot=True,26)2728web_agent = Agent(29 name="Web Search Agent",30 role="Handle web search requests",31 model=OpenAIResponses(id="gpt-5.2"),32 tools=[HackerNewsTools()],33 instructions="Always include sources",34 add_datetime_to_context=True,35)3637finance_agent = Agent(38 name="Finance Agent",39 role="Handle financial data requests",40 model=OpenAIResponses(id="gpt-5.2"),41 tools=[HackerNewsTools()],42 add_datetime_to_context=True,43)4445team_leader = Team(46 name="Reasoning Finance Team",47 model=OpenAIResponses(id="gpt-5.2"),48 members=[49 web_agent,50 finance_agent,51 ],52 tools=[knowledge_tools],53 instructions=[54 "Only output the final answer, no other text.",55 "Use tables to display data",56 ],57 markdown=True,58 show_members_responses=True,59 add_datetime_to_context=True,60)616263def run_team(task: str):64 team_leader.print_response(65 task,66 stream=True,67 show_full_reasoning=True,68 )697071if __name__ == "__main__":72 run_team("What does Paul Graham talk about the need to read in this essay?")Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateInstall dependencies
1uv pip install -U openai kern-ai ddgsExport your OpenAI API key
1export OPENAI_API_KEY="your_openai_api_key_here"1$Env:OPENAI_API_KEY="your_openai_api_key_here"Run Agent
1python knowledge_tool_team.py