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

python
def resolve_route(bindings: List[RouteBinding], facts: RouteFacts, default_agent: str) -> RouteMatch

Parameters

ParamField List[RouteBinding]

Candidate route bindings (any order).

ParamField RouteFacts

Inbound facts extracted from the message.

ParamField str

Agent id to fall back to when nothing matches.

Returns

ResponseField RouteMatch

class:RouteMatch with the selected agent and matched binding.

Uses

  • binding.matches
  • RouteMatch

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 2575