Elixir facade for canonical BeamAgent backend routing.
This module chooses a backend according to reusable routing policy instead of forcing callers to hard-code backend choice on every session start.
Supported policies are :explicit, :sticky, :round_robin, :failover,
:capability_first, and :preferred_then_fallback. Sticky affinity and
round-robin cursors are stored as canonical BeamAgent state, but the module
itself stays process-free.
Summary
Types
Fallback behavior after preferred candidates are exhausted.
Backend health override for routing.
Routing decision map.
Routing policy name.
Routing request map.
Functions
Clear sticky affinity and round-robin routing state.
Ensure routing state tables exist.
Select a backend using a normalized routing request.
Select a backend after deriving defaults from a session identity or session opts.
Types
@type fallback_policy() :: :beam_agent_routing.fallback_policy()
Fallback behavior after preferred candidates are exhausted.
Supported values are :none and :available.
@type health_status() :: :beam_agent_routing.health_status()
Backend health override for routing.
Supported values are :healthy, :degraded, :unhealthy, and :down.
@type route_decision() :: :beam_agent_routing.route_decision()
Routing decision map.
@type route_policy() :: :beam_agent_routing.route_policy()
Routing policy name.
Supported values are :explicit, :sticky, :round_robin, :failover,
:capability_first, and :preferred_then_fallback.
@type route_request() :: :beam_agent_routing.route_request()
Routing request map.
Functions
@spec clear() :: :ok
Clear sticky affinity and round-robin routing state.
@spec ensure_tables() :: :ok
Ensure routing state tables exist.
@spec select_backend(route_request()) :: {:ok, route_decision()} | {:error, term()}
Select a backend using a normalized routing request.
@spec select_backend(pid() | binary() | map(), route_request()) :: {:ok, route_decision()} | {:error, term()}
Select a backend after deriving defaults from a session identity or session opts.