@mastra/core
Version:
58 lines • 2.48 kB
TypeScript
import type { Agent } from '../../agent/index.js';
import type { MastraScorer } from '../../evals/base.js';
import type { ScorerRunInputForAgent, ScorerRunOutputForAgent } from '../../evals/types.js';
import type { VersionOverrides } from '../../mastra/types.js';
import type { TargetType } from '../../storage/types.js';
import type { StepResult, Workflow } from '../../workflows/index.js';
import type { ItemToolMock, ToolMockReport } from './tool-mocks.js';
/**
* Target types supported for dataset execution.
* Agent and Workflow are Phase 2; scorer and processor are Phase 4.
*/
export type Target = Agent | Workflow | MastraScorer<any, any, any, any>;
/**
* Result from executing a target against a dataset item.
*/
export interface ExecutionResult {
/** Output from the target (null if failed) */
output: unknown;
/** Structured error if execution failed */
error: {
message: string;
stack?: string;
code?: string;
} | null;
/** Trace ID from agent/workflow execution (null for scorers or errors) */
traceId: string | null;
/** Root span ID from agent/workflow execution (null when not traced) */
spanId?: string | null;
/** Structured input for scorers (extracted from agent scoring data) */
scorerInput?: ScorerRunInputForAgent;
/** Structured output for scorers (extracted from agent scoring data) */
scorerOutput?: ScorerRunOutputForAgent;
/** Per-step results from a workflow run, keyed by step ID */
stepResults?: Record<string, StepResult<any, any, any, any>>;
/** Order in which workflow steps actually executed */
stepExecutionPath?: string[];
/** Diagnostic receipt for item-level tool mocks (agent targets only) */
toolMockReport?: ToolMockReport;
}
/**
* Execute a dataset item against a target (agent, workflow, scorer, processor).
* Phase 2: agent/workflow. Phase 4: scorer. Processor deferred.
*/
export declare function executeTarget(target: Target, targetType: TargetType, item: {
input: unknown;
groundTruth?: unknown;
metadata?: Record<string, unknown>;
resumeSteps?: Record<string, unknown>;
resumeData?: unknown;
}, options?: {
signal?: AbortSignal;
requestContext?: Record<string, unknown>;
experimentId?: string;
versions?: VersionOverrides;
/** Item-level static tool mocks (agent targets only). */
toolMocks?: ItemToolMock[];
}): Promise<ExecutionResult>;
//# sourceMappingURL=executor.d.ts.map