Skip to content

ToolExecutor

Encapsulates tool execution with enforcement, idempotency, and context enrichment. Shared by Runtime (text path) and VoiceEngine (audio path).

buildIdempotencyKey(args): string;

Build a deterministic idempotency key for external side-effect deduplication.

Parameter Type

args

{ agentId: string; sessionId: string; step: number; toolCallId: string; toolName: string; }

args.agentId

string

args.sessionId

string

args.step

number

args.toolCallId

string

args.toolName

string

string


execute(args): Promise<unknown>;

Execute a single tool call with enforcement checks and context enrichment. Returns the tool’s result or throws if blocked/failed.

Parameter Type Description

args

{ abortSignal?: AbortSignal; agentId: string; input: unknown; session: Session; step?: number; tool: ExecutableTool; toolCallHistory?: ToolCallRecord[]; toolCallId?: string; toolName: string; turn?: number; userId?: string; }

args.abortSignal?

AbortSignal

args.agentId

string

args.input

unknown

args.session

Session

args.step?

number

args.tool

ExecutableTool

args.toolCallHistory?

ToolCallRecord[]

Full tool call history for enforcement context.

args.toolCallId?

string

args.toolName

string

args.turn?

number

args.userId?

string

Promise<unknown>