Basic Team
A team of AI agents working together to research topics.
A basic team with two specialized agents:
- HackerNews Researcher - Gets trending stories from HackerNews
- Finance Agent - Gets stock prices and financial data
The team leader coordinates by delegating to the appropriate agent based on the user's request.
Create a Python file
1from kern.agent import Agent2from kern.models.openai import OpenAIResponses3from kern.team.team import Team4from kern.tools.hackernews import HackerNewsTools5from kern.tools.yfinance import YFinanceTools67hn_researcher = Agent(8 name="HackerNews Researcher",9 model=OpenAIResponses(id="gpt-5.2"),10 role="Gets trending stories from HackerNews.",11 tools=[HackerNewsTools()],12)1314finance_agent = Agent(15 name="Finance Agent",16 model=OpenAIResponses(id="gpt-5.2"),17 role="Gets stock prices and financial data.",18 tools=[YFinanceTools()],19)2021team = Team(22 name="Research Team",23 model=OpenAIResponses(id="gpt-5.2"),24 members=[hn_researcher, finance_agent],25 instructions=[26 "Delegate to the HackerNews Researcher for tech news and trends.",27 "Delegate to the Finance Agent for stock prices and financial data.",28 "Synthesize the results into a clear summary.",29 ],30 markdown=True,31 show_members_responses=True,32)3334team.print_response(35 input="What are the top AI stories on HackerNews and how is NVDA doing?",36 stream=True37)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 kern-ai openai yfinanceExport your OpenAI API key
1export OPENAI_API_KEY="your_openai_api_key_here"1$Env:OPENAI_API_KEY="your_openai_api_key_here"Run Team
1python basic_team.py