Skip to content

Centralizing route handler-related annotations - #585

Merged
Rodrigo Brandão (rodrigobr-msft) merged 3 commits into
mainfrom
users/robrandao/route-annotations
Sep 14, 2026
Merged

Rodrigo Brandão (rodrigobr-msft) merged 3 commits into
mainfrom
users/robrandao/route-annotations

Conversation

@rodrigobr-msft

Copy link
Copy Markdown
Contributor

This pull request refactors and centralizes type definitions for route handlers and decorators in the Microsoft Agents Hosting libraries. The main focus is to define _RouteDecorator and _StateContra in a single location (core/app/_type_defs.py) and update all references across the codebase, especially in the MS Teams integration, to import these from the new centralized module. This change improves code maintainability and reduces duplication.

Type Definitions Refactoring and Centralization:

  • Added _RouteDecorator and _StateContra type definitions to core/app/_type_defs.py, making them the single source of truth for these types.
  • Updated all references in the MS Teams integration modules to import _RouteDecorator and _StateContra from core/app/_type_defs.py instead of local type_defs files. This affects files such as channel.py, config.py, file_consent.py, meeting.py, message.py, message_extension.py, task_module.py, and their corresponding route_handlers.py modules. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]

API Consistency and Type Hints:

  • Updated type hints for route registration methods (e.g., message, conversation_update, message_reaction, message_update, handoff) in agent_application.py to use the new _RouteDecorator type, ensuring consistent and correct typing throughout the API. [1] [2] [3] [4] [5]

General Imports Cleanup:

These changes collectively improve the maintainability, clarity, and correctness of the route handler type system across the hosting core and MS Teams integration code.

Copilot AI lite review requested due to automatic review settings September 14, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved review issues were identified.

Pull request overview

Centralizes route-handler type definitions in hosting core and updates Microsoft Teams modules to use them consistently.

Changes:

  • Adds shared route decorator and state variance types.
  • Updates Teams imports and route annotations.
  • Exports RouteRank from hosting core.
File summaries
File Summary
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/type_defs.py Removes duplicated route types.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/teams_agent_extension.py Uses centralized state typing.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/team/team.py Updates centralized type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/team/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/task_module/task_module.py Updates route and state imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/task_module/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/route_handlers.py Uses centralized state typing.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/message/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/message/message.py Updates route and state imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/message_extension/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/message_extension/message_extension.py Updates route and state imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/meeting/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/meeting/meeting.py Updates route and state imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/file_consent/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/file_consent/file_consent.py Updates route and state imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/config/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/config/config.py Updates route and state imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/channel/route_handlers.py Updates state type imports.
libraries/microsoft-agents-hosting-msteams/microsoft_agents/hosting/msteams/channel/channel.py Updates route and state imports.
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py Uses centralized route annotations.
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/_type_defs.py Defines shared route types.
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/__init__.py Exports RouteRank.
Review details
  • Files reviewed: 22/22 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved blocking issues were identified.

Review details
  • Files reviewed: 22/22 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) merged commit f27b6db into main Sep 14, 2026
11 checks passed
@rodrigobr-msft
Rodrigo Brandão (rodrigobr-msft) deleted the users/robrandao/route-annotations branch September 14, 2026 20:53
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.

3 participants