Skip to content

Python: FoundryEvals always emits arguments field for tool calls - #7734

Merged
Evan Mattson (moonbox3) merged 2 commits into
microsoft:mainfrom
cr-sbarbouche:fix-foundry-evals-zero-arg-tool-calls
Aug 21, 2026
Merged

Python: FoundryEvals always emits arguments field for tool calls#7734
Evan Mattson (moonbox3) merged 2 commits into
microsoft:mainfrom
cr-sbarbouche:fix-foundry-evals-zero-arg-tool-calls

Conversation

@cr-sbarbouche

@cr-sbarbouche Sadok Barbouche (cr-sbarbouche) commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

AgentEvalConverter.convert_message only set the arguments field on a tool_call content item when the parsed arguments were truthy, so tool calls with no model-supplied arguments were uploaded without an arguments field at all. Foundry's tool-aware evaluators (task_adherence, tool_output_utilization, tool_call_accuracy) require every tool_call item to have an arguments field, even if empty, and fail with FAILED_EXECUTION otherwise. This contributes to the FoundryEvals evaluation scenario for agents with zero-argument tools.

Description & Review Guide

  • What are the major changes? python/packages/core/agent_framework/_evaluation.py: tc["arguments"] is now always set, defaulting to {} only when the parsed arguments are None (an explicit is not None check, not a truthiness check, so valid-but-falsy arguments like 0/""/False are preserved).
  • What is the impact of these changes? Zero-argument tool calls now serialize with "arguments": {} instead of omitting the key, matching what Foundry's evaluators require. No behavior change for tool calls that already had arguments.
  • What do you want reviewers to focus on? Whether defaulting to {} (vs. omitting the field) is the correct shape for all Foundry evaluators, and whether the is not None check should also apply to the existing {"_raw_arguments": "[unparseable]"} fallback path.

Related Issue

Fixes #7714

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

FoundryEvals uploaded tool_call content items without an arguments
field when a tool call had no model-supplied arguments. Foundry's
tool-aware evaluators (task_adherence, tool_output_utilization,
tool_call_accuracy) require the arguments field to always be present,
so zero-argument tool calls caused evaluation to fail with
FAILED_EXECUTION. Default to an empty object instead of omitting the
field.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for tool calls that have no arguments by ensuring the evaluation conversion always emits an arguments field (defaulting to {}) and covering the behavior with a new test.

Changes:

  • Add a test for zero-argument tool calls (arguments=None) expecting {}.
  • Update message-to-eval conversion to always include arguments, defaulting to {} when missing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
python/packages/foundry/tests/test_foundry_evals.py Adds regression test to validate zero-argument tool calls serialize with empty arguments.
python/packages/core/agent_framework/_evaluation.py Ensures tool calls always include an arguments key, defaulting to {} when absent.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/packages/core/agent_framework/_evaluation.py Outdated
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Aug 18, 2026
Addresses Copilot review feedback: a truthiness check would also
overwrite valid but falsy parsed arguments (e.g. 0, "", False) with
{}. Use an explicit None check so only missing arguments are defaulted.
@moonbox3

Copy link
Copy Markdown
Contributor

Please use our pull request template, and per contributing guidelines: respond to and resolve all open PR comments.

@moonbox3

Copy link
Copy Markdown
Contributor

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (2 commit(s)): 042676c982e3, 103185927c44
Model: gpt-5.6-sol

Overview

The change unconditionally emits the Foundry-required arguments field while preserving all non-None argument values, including falsy values, and defaulting only missing arguments to {}. The focused regression test covers the zero-argument case, while existing tests protect JSON-string parsing and mapping arguments. No publishable Critical, High, or Medium defect remains after reconciliation.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

@github-actions

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _evaluation.py7217589%164, 172, 488, 490, 587, 599, 791, 794, 872–874, 879, 916–919, 975–976, 979, 985–987, 991, 1024–1026, 1082, 1118, 1130–1132, 1137, 1161–1166, 1259, 1337–1338, 1340–1344, 1350, 1389, 1739, 1741, 1749, 1759, 1763, 1808, 1826–1827, 1905, 1907, 1913, 1921, 1936, 1974, 1980–1984, 2016, 2039, 2047–2048, 2050, 2075–2076, 2081
TOTAL46816436090% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
9466 36 💤 0 ❌ 0 🔥 2m 31s ⏱️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: FoundryEvals omits arguments for zero-argument tool calls, causing tool-aware Foundry evaluators to fail

3 participants