@mastra/core
Version:
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
52 lines • 1.83 kB
TypeScript
import type { Mastra, SerializedStepFlowEntry } from '..';
import { MastraBase } from '../base';
import type { RuntimeContext } from '../di';
import type { ChunkType } from '../stream/MastraWorkflowStream';
import type { Emitter, StepResult } from './types';
import type { StepFlowEntry } from '.';
/**
* Represents an execution graph for a workflow
*/
export interface ExecutionGraph<TEngineType = any> {
id: string;
steps: StepFlowEntry<TEngineType>[];
}
/**
* Execution engine abstract class for building and executing workflow graphs
* Providers will implement this class to provide their own execution logic
*/
export declare abstract class ExecutionEngine extends MastraBase {
protected mastra?: Mastra;
constructor({ mastra }: {
mastra?: Mastra;
});
__registerMastra(mastra: Mastra): void;
/**
* Executes a workflow run with the provided execution graph and input
* @param graph The execution graph to execute
* @param input The input data for the workflow
* @returns A promise that resolves to the workflow output
*/
abstract execute<TInput, TOutput>(params: {
workflowId: string;
runId: string;
graph: ExecutionGraph;
serializedStepGraph: SerializedStepFlowEntry[];
input?: TInput;
resume?: {
steps: string[];
stepResults: Record<string, StepResult<any, any, any, any>>;
resumePayload: any;
resumePath: number[];
};
emitter: Emitter;
runtimeContext: RuntimeContext;
retryConfig?: {
attempts?: number;
delay?: number;
};
abortController: AbortController;
writableStream?: WritableStream<ChunkType>;
}): Promise<TOutput>;
}
//# sourceMappingURL=execution-engine.d.ts.map