Deprecating AgentApplication ownership of a single channel adapter - #600
Rodrigo Brandão (rodrigobr-msft) merged 19 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Removing the adapter property leaves multiple samples and generated entry points failing with AttributeError.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 2
Open (4)
What changed in this PR
Refactors AgentApplication to use each turn’s adapter and updates testing utilities accordingly.
Changes:
- Moves adapter-dependent operations to
TurnContext.adapter. - Supports multiple application error handlers.
- Adds configurable adapter handling to
AiohttpScenario.from_app.
| File | Description |
|---|---|
tests/hosting_core/app/test_agent_application.py |
Tests error-handler behavior. |
libraries/.../app/agent_application.py |
Refactors adapter and error handling. |
dev/.../tests/test_aiohttp_scenario.py |
Tests existing-app scenario construction. |
dev/.../README.md |
Documents adapter selection. |
dev/.../aiohttp_scenario.py |
Adds optional scenario adapter. |
dev/.../docs/README.md |
Adds usage guidance. |
dev/.../docs/API.md |
Documents the updated API. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The long-running-message path currently calls incompatible adapter APIs and fails before executing its callback.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (4)
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Long-running calls use an incompatible adapter signature, and the cards sample references an undefined adapter name.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 2
Open (2)
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Long-running messages currently call the adapter with an invalid keyword and omit the required callback.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1



This pull request refactors how the bot adapter is managed within
AgentApplicationto improve flexibility and error handling. The adapter is no longer stored as an internal attribute, and related methods and checks have been updated to access the adapter from theTurnContextdirectly. Additionally, error handler registration and long-running call management have been updated to align with this change.Adapter Management Refactor
_adapterattribute and theadapterproperty fromAgentApplication, shifting adapter access to usecontext.adapterinstead. This simplifies the class and avoids potential stale references. [1] [2]bot_app_idwhenlong_running_messagesis enabled, removing the previous check for an adapter.Error Handling Improvements
_turn_error_handlerslist instead of setting them directly on an internal adapter, allowing for multiple error handlers and decoupling error handling from the adapter. [1] [2]Long-Running Call and Conversation Replay
context.adapterfor continuing conversations, ensuring the correct adapter instance is used per turn. [1] [2]