fix: updated the agent framework to latest version#856
Merged
Roopan-Microsoft merged 6 commits intodev-v4from Mar 17, 2026
Merged
fix: updated the agent framework to latest version#856Roopan-Microsoft merged 6 commits intodev-v4from
Roopan-Microsoft merged 6 commits intodev-v4from
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the backend’s agent orchestration integration to the newer Agent/Message APIs (and new orchestrations package), updates Python dependencies accordingly, and adjusts both backend websocket payloads and frontend parsing to handle the new clarification-request format.
Changes:
- Migrated orchestration + agents from legacy
ChatAgent/ChatMessagetoAgent/Message, including session/streaming protocol updates. - Updated orchestration event handling to the new event shape (
workflow.run(..., stream=True)), adding buffering + emission ofAGENT_MESSAGE. - Updated Python dependencies (agent framework + Azure SDKs) and improved frontend parsing for user clarification requests.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/src/services/PlanDataService.tsx | Adds direct JSON extraction for user clarification requests with legacy repr fallback. |
| src/backend/v4/orchestration/orchestration_manager.py | Migrates orchestration to new API and refactors event/stream handling + agent message emission. |
| src/backend/v4/orchestration/human_approval_manager.py | Updates manager to new orchestrations package and introduces stateless _complete() retries for rate limits. |
| src/backend/v4/magentic_agents/proxy_agent.py | Updates ProxyAgent to new run(stream=...) contract, session API, and websocket payload format. |
| src/backend/v4/magentic_agents/foundry_agent.py | Migrates Foundry agent wrapper to Agent/Message and new Azure Search tool type. |
| src/backend/v4/magentic_agents/common/lifecycle.py | Updates lifecycle base types to Agent and MCP tool type changes. |
| src/backend/v4/callbacks/response_handlers.py | Migrates callbacks to Message and keeps streaming extraction logic. |
| src/backend/uv.lock | Locks upgraded agent framework and Azure SDK dependency graph. |
| src/backend/pyproject.toml | Pins updated versions and adds agent-framework-orchestrations. |
Comments suppressed due to low confidence (1)
src/backend/v4/callbacks/response_handlers.py:136
streaming_agent_response_callbackdrops updates whenupdate.textis missing: it only falls back toMessage.textorupdate.content, butAgentResponseUpdate(including the one created byProxyAgentin this PR) carries text inupdate.contents. IfAgentResponseUpdate.textisn’t populated, this callback will return early and nothing will be streamed to the client. Add a fallback to extract text fromupdate.contents(e.g., concatenate any text content items) before returning.
try:
# Handle various streaming update object shapes
chunk_text = getattr(update, "text", None)
# If text is None, don't fall back to str(update) as that would show object repr
# Just skip if there's no actual text content
if chunk_text is None:
# Check if update is a Message
if isinstance(update, Message):
chunk_text = update.text or ""
elif hasattr(update, "content"):
chunk_text = str(update.content) if update.content else ""
else:
# Skip if no text content available
return
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| manager=manager, | ||
| checkpoint_storage=storage, | ||
| max_round_count=orchestration_config.max_rounds, | ||
| max_stall_count=3, # CRITICAL: Prevent re-calling agents when stalled (default is 3!) |
Roopan-Microsoft
approved these changes
Mar 17, 2026
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 agent framework integration to support the new
AgentandMessageAPIs, replacing legacyChatAgentandChatMessagetypes throughout the codebase. It also updates dependencies to the latest stable and RC versions, removes deprecated tools, and improves protocol handling for agent sessions and streaming. The changes modernize agent initialization, invocation, and response handling, ensuring compatibility with the latest agent framework and Azure AI SDKs.Framework migration and agent protocol updates
Replaced all occurrences of
ChatAgent/ChatMessagewithAgent/Messagetypes, including agent initialization, response handling, and invocation infoundry_agent.py,proxy_agent.py,lifecycle.py, andresponse_handlers.py. Updated methods and parameters to match new API contracts, including streaming and session management. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]Updated agent protocol methods: replaced
get_new_thread/AgentThreadwithcreate_session/AgentSession, and switched fromrun_streamto unifiedrunmethod supporting streaming via astreamflag. Adjusted internal streaming and response logic accordingly. [1] [2]Dependency updates
pyproject.tomlto latest stable and RC versions:azure-ai-projects,agent-framework-azure-ai,agent-framework-core, and addedagent-framework-orchestrations. [1] [2]Tool handling and removal of deprecated features
HostedCodeInterpreterTooland switched to server-side handling for code interpreter functionality in AzureAIClient. Updated tool collection and agent creation logic to use newAzureAISearchTool(replacingAzureAISearchAgentTool). [1] [2] [3] [4]Response and content handling improvements
ContentAPI, ensuring text and usage updates are wrapped and serialized properly for frontend consumption. Improved websocket event dispatch to send structured data instead of relying on fragile string representations. [1] [2] [3]These updates ensure the backend is fully compatible with the latest agent framework and Azure AI SDKs, streamline agent session and streaming protocols, and remove legacy and deprecated features for improved maintainability.
Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information