Skip to content

feat: Add ignore_args option to tool trajectory evaluation#4795

Open
abhinavmaddineni wants to merge 3 commits intogoogle:mainfrom
abhinavmaddineni:abhinavmaddineni/eval-skip-arg-match
Open

feat: Add ignore_args option to tool trajectory evaluation#4795
abhinavmaddineni wants to merge 3 commits intogoogle:mainfrom
abhinavmaddineni:abhinavmaddineni/eval-skip-arg-match

Conversation

@abhinavmaddineni
Copy link

Summary

  • Adds ignore_args boolean field to ToolTrajectoryCriterion (defaults to False)
  • When True, trajectory evaluation compares only tool names, skipping argument matching
  • Works with all three match types: EXACT, IN_ORDER, ANY_ORDER

Closes #4794

Usage

{
  "tool_trajectory_avg_score": {
    "threshold": 0.8,
    "match_type": "IN_ORDER",
    "ignore_args": true
  }
}

Test plan

  • All 31 existing trajectory evaluator tests pass (no regressions)
  • 13 new tests covering ignore_args=True across all match types
  • Full test suite passes (4995 passed via scripts/unittests.sh --version 3.12)

Allow bypassing argument matching in trajectory evaluation by setting
ignore_args=True on ToolTrajectoryCriterion. Works with all match types
(EXACT, IN_ORDER, ANY_ORDER).

Closes google#4794
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the flexibility of tool trajectory evaluation by introducing an option to disregard tool arguments during the matching process. This allows for more lenient comparisons where only the sequence or presence of tool names is relevant, streamlining evaluation for scenarios that do not require strict argument fidelity.

Highlights

  • New Configuration Option: A new boolean field, ignore_args, has been added to ToolTrajectoryCriterion, defaulting to False.
  • Tool Trajectory Evaluation Logic: When ignore_args is set to True, the tool trajectory evaluation will compare only tool names, completely bypassing argument matching for all EXACT, IN_ORDER, and ANY_ORDER match types.
  • Comprehensive Testing: Thirteen new unit tests were introduced to specifically cover the ignore_args=True functionality across all matching types, ensuring no regressions and proper behavior.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/google/adk/evaluation/eval_metrics.py
    • Added the ignore_args boolean field with a default value of False to the ToolTrajectoryCriterion class, including a descriptive docstring.
  • src/google/adk/evaluation/trajectory_evaluator.py
    • Integrated the ignore_args property from ToolTrajectoryCriterion into the TrajectoryEvaluator's initialization.
    • Modified the _are_tool_calls_in_order_match, _are_tool_calls_any_order_match, and _are_tool_calls_exact_match methods to conditionally ignore tool arguments based on the _ignore_args flag.
  • tests/unittests/evaluation/test_trajectory_evaluator.py
    • Added a helper function _make_ignore_args_evaluator to simplify test setup for ignore_args scenarios.
    • Introduced multiple new test cases to verify the ignore_args functionality for EXACT, IN_ORDER, and ANY_ORDER match types, covering successful matches, failures due to name/order/count mismatches, and configuration via dictionary.
    • Included tests to confirm that ignore_args=False (the default) correctly enforces argument matching.
Activity
  • The author abhinavmaddineni initiated this pull request to add a new feature.
  • The pull request addresses and closes issue Add ignore_args option to tool trajectory evaluation #4794.
  • The author provided a clear summary, usage example, and a detailed test plan for the new feature.
  • The test plan confirms that all existing 31 trajectory evaluator tests pass, and 13 new tests specifically cover the ignore_args=True functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adk-bot adk-bot added the eval [Component] This issue is related to evaluation label Mar 12, 2026
@abhinavmaddineni
Copy link
Author

When evaluating agent tool trajectories, there are common cases where the exact arguments passed to tools are non-deterministic or simply irrelevant to what you're testing — e.g., generated search queries, timestamps, or complex objects with minor formatting differences. In these scenarios, the current evaluator produces false negatives because it enforces strict argument equality even when you only care that the agent called the right tools in the right sequence. This PR adds an ignore_args option so users can focus trajectory evaluation purely on tool selection strategy without being blocked by argument mismatches.

@abhinavmaddineni abhinavmaddineni marked this pull request as ready for review March 12, 2026 14:26
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an ignore_args option to the ToolTrajectoryCriterion, allowing for more flexible tool trajectory evaluations by comparing only tool names. The implementation is well-executed across all three match types (EXACT, IN_ORDER, ANY_ORDER), and the logic is sound. The addition of 13 new tests ensures comprehensive coverage for the new functionality. I have one minor suggestion to improve code maintainability by reducing some duplication.

@rohityan rohityan self-assigned this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eval [Component] This issue is related to evaluation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ignore_args option to tool trajectory evaluation

3 participants