Team Reliability with Stock Tools
Example showing how to evaluate team reliability with real-world tools like stock price lookup.
Paused runs include requirements on the TeamRunOutput.
Create a Python file
1from typing import Optional23from kern.agent import Agent4from kern.eval.reliability import ReliabilityEval, ReliabilityResult5from kern.models.openai import OpenAIResponses6from kern.run.team import TeamRunOutput7from kern.team.team import Team8from kern.tools.yfinance import YFinanceTools910team_member = Agent(11 name="Stock Searcher",12 model=OpenAIResponses(id="gpt-5.2"),13 role="Searches the web for information on a stock.",14 tools=[YFinanceTools(stock_price=True)],15)1617team = Team(18 name="Stock Research Team",19 model=OpenAIResponses(id="gpt-5.2"),20 members=[team_member],21 markdown=True,22 show_members_responses=True,23)2425expected_tool_calls = [26 "delegate_task_to_member", # Tool call used to delegate a task to a Team member27 "get_current_stock_price", # Tool call used to get the current stock price of a stock28]293031def evaluate_team_reliability():32 response: TeamRunOutput = team.run("What is the current stock price of NVDA?")33 evaluation = ReliabilityEval(34 name="Team Reliability Evaluation",35 team_response=response,36 expected_tool_calls=expected_tool_calls,37 )38 result: Optional[ReliabilityResult] = evaluation.run(print_results=True)39 if result:40 result.assert_passed()414243if __name__ == "__main__":44 evaluate_team_reliability()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 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 reliability_team_advanced.py