LayaEval logoLayaEval/Agent Checks/Tool Selection Correctness
AG-006Agent · Using toolslayaeval.ToolSelectionCorrectness

Tool Selection Correctness

Was the tool the agent picked the right one?

TASKFind a hotel in ParisSearchCalculatorEmailPicked the right tool
Simulation state:
When it passes

Right tool.

Threshold satisfied: evaluation score >= 0.50.

When it fails

Wrong tool.

Violation detected: execution flagged for human review or fallback routing.

SDK Specification

ParameterValueDescription
ClassToolSelectionCorrectnessPython evaluator class in layaeval
Required Fields"task", "tool_definition", "selected_tool"Arguments expected in the call signature
Default Threshold>= 0.50Passes when quality score is at or above this value
CategoryAgent EvaluationUsing tools (Right tool, right inputs, results actually used.)

Python Example

pip install layaeval
tool-selection-correctness.py
1from layaeval import ToolSelectionCorrectness
2
3metric = ToolSelectionCorrectness(threshold=0.50) # passes at or above 0.50
4
5res = metric(
6 task="Book a hotel in Paris for 2 guests on Mar 4.",
7 tool_definition="search_hotels(city: str, date: str, guests: int)",
8 selected_tool="search_hotels",
9)
10
11print(res.passed, res.value, res.confidence)

Related Agent Checks

Other checks in Using tools

View all 42 checks →