Skip to content

TrypatchAiOptions<ResultSchema, ToolContext> ​

Options for trypatch that investigate with an AI provider.

Type Parameters ​

ResultSchema ​

ResultSchema extends Schema = Schema

ToolContext ​

ToolContext = unknown

Properties ​

logging? ​

ts
optional logging?: object;

Where trypatch logs and how much; nothing is logged without a logger.

logger? ​

ts
optional logger?: LoggerLike;

Nothing is logged without one.

verbosity? ​

ts
optional verbosity?: LoggingVerbosity;

Defaults to 'high'.


getSignal? ​

ts
optional getSignal?: (ctx) => AbortSignal | undefined;

Resolves an abort signal from the investigation context (including the call's arguments), once per call. When it fires, the investigation stops and the decorated method rejects with the signal's reason.

Parameters ​

ctx ​

InvestigationContext

Returns ​

AbortSignal | undefined


timeoutMs? ​

ts
optional timeoutMs?: number;

Deadline for the whole investigation: tool rounds, MCP connections, the picked result tool and onAiInvestigationEnd. When it passes, the failure is logged and the method rethrows its original error; no deadline when unset.


onInvestigationStart? ​

ts
optional onInvestigationStart?: (ctx) => void | Promise<void>;

Called before the investigation starts, e.g. to report ctx.error. If it throws, the investigation is skipped and the decorated method rejects with its original error.

Parameters ​

ctx ​

InvestigationContext

Returns ​

void | Promise<void>


aiInvestigation ​

ts
aiInvestigation: AiInvestigationOptions<ResultSchema, ToolContext>;

Investigate with an AI provider.