UNPKG

@mastra/core

Version:

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

40 lines 1.64 kB
/** * Create a durable tool call step. * * This step mirrors the base Agent's createToolCallStep pattern: * 1. Resolves the tool from the run registry or Mastra * 2. Checks if approval is required (global or per-tool) * 3. If approval required, emits suspended event, persists messages, and suspends * 4. Executes the tool with a suspend callback for in-execution suspension * 5. Emits tool-result or tool-error chunks via PubSub * 6. Returns the result or error * * Tool suspension is handled via workflow suspend/resume mechanism: * - Tool approval: step suspends with approval payload * - In-execution suspension: tool calls suspend() callback, step suspends with suspension payload * - Message persistence: messages are flushed before any suspension */ export declare function createDurableToolCallStep(): import("../../../../workflows").Step<"durable-tool-call", unknown, { toolCallId: string; toolName: string; args: Record<string, any>; providerMetadata?: Record<string, any> | undefined; providerExecuted?: boolean | undefined; output?: any; activeTools?: string[] | null | undefined; }, { toolCallId: string; toolName: string; args: Record<string, any>; providerMetadata?: Record<string, any> | undefined; providerExecuted?: boolean | undefined; output?: any; activeTools?: string[] | null | undefined; result?: any; error?: { name: string; message: string; stack?: string | undefined; } | undefined; }, unknown, unknown, import("../../../../workflows").DefaultEngineType, unknown>; //# sourceMappingURL=tool-call.d.ts.map