Reliability with Single Tool
Example showing how to assert an Agent is making the expected tool calls.
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.agent import RunOutput7from kern.tools.calculator import CalculatorTools8910def factorial():11 agent = Agent(12 model=OpenAIResponses(id="gpt-5.2"),13 tools=[CalculatorTools()],14 )15 response: RunOutput = agent.run("What is 10!?")16 evaluation = ReliabilityEval(17 name="Tool Call Reliability",18 agent_response=response,19 expected_tool_calls=["factorial"],20 )21 result: Optional[ReliabilityResult] = evaluation.run(print_results=True)22 result.assert_passed()232425if __name__ == "__main__":26 factorial()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-aiExport 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 basic.py