import type { CoreMessage } from '../../_types/@internal_ai-sdk-v4/dist/index.d.ts'; import type { Agent, AgentExecutionOptions, AiMessageType, UIMessageWithMetadata } from '../../agent/index.js'; import type { ObservabilityContext } from '../../observability/index.js'; import type { RequestContext } from '../../request-context/index.js'; import type { WorkflowResult, WorkflowRunStartOptions } from '../../workflows/types.js'; import type { AnyWorkflow } from '../../workflows/workflow.js'; import { Workflow } from '../../workflows/workflow.js'; import type { MastraScorer } from '../base.js'; type WorkflowRunOptions = WorkflowRunStartOptions & { initialState?: any; }; type RunEvalsDataItem = { input: TTarget extends Workflow ? any : TTarget extends Agent ? string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[] : unknown; groundTruth?: any; expectedTrajectory?: any; requestContext?: RequestContext; startOptions?: WorkflowRunOptions; } & Partial; export type WorkflowScorerConfig = { /** Scorers that evaluate the overall workflow input/output */ workflow?: MastraScorer[]; /** Scorers that evaluate individual workflow steps by step ID */ steps?: Record[]>; /** Scorers that evaluate the workflow's step execution trajectory */ trajectory?: MastraScorer[]; }; export type AgentScorerConfig = { /** Scorers that evaluate the full agent input/output */ agent?: MastraScorer[]; /** Scorers that evaluate the agent's tool call trajectory */ trajectory?: MastraScorer[]; }; /** Threshold configuration: a number implies minimum, or an object with min/max bounds. */ export type ThresholdConfig = number | { min?: number; max?: number; }; /** A scorer with an associated pass/fail threshold. */ export type ScorerWithThreshold = { scorer: MastraScorer; /** A number implies minimum threshold. Use { min, max } for range-based checks. */ threshold: ThresholdConfig; }; /** A scorer entry: either a bare scorer or one with a threshold. */ export type ScorerEntry = MastraScorer | ScorerWithThreshold; /** Result of a gate evaluation for a single data item. */ export type GateResult = { id: string; passed: boolean; score: number; }; /** Verdict of an eval run. */ export type EvalVerdict = 'passed' | 'scored' | 'failed'; type RunEvalsResult = { scores: Record; summary: { totalItems: number; }; /** Present when `gates` or threshold-bearing scorers are provided. */ verdict?: EvalVerdict; /** Per-gate results (averaged across all data items). */ gateResults?: GateResult[]; /** Per-threshold-scorer results (averaged across all data items). */ thresholdResults?: Array<{ id: string; passed: boolean; averageScore: number; threshold: ThresholdConfig; }>; }; export declare function runEvals(config: { data: RunEvalsDataItem[]; /** Gates: scorers that must score 1.0 for the run to pass. */ gates: MastraScorer[]; scorers?: ScorerEntry[]; target: TAgent; targetOptions?: Omit, 'scorers' | 'returnScorerData' | 'requestContext'>; onItemComplete?: (params: { item: RunEvalsDataItem; targetResult: Awaited>; scorerResults: Record; }) => void | Promise; concurrency?: number; }): Promise; export declare function runEvals(config: { data: RunEvalsDataItem[]; scorers: ScorerEntry[]; target: TAgent; /** Gates: scorers that must score 1.0 for the run to pass. */ gates?: MastraScorer[]; targetOptions?: Omit, 'scorers' | 'returnScorerData' | 'requestContext'>; onItemComplete?: (params: { item: RunEvalsDataItem; targetResult: Awaited>; scorerResults: Record; }) => void | Promise; concurrency?: number; }): Promise; export declare function runEvals(config: { data: RunEvalsDataItem[]; scorers: MastraScorer[]; target: TWorkflow; targetOptions?: WorkflowRunOptions; onItemComplete?: (params: { item: RunEvalsDataItem; targetResult: WorkflowResult; scorerResults: Record; }) => void | Promise; concurrency?: number; }): Promise; export declare function runEvals(config: { data: RunEvalsDataItem[]; scorers: WorkflowScorerConfig; target: TWorkflow; targetOptions?: WorkflowRunOptions; onItemComplete?: (params: { item: RunEvalsDataItem; targetResult: WorkflowResult; scorerResults: { workflow?: Record; steps?: Record>; trajectory?: Record; }; }) => void | Promise; concurrency?: number; }): Promise; export declare function runEvals(config: { data: RunEvalsDataItem[]; scorers: AgentScorerConfig; target: TAgent; targetOptions?: Omit, 'scorers' | 'returnScorerData' | 'requestContext'>; onItemComplete?: (params: { item: RunEvalsDataItem; targetResult: Awaited>; scorerResults: { agent?: Record; trajectory?: Record; }; }) => void | Promise; concurrency?: number; }): Promise; export {}; //# sourceMappingURL=index.d.ts.map