> ## 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.

# Route Binding • AI Agent SDK

> RouteBinding: A single declarative inbound-routing rule.

# RouteBinding

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

A single declarative inbound-routing rule.

A binding maps a set of optional inbound conditions to a handling agent.
Bindings are evaluated most-specific-first so operators get deterministic,
debuggable routing across a fleet of agents behind one gateway.

All condition fields are optional; `None` means "do not constrain on this
field". A binding matches a set of :class:`RouteFacts` only when *every*
non-`None` condition equals the corresponding fact.

Attributes:
agent: The agent id to route to when this binding matches.
chat\_type: Chat type ("dm" | "group" | "channel").
peer: Sender/user id (most specific).
role: Role / guild-role membership of the sender.
channel\_id: Specific chat/channel id.
account: Receiving bot account (for multi-account channels).
priority: Higher wins; ties are broken by specificity then order.
trust: Optional trust tier ("untrusted" | "standard" | "trusted").
`untrusted` advertises a conservative, read-only-leaning toolset
to the model so dangerous tools are never offered on third-party /
stranger / generic-webhook routes (Issue #2298). `None` /
`standard` / `trusted` apply no tier deny-list.
allow\_tools: If set, only these tool names are exposed on this route.
deny\_tools: Tool names removed before the run on this route.
profile: Optional isolated tenant-profile name (Issue #3189). Names a
per-route isolation scope the wrapper enters for the turn (e.g. its
own memory namespace / secret scope / home), so one gateway can
safely multiplex tenants. `None` means the route is unscoped; the
wrapper must fail closed (never fall back to another tenant's
profile) rather than silently share memory/secrets.

## Properties

<ResponseField name="agent" type="str">
  No description available.
</ResponseField>

<ResponseField name="chat_type" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="peer" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="role" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="channel_id" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="account" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="priority" type="int">
  No description available.
</ResponseField>

<ResponseField name="trust" type="Optional[str]">
  No description available.
</ResponseField>

<ResponseField name="allow_tools" type="Optional">
  No description available.
</ResponseField>

<ResponseField name="deny_tools" type="Optional">
  No description available.
</ResponseField>

<ResponseField name="profile" type="Optional[str]">
  No description available.
</ResponseField>

## Methods

<CardGroup cols={2}>
  <Card title="specificity()" icon="function" href="../functions/RouteBinding-specificity">
    Sum of weights for the conditions this binding constrains on.
  </Card>

  <Card title="matches()" icon="function" href="../functions/RouteBinding-matches">
    Return True if every constrained condition equals the facts.
  </Card>

  <Card title="tool_policy()" icon="function" href="../functions/RouteBinding-tool_policy">
    Build the :class:`ToolPolicy` this binding declares, if any.
  </Card>
</CardGroup>

<Accordion title="Internal & Generic Methods">
  * **from\_dict**: Create a binding from a YAML/dict mapping.
</Accordion>

## Source

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