Expand description
Model routes: a ChatProvider that tries a chain of providers in order.
It is a provider rather than a feature of the loop so the loop stays untouched: the runtime
still holds one &dyn ChatProvider per run and asks it for a reply. It lives in its own
module because it knows nothing about HTTP; provider.rs is about one server, this is about
the policy for moving between servers, and each is easier to read without the other.
The policy, in one place:
- One attempt per route, in chain order. A route that failed is never tried again in the same run, and a route that answered is kept for the turns after it.
- A hop happens only when the failure says the server was the problem and the request was
fine:
ProviderFailure::is_retryable(no answer, 408/429/5xx, a cut stream). A wrong key, a refused option or a 400 fails the run and names the route, because moving on would hide a config error behind a slower success. - Each route keeps its own retry budget (
max_retries, with backoff) before the router moves on.max_retries = 0on a route makes it hop at once. - Streaming: once any text of a turn has reached the caller, a transient failure does not hop. Replaying the turn on another route would print its beginning twice, so the run fails and says why. This is the same rule M10 applies to one route’s cut stream, applied one level up.
- Every hop is recorded with its reason and can be read back with
Router::hops.
Structs§
- Hop
- One move from a route that failed to the next one, and why.
- Role
Route - Which route one role uses, and whether the config said so.
- Route
Info - What a readout needs to say about one route: its name and what it serves.
- Router
- A chain of providers behind the
ChatProviderinterface. Build one per run: its state is the run’s record of which routes have already failed. - Router
Entry - One link of the chain: a name and the provider that talks to it.
Enums§
- Route
Stop - Why a
ProviderFailure::Routedended the run.
Constants§
- ROLES
- The jobs the agent does on its own behalf that can be sent to a route of their own.
Functions§
- describe_
hops - Render hops as one readout line:
route: local → big (timeout), orroute: local → big → cloud (timeout; HTTP 503)when it hopped twice. Empty when nothing hopped, because silence is the normal case. - role_
table - Which route each role uses. The one answer to the question:
eclipse config show,/statusand the startup panel all print this, so they cannot disagree.auxis[provider] auxanddelegateis[provider] delegate;selectedis the first route of the chain, which is where a role with no route of its own goes.