Reliability with Multiple Tools
Example showing how to assert an Kern Agent is making multiple 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 multiply_and_exponentiate():11 agent = Agent(12 model=OpenAIResponses(id="gpt-5.2"),13 tools=[CalculatorTools(add=True, multiply=True, exponentiate=True)],14 )15 response: RunOutput = agent.run(16 "What is 10*5 then to the power of 2? do it step by step"17 )18 evaluation = ReliabilityEval(19 name="Tool Calls Reliability",20 agent_response=response,21 expected_tool_calls=["multiply", "exponentiate"],22 )23 result: Optional[ReliabilityResult] = evaluation.run(print_results=True)24 if result:25 result.assert_passed()262728if __name__ == "__main__":29 multiply_and_exponentiate()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 reliability_with_multiple_tools.py