Python: Warn on unsupported AzureAIClient runtime tool/structured_output overrides#3919
Python: Warn on unsupported AzureAIClient runtime tool/structured_output overrides#3919eavanvalkenburg wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
This PR improves AzureAIClient ergonomics by tracking agent-creation configuration (tools + structured output) and warning when callers attempt unsupported runtime overrides, while also changing how request options are pruned to be based on the concrete client options TypedDict.
Changes:
- Track creation-time tool names and structured output configuration; warn on runtime mismatches and point users to
ResponsesClient. - Replace fixed “exclude list” pruning with TypedDict-driven pruning logic.
- Add unit tests for runtime-override warnings and TypedDict-based option pruning.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| python/packages/azure-ai/agent_framework_azure_ai/_client.py | Adds runtime override warnings + refactors run option pruning to depend on concrete options TypedDict. |
| python/packages/azure-ai/tests/test_azure_ai_client.py | Adds tests for the new warnings and for TypedDict-based pruning behavior; updates test client factory. |
| runtime_tools = run_options.get("tools") | ||
| tools_changed = False | ||
| if runtime_tools is not None: | ||
| tools_changed = self._extract_tool_names(runtime_tools) != self._created_agent_tool_names |
There was a problem hiding this comment.
Why do we have to check if the tools or other parameters are changed? Wouldn't it be easier if we just warn users that these runtime options are not supported and the agent will use whatever is provided at creation time?
There was a problem hiding this comment.
I thought about that, but if you call run without first creating an agent then you would be warned but nothing is wrong, it's only once the agent is there that there's an issue. And we do need function tools to be available and the only way to set that is through the same param, where if the tool was already registered and you're just passing in the actual function it will work and you shouldn't get a warning.
There was a problem hiding this comment.
Then we only need to track if the agent has been created, no?
Summary
Validation