@mastra/core
Version:
70 lines • 2.88 kB
TypeScript
/**
* Deprecated durable tool-execution helpers.
*
* This is the frozen pre-unification implementation of the shared durable
* tool-call executor, preserved verbatim so the public
* `@mastra/core/agent/durable` entry point keeps its released surface at
* patch level. The durable engines no longer call it — tool execution now
* flows through the shared loop cores (`loop/shared/steps`), which handle
* background dispatch, processors, approval, and abort. New code should not
* import from this module.
*
* @deprecated Superseded by the shared loop cores; will be removed in v2.
*/
import type { RequestContext } from '../../../request-context/index.js';
import type { Workspace } from '../../../workspace/index.js';
import type { DurableToolCallInput, DurableToolCallOutput } from '../types.js';
/**
* Context for tool execution
*
* @deprecated Superseded by the shared loop cores; will be removed in v2.
*/
export interface ToolExecutionContext {
/** Tool calls from the LLM output */
toolCalls: DurableToolCallInput[];
/** Resolved tools with execute functions */
tools: Record<string, any>;
/** Run identifier */
runId: string;
/** Agent identifier */
agentId: string;
/** Message identifier */
messageId: string;
/** Serializable state */
state: any;
/** Workspace for file/sandbox operations */
workspace?: Workspace;
/** Request context for auth data, feature flags, etc. */
requestContext?: RequestContext;
/**
* Optional hooks for observability/streaming.
* All hooks can be sync or async.
*/
/** Called before starting tool execution (for span creation) */
onToolStart?: (toolCall: DurableToolCallInput) => void | Promise<void>;
/** Called after successful tool execution (for span close, pubsub emit) */
onToolResult?: (toolCall: DurableToolCallInput, result: unknown) => void | Promise<void>;
/** Called on tool execution error (for span error, pubsub emit) */
onToolError?: (toolCall: DurableToolCallInput, error: ToolExecutionError) => void | Promise<void>;
}
/**
* Error structure for tool execution failures
*
* @deprecated Superseded by the shared loop cores; will be removed in v2.
*/
export interface ToolExecutionError {
name: string;
message: string;
stack?: string;
}
/**
* Execute tool calls durably with optional hooks for observability and streaming.
*
* @deprecated Superseded by the shared loop cores; will be removed in v2.
* The durable agent workflows no longer call this helper.
*
* @param ctx - Tool execution context with tool calls, resolved tools, and optional hooks
* @returns Array of tool call outputs with results or errors
*/
export declare function executeDurableToolCalls(ctx: ToolExecutionContext): Promise<DurableToolCallOutput[]>;
//# sourceMappingURL=deprecated-tool-execution.d.ts.map