InvestigationBehavior
type InvestigationBehavior = object;Prompts, argument sanitization, and which built-in tools and outcomes the AI may use.
Properties
prompt?
optional prompt?: string | ((ctx) => string);Replaces the default user prompt. A function receives the investigation context with args already passed through sanitizeArgs.
systemPrompt?
optional systemPrompt?: string;Replaces the default system prompt.
sanitizeArgs?
optional sanitizeArgs?: (args) => unknown[];Transforms the call's arguments before they go into the prompt, default or custom.
Parameters
args
unknown[]
Returns
unknown[]
allowMethodSource?
optional allowMethodSource?: boolean;Whether the default prompt includes the method's code (InvestigationContext.methodSource), so the AI can see what the failed call was meant to do. It is sent to the provider (after redactConfig), so leave it off if your code must not leave your infrastructure.
Default Value
false
allowSafeToolbox?
optional allowSafeToolbox?: boolean;Whether the AI may also call the tools in trypatch's built-in safe toolbox (waiting, reading truncated parts of the failed call, encoding/decoding) alongside AiInvestigationOptions.investigationTools.
Default Value
true
allowDirectResultCreation?
optional allowDirectResultCreation?: boolean;Whether the AI may return a result directly, versus only via AiInvestigationOptions.resultTools/AiInvestigationOptions.customErrors.
Default Value
true
allowCannotDetermine?
optional allowCannotDetermine?: boolean;Whether the AI may report that there isn't enough information to work out a correct return value. Ends the investigation with TrypatchCannotDetermineError, which is logged; the method then rethrows its original error.
Default Value
true
allowUncertainResult?
optional allowUncertainResult?: boolean;Whether the AI may report that a plausible return value exists but its confidence in it is too low to return it, instead of guessing. Ends the investigation with TrypatchUncertainResultError, which is logged; the method then rethrows its original error.
Default Value
true
allowNoApplicableOutcome?
optional allowNoApplicableOutcome?: boolean;Whether the AI may report that none of the configured outcomes actually fit the situation. Ends the investigation with TrypatchNoApplicableOutcomeError, which is logged; the method then rethrows its original error.
Default Value
true