Resolve Route • AI Agent SDK
resolve_route: Resolve the handling agent from priority-ordered bindings.
resolve_route
Function
</div>
This function is defined in the protocols module.
Resolve the handling agent from priority-ordered bindings.
Bindings are evaluated most-specific-first: the matching binding with the highest `priority` wins; ties are broken by specificity (exact thread → peer → role/channel → guild/account → chat-type), then by declaration order.
Signature
def resolve_route(bindings: List[RouteBinding], facts: RouteFacts, default_agent: str) -> RouteMatchParameters
ParamField
List[RouteBinding]Candidate route bindings (any order).
ParamField
RouteFactsInbound facts extracted from the message.
ParamField
strAgent id to fall back to when nothing matches.
Returns
ResponseField
RouteMatchclass:RouteMatch with the selected agent and matched binding.
Uses
binding.matchesRouteMatch
Source
View on GitHubpraisonaiagents/gateway/protocols.py at line 2575