Skip to content

Conversation

@eavanvalkenburg
Copy link
Member

Motivation and Context

Fixes #3147 by overriding error message for AzureAIClient.
Fixes #3118 by adding kwargs in the same way for run as we do in run_stream
Fixes #3041 by completely serializing the function result in the span attribute

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings January 9, 2026 09:43
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 9, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/azure-ai/agent_framework_azure_ai
   _client.py1934377%221–224, 229, 232–235, 240, 243–244, 247, 254, 293, 295–298, 300, 408, 426–429, 472, 508–511, 516, 518–519, 521–529, 531
packages/core/agent_framework
   _agents.py2915282%329, 390–392, 438, 492, 510, 672, 853, 856–858, 994–997, 999, 1002–1004, 1100, 1141, 1143, 1152–1157, 1163, 1165, 1175–1176, 1183, 1185–1186, 1194–1198, 1206–1207, 1209, 1214, 1216, 1250, 1295–1296, 1298, 1300, 1311
   _tools.py7286990%226, 272, 323, 325, 353, 523, 555–556, 658, 660, 680, 698, 712, 724, 729, 731, 738, 771, 827–829, 870, 893, 895–904, 913–919, 955, 965, 1149, 1485, 1563–1567, 1688, 1757, 1850, 1856, 1899–1900, 1913–1914, 2043, 2084–2085, 2113–2115, 2157–2158, 2223–2224, 2231–2232
packages/core/agent_framework/azure
   _responses_client.py36683%106, 129, 156–159
packages/core/agent_framework/openai
   _responses_client.py51310080%141, 144, 146–147, 156, 174, 182, 185–192, 194, 199, 205, 209, 224, 227–228, 230, 267, 297, 341–342, 364, 369, 418, 421, 457, 470, 521, 597, 602, 606–608, 628, 643–644, 648–650, 697, 717–718, 731–732, 748–749, 827–828, 837–838, 869–870, 886, 888, 962–970, 993–999, 1018, 1033–1034, 1043, 1048–1050, 1056–1057, 1070, 1082, 1113–1114, 1116–1118, 1129–1130, 1133, 1135, 1145–1146, 1152, 1167
TOTAL17640289483% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
2617 154 💤 0 ❌ 0 🔥 59.326s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes three bugs in the Python agent framework:

  • Fixes #3147 by allowing AzureAIClient to provide a custom error message when model_deployment_name is missing
  • Fixes #3118 by ensuring kwargs are properly forwarded in the Agent.run() method, consistent with run_stream()
  • Fixes #3041 by using the prepare_function_call_results() function for better serialization of function results in span attributes

Key Changes

  • Extracted model presence validation into a separate overridable method _check_model_presence()
  • Changed function result serialization in observability spans to use prepare_function_call_results() instead of json.dumps()
  • Added **kwargs forwarding to _prepare_thread_and_messages() call in Agent.run()

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
python/packages/core/agent_framework/openai/_responses_client.py Refactored model_id validation into separate _check_model_presence() method to enable subclass customization
python/packages/core/agent_framework/_tools.py Updated function result serialization to use prepare_function_call_results() for better handling of complex types
python/packages/core/agent_framework/_agents.py Added **kwargs forwarding in run() method to match run_stream() behavior
python/packages/azure-ai/agent_framework_azure_ai/_client.py Overrode _check_model_presence() to provide Azure-specific error message referencing model_deployment_name

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Jan 12, 2026
Merged via the queue into microsoft:main with commit 551c2c3 Jan 12, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

4 participants