Skip to content

chore: dev to main merge#612

Open
Ashwal-Microsoft wants to merge 26 commits into
mainfrom
dev
Open

chore: dev to main merge#612
Ashwal-Microsoft wants to merge 26 commits into
mainfrom
dev

Conversation

@Ashwal-Microsoft
Copy link
Copy Markdown

@Ashwal-Microsoft Ashwal-Microsoft commented Jun 4, 2026

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 Agent class and ChatOptions, refactoring type hints for broader compatibility, and updating dependencies to their latest versions.

Agent Framework Refactoring and Modernization:

  • Refactored AgentBuilder to use the new Agent class and ChatOptions for agent creation, replacing the older ChatAgent and 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:

  • Upgraded agent-framework to version 1.3.0 and azure-ai-projects to version 2.1.0 to 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.py code sample to use the new agent and thread/message/run APIs, as well as the new ListSortOrder for message listing. (infra/vscode_web/codeSample.py)

  • Refactored type hints and return types in agent_framework_helper.py to 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?

  • 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.

What to Check

Verify that the following are valid

  • ...

Other Information

Prachig-Microsoft and others added 26 commits May 20, 2026 14:18
- 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>
Copilot AI review requested due to automatic review settings June 4, 2026 12:52
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
TOTAL121716186% 
report-only-changed-files is enabled. No files were changed during this commit :)

Tests Skipped Failures Errors Time
244 0 💤 0 ❌ 0 🔥 4.728s ⏱️

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 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/ChatMessage APIs to Agent/Message with ChatOptions and updated protocol types.
  • Refactor workflow event streaming and context state usage to the newer WorkflowEvent model and ctx.set_state(...) patterns.
  • Bump dependencies (notably agent-framework and azure-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

  • Message construction here uses text=..., but the new agent_framework.Message API is content-based (contents=[...]). Using text risks 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.

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.

4 participants