Merged
Conversation
* use as* `asyncio.gather` is used to make function tool calls in paral… (#41311) * use as* `asyncio.gather` is used to make function tool calls in parallel for `async` scenario. * Fixed version * update * update version * run black
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances connection validation and streamlines asynchronous function tool execution.
- Enforces Azure connection ID format via
is_valid_connection_idinConnectionTooland related classes - Introduces
AsyncToolSetto run function tool calls concurrently and updates samples accordingly - Bumps package version to 1.1.0b2 and updates the changelog
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| samples/agents_async/sample_agents_stream_eventhandler_with_functions_async.py | Switches to AsyncToolSet.execute_tool_calls for concurrency |
| samples/agents_async/sample_agents_functions_async.py | Uses AsyncToolSet instead of manual loop for tool execution |
| azure/ai/agents/models/_patch.py | Adds is_valid_connection_id, enforces validation, refactors tool execution |
| azure/ai/agents/_version.py | Bumps version to 1.1.0b2 |
| CHANGELOG.md | Logs new features/fixes for 1.1.0b2 |
Comments suppressed due to low confidence (5)
sdk/ai/azure-ai-agents/azure/ai/agents/models/_patch.py:1845
- The implementation of
is_valid_connection_idusesre.matchbutreis not imported in this file. Please addimport reat the top.
def is_valid_connection_id(connection_id: str) -> bool:
sdk/ai/azure-ai-agents/azure/ai/agents/models/_patch.py:1398
- The code calls
asyncio.gatherbutasynciois not imported. Please addimport asyncioat the top of this module.
tool_outputs = await asyncio.gather(
sdk/ai/azure-ai-agents/azure/ai/agents/models/_patch.py:865
- [nitpick] The connection ID validation logic is duplicated in two
__init__methods. Consider moving this check into the baseConnectionToolconstructor or a shared helper to avoid code duplication.
if not is_valid_connection_id(connection_id):
sdk/ai/azure-ai-agents/samples/agents_async/sample_agents_stream_eventhandler_with_functions_async.py:46
- [nitpick] Defining
toolsetat module level and referencing it inMyEventHandlercan hinder encapsulation and testing. Consider passing the toolset into the handler's constructor or storing it as an instance attribute.
# Initialize function tool with user functions
sdk/ai/azure-ai-agents/CHANGELOG.md:5
- The changelog entry omits the newly added connection ID validation and references instrumentation for
create_thread_and_runwhich isn’t present in this PR. Please update to accurately reflect all changes.
## 1.1.0b2 (2025-05-29)
* fixing tracing for streaming when not using event handler * fixing mypy warnings * fixes * changelog
dargilco
approved these changes
Jun 6, 2025
jhakulin
reviewed
Jun 6, 2025
jhakulin
approved these changes
Jun 6, 2025
* Update samples with project client * more samples * update samples * UPDATE * update * change tooling samples * black and readme update * update pip install * Update changelog * change is_valid_connection_id to _is_valid_connection_id and run black
…Azure/azure-sdk-for-python into feature/azure-ai-agents/1.1.0b2
jhakulin
approved these changes
Jun 9, 2025
dargilco
approved these changes
Jun 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines