Agentic.ModelRouter
(agentic v0.2.2)
Copy Markdown
Smart model routing for Agentic with two selection modes.
Modes
:manual— the caller picks a tier (:primary,:lightweight) and the router resolves the best route from the catalog. This is the legacy behaviour and the default.:auto— the router analyses the request using a fast/free model, determines complexity and required capabilities, then selects the best model based on user preference (:optimize_priceor:optimize_speed).
Auto mode flow
1. `Analyzer.analyze/2` classifies the request (complexity, capabilities)
2. `Selector.select/3` scores all catalog models using the analysis
and user preference
3. The best-scoring model is returned as a routeManual mode flow
1. Caller provides a `tier` (`:primary`, `:lightweight`, `:any`)
2. Router queries the catalog, sorts by priority, returns healthy routes
Summary
Functions
Auto-select the best model for a request given a user preference.
Returns a specification to start this module under a supervisor.
Clear workspace tier overrides.
Report a failed call for a route.
Report a successful call for a route.
Resolve the best route for a tier (manual mode).
Get all available routes for a tier (manual mode).
Resolve routes for a context — dispatches to auto or manual based on
ctx.model_selection_mode.
Legacy compat: set routes for a tier (replaced by Catalog, kept for backward compat).
Configure workspace tier overrides.
Get current routing status.
Types
Functions
Auto-select the best model for a request given a user preference.
Returns {:ok, route, analysis} or {:error, reason}.
Returns a specification to start this module under a supervisor.
See Supervisor.
Clear workspace tier overrides.
Report a failed call for a route.
Report a successful call for a route.
Resolve the best route for a tier (manual mode).
Get all available routes for a tier (manual mode).
Resolve routes for a context — dispatches to auto or manual based on
ctx.model_selection_mode.
Legacy compat: set routes for a tier (replaced by Catalog, kept for backward compat).
Configure workspace tier overrides.
Get current routing status.