The one canonical recipe for wiring a routed placement into an agent
session: granted key + routed base_url into model_config, budget guard
from the grant, correlation metadata for decision-linked ingestion. Produces
a plain keyword list targeting RMA's documented session options — no RMA
types imported.
{:ok, resp} = Mimir.RouterClient.route(descriptor, client_opts)
session_opts = Mimir.Sessions.opts(resp, base_url: gateway_url)
Session.run(provider, session_opts ++ [handler: MyTools, prompt: prompt])resp is already a %Mimir.RouteResponse{} (built by Mimir.RouteResponse.new/1
at the parse boundary).
opts/2 raises ArgumentError on a no-candidate or malformed route
response — fail at composition time, not mid-session. Mimir.Guard handles
the mid-run side and never raises.
The api_key/base_url pair is the data-plane half (hard enforcement at
the gateway's budget constraint) for lanes that traverse a gateway;
turn_guard is the control-plane half for runtimes the gateway cannot
front. Both ride along on every placement; each runtime uses what applies.
Summary
Functions
Options
Functions
@spec opts( Mimir.RouteResponse.t(), keyword() ) :: keyword()
Options:
:base_url— routed data-plane URL; defaults toApplication.get_env(:mimir, :gateway_base_url); omitted frommodel_configwhen nil (direct-to-provider runtimes).:request_id— correlation id; defaults toMimir.RouteLog.gen_request_id/0.:guard— extraMimir.Guard.caps/1options composed into the grant guard.