fix: upgrade agent framework versions#857
Draft
Akhileswara-Microsoft wants to merge 6 commits into
Draft
Conversation
Contributor
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request upgrades the backend’s Microsoft Agent Framework integration to newer packages and APIs, migrating from AzureOpenAIChatClient / create_agent(...) to OpenAIChatCompletionClient plus direct Agent(...) instantiation, and adjusting workflow event handling accordingly.
Changes:
- Replace Azure-specific chat client usage with
OpenAIChatCompletionClientand instantiateAgentdirectly in orchestrator and title service. - Update workflow event handling to branch on
event.typeand useMessageobjects for outputs. - Bump backend and infra dependency pins to newer Agent Framework + Foundry SDK versions, and refactor unit tests to match the new APIs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/tests/services/test_orchestrator.py |
Updates mocks/patching and workflow event simulation to align with the new event model and direct Agent instantiation. |
src/backend/services/title_service.py |
Migrates title generation to OpenAIChatCompletionClient and direct Agent(...) construction. |
src/backend/requirements.txt |
Updates Agent Framework-related dependencies and bumps azure-ai-projects to 2.1.0. |
src/backend/orchestrator.py |
Migrates orchestrator initialization/client creation and updates streaming event handling for the new framework APIs. |
infra/vscode_web/requirements.txt |
Aligns azure-ai-projects pin with backend (2.1.0). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/tests/services/test_orchestrator.py:284
- Same issue as the direct-mode initialize test: orchestrator.initialize() now chains participants()/with_start_agent()/with_termination_condition(), but the builder mock only stubs add_agent/add_handoff/build. Configure those chain methods to return the builder instance (and ideally assert the participants list) so the test meaningfully exercises the updated Foundry initialization path.
@pytest.mark.asyncio
async def test_orchestrator_initialize_foundry_mode():
"""Test orchestrator in foundry mode."""
with patch("orchestrator.app_settings") as mock_settings, \
patch("orchestrator.DefaultAzureCredential") as mock_cred, \
patch("orchestrator.OpenAIChatCompletionClient") as mock_client, \
patch("orchestrator.Agent") as mock_agent_cls, \
patch("orchestrator.HandoffBuilder") as mock_builder, \
patch("orchestrator.FOUNDRY_AVAILABLE", True), \
patch("orchestrator.AIProjectClient"):
- Update comments referencing AzureOpenAIChatClient to OpenAIChatCompletionClient - Remove unused TOKEN_ENDPOINT constant from title_service.py - Remove misleading 'Foundry requires hyphens' comment (name_sep uses underscores) - Fix HandoffBuilder mock in tests to stub participants(), with_start_agent(), and with_termination_condition() for proper chain validation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Purpose
This pull request updates the backend to use the new
OpenAIChatCompletionClientandAgentclasses from the latestagent-frameworkpackages, replacing the previousAzureOpenAIChatClientand related APIs. It also updates dependencies to more recent versions and adapts the codebase and tests to the new interfaces and event handling structure. The changes modernize the orchestration and agent instantiation logic, improve compatibility, and simplify token management.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
This pull request updates the agent orchestration backend to use the new
OpenAIChatCompletionClientandAgentclasses from the latestagent-frameworkpackages, replacing the olderAzureOpenAIChatClientand its agent creation pattern. It also updates event handling to use type-based checks rather than class-based checks, and ensures compatibility with the updated SDKs and APIs. Several dependencies are updated to their latest versions, and tests are refactored to match the new initialization and mocking patterns.Other Information
updated following versions