UNPKG

@mastra/core

Version:
39 lines • 2.37 kB
import type { MastraScorer } from '../../../../evals/base.js'; import type { Mastra } from '../../../../mastra/index.js'; import { createObservabilityContext } from '../../../../observability/index.js'; import { RequestContext } from '../../../../request-context/index.js'; import type { StoredMessageLoader } from '../../../message-list/memory-message-refs.js'; import type { DurableAgenticLoopOutput, DurableAgenticWorkflowInput } from '../../types.js'; export interface ExecuteDurableAgentScorersParams { /** Workflow init data, carrying the serialized scorer config and run identity. */ initData: DurableAgenticWorkflowInput; /** The run's final output, carrying the response messages to score. */ finalOutput: Pick<DurableAgenticLoopOutput, 'messageListState'>; mastra?: Mastra; requestContext?: RequestContext; tracingContext?: Parameters<typeof createObservabilityContext>[0]; /** Loads response messages the run pruned from its transcript (kept there by id only) from memory. */ loadStoredMessages?: StoredMessageLoader; /** * Scorer instances parked in-process for this run (see `setRunScorerInstances`), keyed like * `initData.scorers`. They take precedence over name resolution so a scorer * passed at call time (or via `defaultOptions.scorers`) runs even when it is * not registered on Mastra (#27579). */ scorerInstances?: Record<string, MastraScorer>; } /** * Run an agent's configured scorers after a durable run completes. * * Every durable engine needs this, so it lives here rather than inside one * engine's workflow builder: the Inngest engine shipped without scorers purely * because its builder was a copy that missed a step core later added. Sharing * the implementation means a scorer change lands on every engine at once. * * Scoring is fire-and-forget and must never affect the run: scorers come from * the in-process run when available, otherwise they are resolved by * name from the Mastra instance (so this is safe on a worker in another * process), and anything that goes wrong is logged and skipped. */ export declare function executeDurableAgentScorers({ initData, finalOutput, mastra, requestContext, tracingContext, loadStoredMessages, scorerInstances, }: ExecuteDurableAgentScorersParams): Promise<void>; //# sourceMappingURL=execute-scorers.d.ts.map