Skip to content

fix: upgrade agent framework versions#857

Draft
Akhileswara-Microsoft wants to merge 6 commits into
devfrom
Upgrade_agentframework_Akhileswar
Draft

fix: upgrade agent framework versions#857
Akhileswara-Microsoft wants to merge 6 commits into
devfrom
Upgrade_agentframework_Akhileswar

Conversation

@Akhileswara-Microsoft
Copy link
Copy Markdown
Contributor

@Akhileswara-Microsoft Akhileswara-Microsoft commented May 21, 2026

Purpose

This pull request updates the backend to use the new OpenAIChatCompletionClient and Agent classes from the latest agent-framework packages, replacing the previous AzureOpenAIChatClient and 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?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Deploy-Test-Cleanup (v2)

What to Check

This pull request updates the agent orchestration backend to use the new OpenAIChatCompletionClient and Agent classes from the latest agent-framework packages, replacing the older AzureOpenAIChatClient and 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

Package Previous Version Changed Version
agent-framework-core 1.0.0b260114 1.1.1
agent-framework-foundry (was agent-framework-azure-ai==1.0.0b260114) 1.1.1
agent-framework-orchestrations (not present) 1.0.0b260421
azure-ai-projects 2.0.0b3 2.1.0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
src/backend
   orchestrator.py55910980%36–38, 569, 708, 742, 751, 753–755, 757, 763–765, 767, 800–801, 826, 846–847, 854–855, 857–859, 862–864, 866, 876–879, 883–884, 886–887, 895–897, 922, 1023–1025, 1111, 1137, 1179–1181, 1183–1185, 1215–1218, 1301–1303, 1319–1321, 1323–1325, 1339–1342, 1378–1379, 1402, 1450, 1454, 1492, 1524, 1526–1531, 1534, 1559–1560, 1562–1564, 1600, 1603, 1609–1611, 1644, 1680, 1684, 1689, 1768–1776, 1806–1808
src/backend/services
   title_service.py701085%37, 45–46, 53–54, 73–75, 121–122
src/tests/services
   test_orchestrator.py1338499%1045, 1062, 1600, 1653
TOTAL765337395% 

Tests Skipped Failures Errors Time
422 0 💤 0 ❌ 0 🔥 12.392s ⏱️

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 OpenAIChatCompletionClient and instantiate Agent directly in orchestrator and title service.
  • Update workflow event handling to branch on event.type and use Message objects 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.

Comment thread src/backend/orchestrator.py Outdated
Comment thread src/backend/orchestrator.py Outdated
Comment thread src/backend/orchestrator.py Outdated
Copilot AI review requested due to automatic review settings May 21, 2026 13:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"):

Comment thread src/backend/services/title_service.py
Comment thread src/backend/orchestrator.py
Comment thread src/tests/services/test_orchestrator.py
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants