> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Resolve Route • AI Agent SDK

> resolve_route: Resolve the handling agent from priority-ordered bindings.

# resolve\_route

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**protocols**](../modules/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 peer →
role/channel → account → chat-type), then by declaration order.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def resolve_route(bindings: List[RouteBinding], facts: RouteFacts, default_agent: str) -> RouteMatch
```

## Parameters

<ParamField query="bindings" type="List[RouteBinding]" required={true}>
  Candidate route bindings (any order).
</ParamField>

<ParamField query="facts" type="RouteFacts" required={true}>
  Inbound facts extracted from the message.
</ParamField>

<ParamField query="default_agent" type="str" required={false} default="'default'">
  Agent id to fall back to when nothing matches.
</ParamField>

### Returns

<ResponseField name="Returns" type="RouteMatch">
  class:`RouteMatch` with the selected agent and matched binding.
</ResponseField>

## Uses

* `binding.matches`
* `RouteMatch`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L1890">
  `praisonaiagents/gateway/protocols.py` at line 1890
</Card>
