@mastra/core
Version:
38 lines • 1.97 kB
TypeScript
import type { IMastraLogger } from '../logger/index.js';
/**
* Safety cap applied to error-processor retries when the caller has not set
* `maxProcessorRetries` explicitly.
*
* This is a backstop against a processor that returns `{ retry: true }`
* unconditionally — not a retry budget to design against. Every built-in error
* processor self-limits below it (`PrefillErrorHandler` and
* `ProviderHistoryCompat` bail on `retryCount > 0`; `StreamErrorRetryProcessor`
* defaults to `maxRetries: 1`, and the shared default stack configures it for at
* most 2), so this cap only takes effect for a processor that never stops
* asking, or one configured above it.
*
* Kept deliberately low: each retry is a full model call billed to the user and
* also consumes an iteration of the agent's step budget (`stopWhen`, which
* itself defaults to 5 steps). Callers who genuinely need more must opt in via
* `maxProcessorRetries`.
*/
export declare const DEFAULT_MAX_PROCESSOR_RETRIES = 3;
/**
* Resolves the effective error-processor retry cap, warning once per agent when
* the implicit cap is what's keeping a caller-configured processor in check.
*
* The warning is gated on `hasConfiguredErrorProcessors` (the caller's own list,
* not the resolved one): the framework's default stability processors resolve
* onto every agent, and they all self-limit well below the cap, so warning
* about them would be noise on every bare agent's first model call.
*/
export declare function resolveMaxProcessorRetries({ maxProcessorRetries, hasErrorProcessors, hasConfiguredErrorProcessors, agentId, logger, }: {
maxProcessorRetries: number | undefined;
hasErrorProcessors: boolean;
hasConfiguredErrorProcessors?: boolean;
agentId?: string;
logger?: IMastraLogger;
}): number | undefined;
/** Test-only: clears the one-time warning dedupe. */
export declare function __resetProcessorRetryWarnings(): void;
//# sourceMappingURL=retry-budget.d.ts.map