chore: dev to main merge#612
Open
Ashwal-Microsoft wants to merge 26 commits into
Open
Conversation
- Update azure-ai-projects from 2.0.0b3/1.0.0b12 to 2.1.0 in pyproject.toml and requirements.txt - Update agent-framework from 1.0.0b260127/1.0.0b260107 to 1.3.0 in pyproject.toml - Migrate ChatMessage(text=...) to ChatMessage(contents=[...]) (breaking change in 1.0.0) - Update codeSample.py to use new sub-client agents API (.agents.threads.create() etc.) - Fix test files to use public ChatMessage import and new constructor Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…or 1.3.0 In agent-framework 1.3.0, Azure OpenAI clients were extracted into the agent-framework-openai sub-package. The old import path agent_framework.azure no longer exports OpenAI client classes. Changes: - AzureOpenAIChatClient -> OpenAIChatCompletionClient (agent_framework.openai) - AzureOpenAIResponsesClient -> OpenAIChatClient (agent_framework.openai) - Updated constructor params: deployment_name->model, endpoint->azure_endpoint, ad_token_provider->credential - Removed unsupported params: ad_token, token_endpoint - AzureOpenAIAssistantsClient and AzureAIAgentClient raise NotImplementedError (never used at runtime, no direct equivalents in 1.3.0) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
In agent-framework 1.3.0, individual event classes (ExecutorCompletedEvent, ExecutorFailedEvent, ExecutorInvokedEvent, WorkflowFailedEvent, WorkflowOutputEvent, WorkflowStartedEvent) were replaced by a unified WorkflowEvent class with a type discriminator field. Migrated isinstance checks to event.type == '...' pattern. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reverted all agent-framework 1.3.0 breaking change fixes (ChatMessage, event classes, import paths) back to dev baseline. Set agent-framework to 1.1.1 instead of 1.3.0. Kept azure-ai-projects upgrade to 2.1.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
agent-framework stable releases (1.1.1+) have the same API changes as 1.3.0: - Individual event classes replaced by unified WorkflowEvent with type field - Azure OpenAI clients moved to agent_framework.openai sub-package - Constructor params renamed (deployment_name->model, endpoint->azure_endpoint) - ChatMessage(text=...) replaced with ChatMessage(contents=[...]) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Dockerfile uses 'uv sync --frozen' which reads from uv.lock, not pyproject.toml. The lock files were still pinned to the old beta versions (1.0.0b260107/1.0.0b260127), causing the Docker build to install the old beta despite pyproject.toml specifying 1.1.1. Regenerated both lock files to resolve agent-framework 1.1.1 with agent-framework-openai 1.1.1 and agent-framework-core 1.1.1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Updated mock patches in test_agent_framework_helper.py to reference: - agent_framework.openai.OpenAIChatCompletionClient (was azure.AzureOpenAIChatClient) - agent_framework.openai.OpenAIChatClient (was azure.AzureOpenAIResponsesClient) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stable agent-framework 1.1.1 renamed core symbols from beta versions: - ChatClientProtocol -> SupportsChatGetResponse - ChatAgent -> Agent - ChatMessage -> Message - AgentProtocol -> SupportsAgentRun - AgentRunContext -> AgentContext - AgentRunUpdateEvent -> AgentResponseUpdate - ToolProtocol -> Any (removed) - ChatMessageStoreProtocol -> HistoryProvider - AggregateContextProvider -> ContextProvider - GroupChatBuilder -> from agent_framework.orchestrations - ManagerSelectionResponse -> local Pydantic model (removed from SDK) Updated 21 files across production code and tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
In agent-framework 1.1.1, WorkflowBuilder requires start_executor as a mandatory keyword argument. Moved from .set_start_executor() chain call to constructor parameter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
WorkflowBuilder in agent-framework 1.1.1 removed register_executor() and string-based names. Now requires actual Executor instances passed to start_executor= and add_edge(source, target). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Agent constructor: client= (not chat_client=), model params via default_options=ChatOptions(...) instead of individual kwargs - WorkflowContext: set_shared_state() -> set_state() - GroupChatBuilder: constructor params instead of fluent .with_*() - Agent.run: response_format via options=ChatOptions(...) - _inner_get_response: options= (not chat_options=) - Remove dead _inner_get_streaming_response (no longer in 1.1.1 API) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Workflow no longer has run_stream() method. Use run(message, stream=True) instead, which returns an async iterator of WorkflowEvents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- ctx.set_state() and ctx.get_state() are synchronous in agent-framework 1.1.1 (return None/value directly). Removing incorrect await that caused: TypeError: object NoneType can't be used in 'await' expression - Role is a NewType (str alias) in 1.1.1, not an enum. Replace Role.USER and Role.ASSISTANT with string literals, and .role.value with .role - Replace removed TextContent with Content.from_text() in retry utils Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove docstring, comment, and test rename changes that were not required by the agent-framework 1.1.1 / azure-ai-projects 2.1.0 upgrade. Keeps only functional API migration changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove unused 'asyncio' import from both azure_openai_response_retry.py - Remove unused 'Role' import from groupchat_orchestrator.py and middlewares.py - Remove trailing blank line from ContentProcessor azure_openai_response_retry.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve uv.lock conflict by regenerating after merge. Includes dev's python-multipart 0.0.27 bump and other updates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…param The openai SDK does not accept a 'reasoning' dict parameter in AsyncCompletions.create(). The correct parameter is 'reasoning_effort' (a string like 'high'). This fixes the runtime error in the map stage: AsyncCompletions.create() got an unexpected keyword argument 'reasoning' Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…leware Role is a NewType(str) in agent-framework 1.1.1, not an enum. Role.USER raises AttributeError at runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Bump agent-framework version in both ContentProcessor and ContentProcessorWorkflow pyproject.toml - Fix TextContent -> Content import in test_azure_openai_response_retry_utils.py (TextContent was removed in pre-1.1.1) - Regenerate uv.lock files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reasoning models (o1, o3, o4, gpt-5.x) reject custom temperature and top_p values. The old agent-framework beta silently stripped these, but 1.1.1+ passes them through causing 400 errors. This fix auto-detects the model name from the client and removes unsupported params before building ChatOptions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reasoning models (gpt-5.x, o-series) also reject logprobs parameter. Conditionally skip logprobs/top_logprobs when targeting these models. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ic API Remove underscore prefix from helper functions in agent_builder.py to make them part of the supported public API, eliminating fragile cross-module dependency on private internals from map_handler.py. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Change agent.run(messages=Message(...)) to agent.run(Message(...)) to match the expected positional signature and avoid potential TypeError. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR merges dev into main with a broad migration to agent-framework==1.3.0, updating workflow/executor code to the newer Agent / Message / ChatOptions APIs, refactoring orchestrator/middleware integrations, and aligning dependencies and samples with newer Azure SDK surfaces.
Changes:
- Migrate agent construction and execution from legacy
ChatAgent/ChatMessageAPIs toAgent/MessagewithChatOptionsand updated protocol types. - Refactor workflow event streaming and context state usage to the newer
WorkflowEventmodel andctx.set_state(...)patterns. - Bump dependencies (notably
agent-frameworkandazure-ai-projects) and update infra code samples accordingly.
Reviewed changes
Copilot reviewed 29 out of 31 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/ContentProcessorWorkflow/libs/agent_framework/test_input_observer_middleware.py | Updates tests to construct and assert against Message instead of ChatMessage/Role. |
| src/tests/ContentProcessorWorkflow/libs/agent_framework/test_azure_openai_response_retry_utils.py | Updates retry utility tests to use Message/Content abstractions. |
| src/tests/ContentProcessorWorkflow/libs/agent_framework/test_agent_framework_helper.py | Updates patch targets to new agent_framework.openai.* client classes. |
| src/tests/ContentProcessorWorkflow/libs/agent_framework/test_agent_builder.py | Updates tests to patch Agent and adjusts reasoning options shape. |
| src/ContentProcessorWorkflow/tests/unit/libs/agent_framework/test_input_observer_middleware.py | Mirrors Message-based test updates in the workflow unit-test tree. |
| src/ContentProcessorWorkflow/tests/unit/libs/agent_framework/test_azure_openai_response_retry_utils.py | Mirrors retry utility test updates in the workflow unit-test tree. |
| src/ContentProcessorWorkflow/tests/unit/libs/agent_framework/test_agent_framework_helper.py | Mirrors helper patch target updates in the workflow unit-test tree. |
| src/ContentProcessorWorkflow/tests/unit/libs/agent_framework/test_agent_builder.py | Updates agent builder assertions for the new default_options behavior. |
| src/ContentProcessorWorkflow/src/steps/summarize/executor/summarize_executor.py | Migrates summarization executor to Message and new chat client protocol type. |
| src/ContentProcessorWorkflow/src/steps/rai/executor/rai_executor.py | Migrates RAI executor to Message and new chat client protocol type. |
| src/ContentProcessorWorkflow/src/steps/gap_analysis/executor/gap_executor.py | Migrates gap analysis executor to Message and new chat client protocol type. |
| src/ContentProcessorWorkflow/src/steps/document_process/executor/document_process_executor.py | Updates workflow state persistence call site to ctx.set_state(...). |
| src/ContentProcessorWorkflow/src/steps/claim_processor.py | Migrates workflow construction and streamed run loop to WorkflowEvent model. |
| src/ContentProcessorWorkflow/src/libs/agent_framework/middlewares.py | Updates middleware signatures to AgentContext and replaces role enum usage with strings. |
| src/ContentProcessorWorkflow/src/libs/agent_framework/groupchat_orchestrator.py | Updates orchestration to new agent types/events and GroupChatBuilder import path. |
| src/ContentProcessorWorkflow/src/libs/agent_framework/azure_openai_response_retry.py | Migrates retry wrappers to agent_framework.openai clients and options= parameter naming. |
| src/ContentProcessorWorkflow/src/libs/agent_framework/agent_speaking_capture.py | Updates middleware context type to AgentContext. |
| src/ContentProcessorWorkflow/src/libs/agent_framework/agent_info.py | Broadens tool typing after removal of legacy ToolProtocol. |
| src/ContentProcessorWorkflow/src/libs/agent_framework/agent_framework_helper.py | Migrates client factory to agent_framework.openai clients and removes deprecated client types. |
| src/ContentProcessorWorkflow/src/libs/agent_framework/agent_builder.py | Refactors builder to create Agent with ChatOptions and adds reasoning-model option stripping. |
| src/ContentProcessorWorkflow/pyproject.toml | Bumps agent-framework and azure-ai-projects dependencies for the workflow package. |
| src/ContentProcessor/uv.lock | Updates locked dependencies to agent-framework 1.3.0 and related extras. |
| src/ContentProcessor/src/libs/pipeline/handlers/map_handler.py | Migrates handler prompting/execution to Message and adds reasoning-model logprobs gating. |
| src/ContentProcessor/src/libs/agent_framework/azure_openai_response_retry.py | Mirrors openai-client migration and retry wrapper changes in the ContentProcessor package. |
| src/ContentProcessor/src/libs/agent_framework/agent_info.py | Mirrors tool typing broadening in the ContentProcessor package. |
| src/ContentProcessor/src/libs/agent_framework/agent_framework_helper.py | Mirrors client factory migration/removals in the ContentProcessor package. |
| src/ContentProcessor/src/libs/agent_framework/agent_builder.py | Mirrors builder refactor and reasoning-model option stripping in the ContentProcessor package. |
| src/ContentProcessor/pyproject.toml | Bumps agent-framework dependency for the ContentProcessor package. |
| infra/vscode_web/requirements.txt | Updates azure-ai-projects version used by the VS Code web infra. |
| infra/vscode_web/codeSample.py | Updates sample to new thread/message/run APIs and message ordering. |
Comments suppressed due to low confidence (2)
src/ContentProcessorWorkflow/src/libs/agent_framework/groupchat_orchestrator.py:1515
Messageconstruction here usestext=..., but the newagent_framework.MessageAPI is content-based (contents=[...]). Usingtextrisks creating invalid messages or silently dropping content, which would break result generation.
selected.append(
Message(
role=role,
text=truncated,
author_name=author,
)
src/ContentProcessorWorkflow/src/libs/agent_framework/azure_openai_response_retry.py:605
- This class no longer overrides
_inner_get_streaming_response, so the docstring is now inaccurate. Update it to avoid implying streaming retries are implemented here.
class AzureOpenAIChatClientWithRetry(OpenAIChatCompletionClient):
"""Azure OpenAI Chat client with 429 retry at the request boundary.
This wraps the underlying chat-completions call used by Agent Framework by overriding
the internal `_inner_get_response` / `_inner_get_streaming_response` methods.
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 introduces several major updates to the agent framework and related code, focusing on modernizing the agent builder, improving compatibility with new versions of dependencies, and enhancing reasoning model support. The main changes include updating the agent builder to use the new
Agentclass andChatOptions, refactoring type hints for broader compatibility, and updating dependencies to their latest versions.Agent Framework Refactoring and Modernization:
Refactored
AgentBuilderto use the newAgentclass andChatOptionsfor agent creation, replacing the olderChatAgentand related protocols. This includes new logic to assemble options, support for reasoning models, and improved middleware/tool handling. (src/ContentProcessor/src/libs/agent_framework/agent_builder.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Updated type hints throughout the agent framework to use more generic and extensible types (e.g.,
Any,AgentMiddleware,HistoryProvider,SupportsChatGetResponse), improving flexibility and compatibility with the new agent architecture. (src/ContentProcessor/src/libs/agent_framework/agent_builder.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]Dependency and Compatibility Updates:
agent-frameworkto version1.3.0andazure-ai-projectsto version2.1.0to ensure compatibility with recent API changes and new features. (src/ContentProcessor/pyproject.toml,infra/vscode_web/requirements.txt) [1] [2]Code Sample and Helper Adjustments:
Updated the
infra/vscode_web/codeSample.pycode sample to use the new agent and thread/message/run APIs, as well as the newListSortOrderfor message listing. (infra/vscode_web/codeSample.py)Refactored type hints and return types in
agent_framework_helper.pyto reference the new OpenAI client classes and use more generic types for compatibility. (src/ContentProcessor/src/libs/agent_framework/agent_framework_helper.py) [1] [2] [3] [4]...
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information