fix: Refactor code structure for improved readability and maintainability#272
Conversation
…proved telemetry and error reporting
…and OrchestratorBase
…eter support and backward compatibility
When callers pass credential=None explicitly, the key exists in kwargs but the ad_token_provider mapping was skipped. Use kwargs.get() is None to correctly handle this case. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When callers pass credential=None explicitly, the key exists in kwargs but the ad_token_provider mapping was skipped. Use kwargs.get() is None to correctly handle this case. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep agent-framework==1.3.0 upgrade from PR (per user story 43673). Accept newer general dependency versions from dev branch. Keep upgraded azure_openai_response_retry.py from PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…de clarity - Fix create_agents return type annotation to dict[str, Agent] - Narrow participants param to Mapping only (Sequence was unused) - Normalize self.agents with dict() and correct value type - Replace redundant pass with continue and clarifying comment - Add teardown_module to test files to restore patched Message class Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update InputObserverMiddleware to use Message(contents=) instead of Message(text=) since agent-framework 1.3.0 renamed the parameter - Update corresponding tests to verify contents field - Fix teardown_module signature to accept optional module parameter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The teardown_module from one test file was restoring the real Message before another test file's tests ran. Adding setup_module ensures the stub is re-applied before each module's tests execute. Also fix test assertion to check contents instead of text since the middleware now uses Message(contents=). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The middleware now uses Message(contents=) so the test must verify the contents field, not text. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Set both text= and contents= when constructing Message in InputObserverMiddleware for compatibility with downstream code - Restore missing copyright header in azure_openai_response_retry.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request updates the processor to agent-framework==1.3.0 and refactors the local agent/orchestration integration to match the newer framework surface area (e.g., Agent, WorkflowEvent, FunctionTool) while updating affected unit tests and related dependency pins.
Changes:
- Migrates agent orchestration/runtime code from legacy event/classes (
ChatAgent,Workflow*Event,ToolProtocol) toAgent,WorkflowEvent, andFunctionTool. - Updates shared-memory context provider and middleware/test stubs to the new
Messageshape (contentsvstext). - Bumps key dependencies (processor + vscode_web requirements) to align with the updated framework ecosystem.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/processor/src/tests/unit/steps/test_migration_processor_run.py | Updates workflow event stubs to WorkflowEvent.*() factories. |
| src/processor/src/tests/unit/libs/agent_framework/test_shared_memory_context_provider.py | Loosens assertions to account for updated context shape. |
| src/processor/src/tests/unit/libs/agent_framework/test_middlewares_extras.py | Reworks middleware tests with a Message stub and module-level patching. |
| src/processor/src/tests/unit/libs/agent_framework/test_input_observer_middleware.py | Updates input observer middleware test for Message(contents=...). |
| src/processor/src/tests/unit/libs/agent_framework/test_groupchat_orchestrator_internals.py | Updates orchestrator internals tests to new Message/role expectations and patching. |
| src/processor/src/tests/unit/libs/agent_framework/test_agent_framework_helper.py | Adjusts helper tests for removed/renamed azure clients (now expecting ImportError). |
| src/processor/src/tests/unit/libs/agent_framework/test_agent_builder.py | Updates builder tests to patch Agent instead of ChatAgent. |
| src/processor/src/steps/migration_processor.py | Refactors streaming event handling to WorkflowEvent (event.type, executor_id). |
| src/processor/src/steps/documentation/orchestration/documentation_orchestrator.py | Updates tool typing/imports to FunctionTool. |
| src/processor/src/steps/design/orchestration/design_orchestrator.py | Updates tool typing/imports to FunctionTool. |
| src/processor/src/steps/convert/orchestration/yaml_convert_orchestrator.py | Updates tool typing/imports to FunctionTool. |
| src/processor/src/steps/analysis/orchestration/analysis_orchestrator.py | Updates tool typing/imports to FunctionTool. |
| src/processor/src/libs/mcp_server/MCPMicrosoftDocs.py | Updates examples to use Agent instead of ChatAgent. |
| src/processor/src/libs/mcp_server/MCPDatetimeTool.py | Updates examples to use Agent instead of ChatAgent. |
| src/processor/src/libs/mcp_server/MCPBlobIOTool.py | Updates examples to use Agent instead of ChatAgent. |
| src/processor/src/libs/base/orchestrator_base.py | Switches orchestration to Agent and introduces tool result compaction + new coordinator response model. |
| src/processor/src/libs/agent_framework/shared_memory_context_provider.py | Migrates context provider to Message and adds a default prompt; refactors text extraction. |
| src/processor/src/libs/agent_framework/middlewares.py | Migrates middleware types to new agent framework context/message types. |
| src/processor/src/libs/agent_framework/groupchat_orchestrator.py | Migrates group chat orchestrator to new streaming/update events and Message. |
| src/processor/src/libs/agent_framework/coordinator_selection_response.py | Adds local CoordinatorSelectionResponse model replacing removed framework type. |
| src/processor/src/libs/agent_framework/azure_openai_response_retry.py | Re-implements retry wrapper against new agent-framework OpenAI client surface. |
| src/processor/src/libs/agent_framework/agent_speaking_capture.py | Updates middleware signature to AgentContext. |
| src/processor/src/libs/agent_framework/agent_info.py | Updates tool typing to FunctionTool. |
| src/processor/src/libs/agent_framework/agent_framework_helper.py | Updates client type hints/imports for renamed Durable agent client. |
| src/processor/src/libs/agent_framework/agent_builder.py | Reworks builder to construct Agent instead of ChatAgent, updating types accordingly. |
| src/processor/pyproject.toml | Bumps agent-framework to 1.3.0 and related dependency versions. |
| infra/vscode_web/requirements.txt | Updates azure-ai-projects version pin. |
| infra/vscode_web/endpoint-requirements.txt | Updates azure-ai-projects version pin. |
Comments suppressed due to low confidence (1)
src/processor/src/libs/agent_framework/shared_memory_context_provider.py:312
SharedMemoryContextProvider._get_text()looks formessage.content, but the rest of this repo (and updated tests) treat the new agent-frameworkMessageas usingcontents(and/ortext). As written, this can return an empty string and prevent memory search/storage from working. Prefertext, then fall back tocontents.
if hasattr(message, "text") and message.text:
return message.text
if hasattr(message, "content"):
return str(message.content) if message.content else ""
return str(message) if message else ""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 29 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
src/processor/src/libs/agent_framework/shared_memory_context_provider.py:312
- SharedMemoryContextProvider._get_text() currently ignores
message.contents. Elsewhere in this repo (e.g., middlewares/groupchat) messages may carry their primary payload in.contents, so memory query extraction and stored memories can end up usingstr(message)instead of the actual text/tool output.
if hasattr(message, "text") and message.text:
return message.text
if hasattr(message, "content"):
return str(message.content) if message.content else ""
return str(message) if message else ""
src/processor/src/libs/agent_framework/groupchat_orchestrator.py:1303
- _build_result_generator_conversation() constructs new Message objects with
text=...only. Other parts of this orchestrator treatMessage.contentsas the canonical place for tool calls / content, and agent-framework 1.3.0 appears to be moving towardcontents-first messages. Settingcontentshere makes downstream handling (and framework compatibility) more reliable.
Message(
role=role,
text=truncated,
author_name=author,
)
Purpose
This pull request updates dependencies and refactors the agent builder and client helper code to align with the latest
agent-frameworklibrary changes. The main focus is on supporting the newAgentclass and handling the removal or renaming of several types and clients inagent-framework1.3.0. The changes improve compatibility and future-proof the codebase.Does this introduce a breaking change?