0
Phase 11

Tool Evaluation

~3 min read

Concept & How It Works

    Why Does It Exist?

    Wrong tool calls cause real side effects — deleted records, wrong emails. Evaluating tool behavior isolates the riskiest failure mode in agentic systems.

    Real-World Analogy

    Tool eval is checking a surgeon picks the right instrument — a brilliant diagnosis means nothing if they grab a scalpel when they needed a suture.
    Loading diagram...

    Visual Workflows

    What is Tool Evaluation?

    Loading diagram...

    Example

    Scenario

    Query 'What's my balance?' should call `get_balance` not `transfer_funds` — eval flags 3/100 misfires on ambiguous phrasing.

    Solution

    In Agent Evaluation & Observability, apply Tool Evaluation to this scenario: Query 'What's my balance?' should call `get_balance` not `transfer_funds` — eval flags 3/100 misfires on ambiguous phrasing. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.

    Practice Task

    Do this before moving to the next module — reading alone is not enough.

    Open the Code Walkthrough below and run it locally. Change one parameter related to Tool Evaluation (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.

    Code Walkthrough

    Highlighted lines show where Tool Evaluation happens in the code.

    Tool Evaluation
    1def tool_selection_score(trace, expected_tool):  # define a reusable function2    actual = next(s for s in trace if s.type == "tool_call")  # key line for Tool Evaluation3    return actual.name == expected_tool  # return the result4
    5assert tool_selection_score(run("balance?"), "get_balance")  # key line for Tool Evaluation

    Commands to Remember

    Commands to Remember

    • pip install langsmith # trace and evaluate LLM runs
    • pip install arize-phoenix # open-source LLM observability
    • pip install opentelemetry-api opentelemetry-sdk # distributed tracing

    Common Mistakes

    • Treating Tool Evaluation as a black box without evaluation
    • Ignoring cost and latency in production
    • Skipping error handling for tool evaluation

    Cheat Sheet

    Quick recap — the most important points from this module.

    Cheat Sheet

    quick ref
    • Tool Evaluation
    • Argument F1
    • Spurious Calls
    • Function Calling Eval