Skip to content

Tool

Type Parameter Default type

TInput

unknown

TOutput

unknown

description: string;

execute: (args, ctx?) => Promise<TOutput> | AsyncIterable<TOutput, any, any>;
Parameter Type

args

TInput

ctx?

ToolContext

Promise<TOutput> | AsyncIterable<TOutput, any, any>


optional idempotencyKey?: (args) => string;

Override the auto-derived effect key (idempotencyKey(logicalRunId, callsite, {name,args})). Use when args are not a stable identity (e.g. a nonce).

Parameter Type

args

TInput

string


optional input?: StandardSchemaV1<TInput, TInput>;

optional interim?: string;

optional interimAfterMs?: number;

optional interruptible?: boolean;

name: string;

optional needsApproval?: boolean;

optional onError?: (error, args) => TOutput | Promise<TOutput>;

Recover from a thrown error by returning a result the model can act on. Not called for timeouts, aborts, schema violations, or control-flow signals.

Parameter Type

error

Error

args

TInput

TOutput | Promise<TOutput>


optional output?: StandardSchemaV1<TOutput, TOutput>;

optional parallelSafe?: boolean | ((args) => boolean);

Safe to run concurrently with sibling calls in the same model-emitted batch. A function form receives the RAW (unvalidated) model args — classification happens before schema validation — and must not throw; a throw or a non-boolean return is treated as NOT parallel-safe. Never model-controlled: the model cannot assert this, only the tool author.


optional replay?: boolean;

When false, the durable journal always re-executes this tool instead of returning a cached step result — for observation/mutation tools (fs, shell) whose result must be fresh. Default true.


optional timeoutMs?: number;