Python: default to service managed threads for AzureAIAgentClient to prevent … #1690
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Short Summary
Fixes the warning when using AI Foundry Agents with
AzureAIAgentClient:Detailed Summary
This pull request introduces a minor update to the
python/packages/azure-ai/agent_framework_azure_ai/_chat_client.pyfile to improve type safety and extend functionality. The most notable change is the addition of a newcreate_agentmethod, which delegates agent creation to the superclass, and type checking improvements for better developer experience.Type checking improvements:
if TYPE_CHECKINGblock to importChatAgentfor type hints, improving static analysis and autocompletion without affecting runtime performance.TYPE_CHECKINGfromtyping, supporting the new type hinting logic.Functionality extension:
create_agentmethod to the chat client, allowing agent creation with optional storage and keyword arguments, and delegating the logic to the superclass.