agentskit.js

Validator

Auto-generated API reference for Validator.

Interface: Validator

Defined in: validator-guard.ts:31

#Properties

#check

check: (ctx) => ValidatorResult | Promise<ValidatorResult>

Defined in: validator-guard.ts:41

Return true (or a \{ ok: true \} object) when the output passes. Return false (or \{ ok: false, reason \}) to fail.

Async checks are supported β€” useful for eval LLM-judge or RAG citation lookups.

#Parameters

ctx

ValidatorCheckContext

#Returns

ValidatorResult | Promise<ValidatorResult>


#maxRetries?

optional maxRetries?: number

Defined in: validator-guard.ts:45

Cap retries per run. Default 1.


#name

name: string

Defined in: validator-guard.ts:33

Stable id for audit logs / dashboards.


#onFail?

optional onFail?: ValidatorAction

Defined in: validator-guard.ts:43

What to do on failure. Default 'retry' (with up to maxRetries).


#repairPrompt?

optional repairPrompt?: (ctx) => string

Defined in: validator-guard.ts:50

Repair instruction appended to the regenerator on retry. Lets the agent self-correct. Receives the failure context.

#Parameters

ctx
output

string

reason?

string

#Returns

string

Explore nearby

✎ Edit this page on GitHubΒ·Found a problem? Open an issue β†’Β·How to contribute β†’

On this page