UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

63 lines 2.43 kB
import type { IMastraLogger } from '../../logger/index.js'; import type { Mastra } from '../../mastra/index.js'; import { RequestContext } from '../../request-context/index.js'; import type { Agent } from '../agent.js'; import type { AgentExecutionOptions } from '../agent.types.js'; import { MessageList } from '../message-list/index.js'; import type { MessageListInput } from '../message-list/index.js'; import type { DurableAgenticWorkflowInput, RunRegistryEntry } from './types.js'; /** * Result from the preparation phase */ export interface PreparationResult<_OUTPUT = undefined> { /** Unique run identifier */ runId: string; /** Message ID for this generation */ messageId: string; /** Serialized workflow input */ workflowInput: DurableAgenticWorkflowInput; /** Non-serializable state for the run registry */ registryEntry: RunRegistryEntry; /** MessageList for callback access */ messageList: MessageList; /** Thread ID if using memory */ threadId?: string; /** Resource ID if using memory */ resourceId?: string; } /** * Options for preparation phase */ export interface PreparationOptions<OUTPUT = undefined> { /** The agent instance */ agent: Agent<string, any, OUTPUT>; /** User messages to process */ messages: MessageListInput; /** Execution options */ options?: AgentExecutionOptions<OUTPUT>; /** Run ID (will be generated if not provided) */ runId?: string; /** Request context */ requestContext?: RequestContext; /** Logger */ logger?: IMastraLogger; /** Mastra instance (for version overrides, background tasks, etc.) */ mastra?: Mastra; } /** * Prepare for durable agent execution. * * This function performs the non-durable preparation phase: * 1. Generates run ID and message ID * 2. Resolves thread/memory context * 3. Creates MessageList with instructions and messages * 4. Converts tools to CoreTool format * 5. Gets the model configuration * 6. Creates serialized workflow input * 7. Creates run registry entry for non-serializable state * * The result includes both the serialized workflow input (for the durable * workflow) and the run registry entry (for non-serializable state). */ export declare function prepareForDurableExecution<OUTPUT = undefined>(options: PreparationOptions<OUTPUT>): Promise<PreparationResult<OUTPUT>>; //# sourceMappingURL=preparation.d.ts.map