fix: Feature/upgrade agent framework azure ai projects#281
Draft
Prachig-Microsoft wants to merge 9 commits into
Draft
fix: Feature/upgrade agent framework azure ai projects#281Prachig-Microsoft wants to merge 9 commits into
Prachig-Microsoft wants to merge 9 commits into
Conversation
- Update agent-framework from 1.0.0b260107 to 1.3.0 in pyproject.toml - Update azure-ai-projects from 1.0.0b12 to 2.1.0 in requirements.txt - Migrate ChatAgent to Agent (client=, default_options=ChatOptions) - Migrate agent_framework.azure to agent_framework.openai module paths - Migrate ChatMessage to Message with Content.from_text() - Migrate Role enum to string literals - Migrate AgentRunContext to AgentContext - Migrate WorkflowBuilder to new API (start_executor=, add_chain) - Migrate event handling from isinstance checks to WorkflowEvent.type - Migrate GroupChatBuilder to agent_framework.orchestrations module - Migrate ContextProvider to before_run/after_run interface - Remove ToolProtocol (use Any), AgentProtocol (use SupportsAgentRun) - Define ManagerSelectionResponse locally (removed from framework) - Update MCP tool files for Agent import - Update all unit tests for new APIs (812 tests passing) - Update docs/ProcessFrameworkGuide.md with new WorkflowBuilder example - Update docs/LocalDevelopmentSetup.md prerelease note - Regenerate uv.lock Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
AgentBuilder.with_context_providers() and with_middleware() accepted single objects but passed them directly to Agent(), which expects Sequence types. Now both methods auto-wrap single items into a list. Also wrapped the call site in orchestrator_base.py for clarity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Responses API requires the new v1 API endpoint. The old preview version (2025-03-01-preview) does not support the /responses endpoint, causing BadRequest 'API version not supported' errors at runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The parent OpenAIChatClient._inner_get_response is a regular def that returns ResponseStream (async iterable) when stream=True, or Awaitable when stream=False. The override was async def, which always returned a coroutine, breaking 'async for event in workflow.run(stream=True)'. Refactored to: - Regular def _inner_get_response dispatching stream vs non-stream - _non_streaming_with_retry: async coroutine with retry + context-trim - _streaming_with_retry: async generator with pre-first-chunk retry - _maybe_trim_messages: shared context-trim helper Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…erator The framework's BaseChatClient.get_response checks isinstance(result, ResponseStream) for streaming responses. Our async generator from _streaming_with_retry failed that check, causing the framework to 'await' it — which fails with 'object async_generator can't be used in await expression'. Fix: for streaming, pass through to the parent's _inner_get_response which returns a proper ResponseStream. Retry is preserved for non-streaming calls. Removed unused _streaming_with_retry method. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- _trim_messages: keep at least 1 message (never pop to empty) - _maybe_trim_messages: fall back to originals if trim produces empty - _non_streaming_with_retry: re-raise if aggressive trim empties list - _inner_get_response: log warning and use originals if messages empty Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Lychee v0.23.0 removed --exclude-mail (mail exclusion is now default). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
This pull request introduces several improvements and refactors to the agent builder and related developer experience. The most significant changes are a major refactor of the
AgentBuilderclass to support the newAgentinterface (instead ofChatAgent), improved handling of model-specific options, and updates to documentation and dependencies to align with the latest APIs.Agent Builder and Agent Framework Refactor:
AgentBuilderinagent_builder.pyto build the newAgentclass instead ofChatAgent, updated type hints throughout, improved middleware and context provider handling, and added logic to strip unsupported parameters for reasoning models. Also updated static creation methods and tool typing for compatibility with the latest agent framework. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Dependency and Compatibility Updates:
agent-frameworkto version1.3.0inpyproject.tomlandazure-ai-projectsto2.1.0inrequirements.txtto ensure compatibility with new APIs and features. [1] [2]Code Sample and SDK Usage Updates:
infra/vscode_web/codeSample.pyto use the latest SDK method names and patterns, including new thread, message, and run creation APIs, and improved message handling with the newListSortOrder. [1] [2]Documentation Improvements:
LocalDevelopmentSetup.mdregarding the use of prerelease dependencies, and improved the process framework guide to reflect new workflow builder usage and simplified test commands. [1] [2] [3]These changes modernize the agent framework integration, improve developer ergonomics, and ensure the codebase is aligned with the latest SDK and library best practices.## Purpose
Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
This pull request introduces several important updates to both the documentation and the agent framework codebase, with a focus on upgrading dependencies, improving API clarity, and aligning the code with the latest versions of key libraries. The most significant changes include refactoring the
AgentBuilderto support the newAgentclass (instead ofChatAgent), updating type annotations for middleware and tools, and revising documentation to reflect these updates and new best practices.Agent Framework Refactoring and Type Modernization
AgentBuilderinagent_builder.pyto construct the newAgentclass (notChatAgent), updated type annotations for middleware, tools, and message stores, and added logic to handle model-specific options and reasoning models. This includes new helper functions, improved option handling, and a more robust build process. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Dependency Upgrades
agent-frameworkto version1.3.0inpyproject.tomlandazure-ai-projectsto2.1.0inrequirements.txt, ensuring compatibility with the latest features and APIs. [1] [2]Sample Code and Usage Updates
infra/vscode_web/codeSample.pyto use the newagents.threads,agents.messages, andagents.runsAPIs, and improved error handling and message printing to match the upgraded SDK. [1] [2]Documentation Improvements
LocalDevelopmentSetup.mdto clarify the need for the--prerelease=allowflag and explain its purpose more clearly.ProcessFrameworkGuide.mdto reflect the new workflow builder API, showing how to instantiate and chain executors, and simplified the unit test command to remove unnecessary flags. [1] [2]These changes collectively modernize the codebase, improve developer experience, and ensure alignment with the latest agent framework and Azure SDK conventions.] 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