Skip to content

Python: tool_call_args_match accepts missing null-valued arguments #8558

Closed

Description

Description

tool_call_args_match reports a match when an expected argument has value None but the actual tool call omits that key. The documented subset match requires every expected key-value pair to be present. This can make LocalEvaluator approve a call that used a default argument instead of explicitly passing null.

Code Sample

from agent_framework import Content, EvalItem, ExpectedToolCall, Message, tool_call_args_match

item = EvalItem(
    conversation=[
        Message("assistant", [Content.from_function_call("call_weather", "get_weather", arguments={"location": "NYC"})])
    ],
    expected_tool_calls=[ExpectedToolCall("get_weather", {"location": "NYC", "units": None})],
)
print(tool_call_args_match(item).passed)  # True; expected False because units is absent.

Error Messages / Stack Traces

Package Versions

agent-framework-core 1.19.0; reproduced on main at 7232569.

Python Version

Python 3.12.14 on Windows.

Additional Context

The same result occurs with JSON-string arguments. Explicit "units": null should still match, and unrelated extra arguments should remain allowed.

The subset check uses actual_args.get(k) == v, which treats an absent key like a present null value. I plan to add an explicit key-presence check and regression coverage for dictionary and JSON-string arguments.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Sep 20, 2026
  2. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Sep 20, 2026
  3. github-actions commented on Sep 20, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    The defect is in python/packages/core/agent_framework/_evaluation.py::tool_call_args_match at line 1224. It occurs when an expected argument has value None but the actual dictionary or parsed JSON object omits that key. Minimal repro: expect {"location": "NYC", "units": None} and evaluate a tool call containing only {"location": "NYC"}; the matcher incorrectly returns passed=True.

    • Failing test: python/packages/core/tests/core/test_local_eval.py
    • Files examined: python/packages/core/agent_framework/_evaluation.py, python/packages/core/tests/core/test_local_eval.py, python/packages/core/pyproject.toml
    • Tests run: TestToolCallArgsMatch, TestToolCallArgsMatch::test_missing_null_valued_arg_does_not_match
    • Reported version: 1.19.0
    • Current version: 1.19.0
  4. added
    agentsUsage: [Issues, PRs], Target: Single agent
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions