FallbackPool
Defined in: core/src/fallback.ts:190
Ordered candidates with cooldowns shared across calls. Keep one pool alive
per credential set: rebuilding it per request forgets a weekly lockout.
State is in-memory and process-local; status and reset expose it without
a background timer, vendor SDK, database or global singleton.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FallbackPool<T>(candidates, options?): FallbackPool<T>;Defined in: core/src/fallback.ts:196
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
candidates |
readonly T[] |
options |
FallbackOptions<T> |
Returns
Section titled “Returns”FallbackPool<T>
Methods
Section titled “Methods”reset()
Section titled “reset()”reset(...selection): void;Defined in: core/src/fallback.ts:224
Clear a cooldown after replacing a key or fixing configuration. Omit the candidate to clear all of this pool’s own; a shared store keeps the benches of candidates only other pools hold. Does not interrupt calls in flight.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
…selection |
[] | [T] |
Returns
Section titled “Returns”void
status()
Section titled “status()”status(): object[];Defined in: core/src/fallback.ts:230
Returns
Section titled “Returns”object[]
stream()
Section titled “stream()”stream<R>( attempt, signal?, opts?): AsyncGenerator<R>;Defined in: core/src/fallback.ts:266
Only a pre-output failure can switch provider. A later failure still
cools the endpoint for FUTURE calls but never restarts the current answer.
maxAttempts counts callback invocations, not cooled candidates or waits
for a probe. Each nested recovery layer has its own limit.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
R |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attempt |
(candidate, signal) => AsyncIterable<R> |
signal? |
AbortSignal |
opts? |
Pick<StreamOptions, "maxAttempts"> |
Returns
Section titled “Returns”AsyncGenerator<R>
with()
Section titled “with()”with<R>( attempt, signal?, opts?): Promise<R>;Defined in: core/src/fallback.ts:246
Buffered calls only: do not wrap an agent turn that has run side effects.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
R |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
attempt |
(candidate, signal) => Promise<R> |
signal? |
AbortSignal |
opts? |
Pick<StreamOptions, "maxAttempts"> |
Returns
Section titled “Returns”Promise<R>