Provider router that implements the ProviderAdapter behaviour.
The router selects a registered adapter by capability requirements, routing policy, and simple in-router health state. It supports retryable failover and run-to-adapter cancellation routing.
Phase 2 Additions
- Weighted scoring — when
strategy: :weighted, candidates are ordered by score (static weight minus health penalty). - Session stickiness — pass
routing: [sticky_session_id: id]to pin a session to a provider for continuity. The mapping expires aftersticky_ttl_ms(default: 300 000 ms). - Routing telemetry — emits
[:agent_session_manager, :router, :attempt, ...]events for each routing attempt. - Circuit breaker — optional per-adapter circuit breaker behind
circuit_breaker: trueconfiguration.
Summary
Functions
Returns a specification to start this module under a supervisor.
Types
@type adapter_entry() :: %{ id: adapter_id(), adapter: AgentSessionManager.Ports.ProviderAdapter.adapter(), opts: keyword() }
@type adapter_id() :: String.t()
@type health_entry() :: %{ failure_count: non_neg_integer(), last_failure_at: DateTime.t() | nil }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec register_adapter( GenServer.server(), adapter_id(), AgentSessionManager.Ports.ProviderAdapter.adapter(), keyword() ) :: :ok
@spec start_link(keyword()) :: GenServer.on_start()
@spec status(GenServer.server()) :: map()
@spec unregister_adapter(GenServer.server(), adapter_id()) :: :ok