/** * Tool Invoker - Core runtime for A2A tool orchestration * * Provides the execution layer for tool-to-tool invocations with: * - Timeout enforcement * - Recursion depth guards * - Context propagation * - Execution logging * - Error handling and recovery */ import { type A2AContext } from "./a2a-context.js"; import type { ToolResult } from "./tool-registry.js"; /** * Options for tool invocation */ export interface InvokeOptions { /** Override timeout for this specific invocation */ timeoutMs?: number; /** Skip execution if inputs match a recent invocation (deduplication) */ deduplicate?: boolean; /** Custom error handler for this invocation */ onError?: (error: Error) => ToolResult | Promise; } /** * Invoke a tool with A2A context support * * This is the primary entry point for tool-to-tool invocations. * It handles: * - Context creation/propagation * - Recursion depth checking * - Timeout enforcement * - Execution logging * - Error handling * * @param toolName - Name of the tool to invoke * @param args - Arguments to pass to the tool * @param context - A2A context (optional for top-level, required for nested) * @param options - Invocation options * @returns Tool execution result * @throws RecursionDepthError if maximum depth exceeded * @throws ChainTimeoutError if chain timeout exceeded * @throws ToolTimeoutError if tool timeout exceeded * @throws ToolInvocationError if tool execution fails */ export declare function invokeTool(toolName: string, args: unknown, context?: A2AContext, options?: InvokeOptions): Promise; /** * Batch invoke multiple tools in parallel * * @param invocations - Array of tool invocations * @param context - Optional A2A context * @returns Array of results (in same order as invocations) */ export declare function batchInvoke(invocations: Array<{ toolName: string; args: unknown; options?: InvokeOptions; }>, context?: A2AContext): Promise; /** * Invoke tools sequentially, passing output from one to the next * * @param chain - Array of tool invocations with optional transform functions * @param context - Optional A2A context * @param initialInput - Initial input for first tool * @returns Final tool result */ export declare function invokeSequence(chain: Array<{ toolName: string; transform?: (previousOutput: unknown) => unknown; options?: InvokeOptions; }>, context?: A2AContext, initialInput?: unknown): Promise; //# sourceMappingURL=tool-invoker.d.ts.map