fix: upgrade agent framework versions#857
Conversation
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||||||||||||
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.
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>
…ator and title service
…der in orchestrator.py
…hyphen agent names
|
🎉 This PR is included in version 2.7.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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