/** * Guardrails - Input/output validation and safety checks * * Python parity with praisonaiagents/guardrails module */ export type GuardrailStatus = 'passed' | 'failed' | 'warning'; export interface GuardrailResult { status: GuardrailStatus; message?: string; details?: Record; modifiedContent?: string; } /** * Result of a guardrail validation. * * Python parity: praisonaiagents/guardrails/guardrail_result.py:13-43 * * This is the Pydantic-style result that matches the Python SDK. */ export interface GuardrailValidationResult { /** Whether the guardrail check passed */ success: boolean; /** The result if modified, or null if unchanged */ result: string | null; /** Error message if validation failed */ error: string; } /** * Create a GuardrailValidationResult with defaults. */ export declare function createGuardrailValidationResult(config?: Partial): GuardrailValidationResult; /** * Create a GuardrailValidationResult from a tuple. * * Python parity: praisonaiagents/guardrails/guardrail_result.py:20-43 */ export declare function guardrailResultFromTuple(tuple: [boolean, string | null]): GuardrailValidationResult; export type GuardrailFunction = (content: string, context?: GuardrailContext) => Promise | GuardrailResult; export interface GuardrailContext { role: 'input' | 'output'; agentName?: string; sessionId?: string; metadata?: Record; } export interface GuardrailConfig { name: string; description?: string; check: GuardrailFunction; onFail?: 'block' | 'warn' | 'modify'; } /** * Guardrail class */ export declare class Guardrail { readonly name: string; readonly description: string; readonly check: GuardrailFunction; readonly onFail: 'block' | 'warn' | 'modify'; constructor(config: GuardrailConfig); run(content: string, context?: GuardrailContext): Promise; } /** * Create a guardrail */ export declare function guardrail(config: GuardrailConfig): Guardrail; /** * Guardrail Manager - Run multiple guardrails */ export declare class GuardrailManager { private guardrails; add(g: Guardrail): this; runAll(content: string, context?: GuardrailContext): Promise<{ passed: boolean; results: Array<{ name: string; result: GuardrailResult; }>; }>; get count(): number; } /** * Built-in guardrails */ export declare const builtinGuardrails: { /** * Check for maximum length */ maxLength: (maxChars: number) => Guardrail; /** * Check for minimum length */ minLength: (minChars: number) => Guardrail; /** * Check for blocked words */ blockedWords: (words: string[]) => Guardrail; /** * Check for required words */ requiredWords: (words: string[]) => Guardrail; /** * Regex pattern check */ pattern: (regex: RegExp, mustMatch?: boolean) => Guardrail; /** * JSON validity check */ validJson: () => Guardrail; };