refactor: Upgrade agent-framework and azure-ai-projects libraries with API changes#927
Draft
Harsh-Microsoft wants to merge 2 commits into
Draft
refactor: Upgrade agent-framework and azure-ai-projects libraries with API changes#927Harsh-Microsoft wants to merge 2 commits into
Harsh-Microsoft wants to merge 2 commits into
Conversation
Library upgrades (US #43549): - agent-framework-core: 1.0.0rc2 -> 1.3.0 - azure-ai-projects: 2.0.0b3 -> 2.1.0 - Replace retired agent-framework-azure-ai/azure-ai-agents with agent-framework-foundry==1.3.0 and azure-ai-inference==1.0.0b9 Code changes for the new GA API surface: - chat_service / history_service: switch from AzureAIProjectAgentProvider to FoundryAgent and use AgentSession(service_session_id=...) in place of the removed conversation_id streaming kwarg. - infra agent/index scripts: align with the new SDK imports and GA APIs. Citation regression workaround (microsoft/agent-framework#5995): - Add services/_patches/agent_framework_search_citations.py, a runtime monkey-patch of RawOpenAIChatClient._parse_chunk_from_openai that re-attaches per-document REST URLs (additional_properties.get_url) on Azure AI Search url_citation annotations. Mapping uses the doc index parsed from the citation title (doc_<N>) so duplicate citations resolve correctly. Patch is idempotent and degrades gracefully if upstream fixes the regression or renames the target method. - chat_service citation extraction now prefers additional_properties.get_url over the search-service root url so titles/links are per-document. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The services/_patches/agent_framework_search_citations.py monkey-patch targets internals of agent_framework_openai, so pin its version explicitly instead of relying on transitive resolution via agent-framework-foundry. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||||||||||||
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 upgrades the agent framework and related Azure AI dependencies to their latest GA (General Availability) versions, and refactors the codebase to use the new
FoundryAgentAPI instead of the deprecatedAzureAIProjectAgentProvider. Additionally, it introduces a runtime patch to restore per-document URL enrichment for Azure AI Search citations, addressing a regression in the latest agent framework. The changes also update logging configuration and clean up requirements files to remove deprecated packages.Dependency and API upgrades:
azure-ai-projects, replacedazure-ai-agentsandagent-framework-azure-aiwithagent-framework-foundry, and updated all relevant requirements files to use GA versions of agent framework and Azure AI packages. (infra/scripts/agent_scripts/requirements.txt,infra/scripts/index_scripts/requirements.txt,src/api/requirements.txt) [1] [2] [3]Agent API refactoring:
AzureAIProjectAgentProviderto use the newFoundryAgentAPI for agent creation and management in both agent and index scripts, as well as in service layers. (infra/scripts/agent_scripts/01_create_agents.py,infra/scripts/index_scripts/03_cu_process_data_text.py,infra/scripts/index_scripts/04_cu_process_custom_data.py,src/api/services/chat_service.py,src/api/services/history_service.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Azure AI Search citation enrichment patch:
agent_framework_openaito restore per-document URL enrichment (get_url) for streaming Azure AI Search citations, working around a known regression in the GA release. This ensures downstream code receives the expected citation URLs. (src/api/services/_patches/agent_framework_search_citations.py,src/api/services/_patches/__init__.py,src/api/services/chat_service.py) [1] [2] [3] [4]Logging and import updates:
agent_framework.foundrylogger instead of the deprecatedagent_framework.azure, and adjusted imports throughout the codebase to match new package structure. (infra/scripts/index_scripts/03_cu_process_data_text.py,infra/scripts/index_scripts/04_cu_process_custom_data.py,src/api/services/chat_service.py) [1] [2] [3]Other notable improvements:
AgentSessionand improved citation extraction logic to prefer the patched per-document URL. (src/api/services/chat_service.py) [1] [2]Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information