Skip to main content

Interface: CompletionRoute

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:45

What a turn asks the gateway for. Unset fields take the gateway's defaults.

Properties​

apiKey?​

optional apiKey: string

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:66

Credentials for the primary only; fallback hops read the environment, as streamText's walk does. Set in the gateway defaults beside a provider or model, they are for that provider: a turn that names another provider does not take them.


baseUrl?​

optional baseUrl: string

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:67


callOptions?​

optional callOptions: Pick<GenerateTextOptions, "maxTokens" | "effort" | "cache">

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:69

The call's own effort, cache and output budget, from which each fallback hop's overrides are derived.


fallbackProviders?​

optional fallbackProviders: FallbackProviderEntry[]

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:60

Caller chain. Undefined builds the policy-aware chain from the environment; an empty array disables fallback. Either is resolved once, as generateText's walk resolves its chain: entries naming an excluded model or lacking an explicitly required capability are passed over, and so is the policy chain's entry for the first model.


hostPolicy?​

optional hostPolicy: HostLLMPolicy

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:53


messages​

messages: ChatMessage[]

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:49

The turn's messages so far; the last user message is the router's task hint.


modelId?​

optional modelId: string

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:46


onFallback()?​

optional onFallback: (info) => void

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:71

Called when the turn moves to a hop after the primary.

Parameters​

info​
error​

Error

from​

string

hop​

number

to​

string

Returns​

void


onHopFailure()?​

optional onHopFailure: (info) => void

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:73

Called for every hop that could not start (initialisation failure or open circuit).

Parameters​

info​
error​

Error

hop​

number

providerId​

string

Returns​

void


onHopSkipped()?​

optional onHopSkipped: (info) => void

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:80

Called for every chain entry the walk passes over without an attempt: an excluded model, a missing required capability, the policy chain's entry for the first model, a refill no standing leg is owed, a Claude leg after a refusal.

Parameters​

info​

CompletionHopSkip

Returns​

void


policyTier?​

optional policyTier: "safe" | "standard" | "mature" | "private-adult"

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:54


providerId?​

optional providerId: string

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:47


router?​

optional router: IModelRouter

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:51


routerParams?​

optional routerParams: Partial<ModelRouteParams>

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:52


tools?​

optional tools: ITool<any, any>[] | Record<string, unknown>[]

Defined in: packages/agentos/src/api/runtime/completionGateway.ts:50