UNPKG

reagentbuilder

Version:

An enterprise-grade AI agent framework based on LangChain and LangGraph, featuring dynamic tools, interceptors, breakpoints, and performance monitoring.

69 lines 2.48 kB
export declare enum ErrorType { CONFIGURATION = "CONFIGURATION", VALIDATION = "VALIDATION", RUNTIME = "RUNTIME", NETWORK = "NETWORK", TIMEOUT = "TIMEOUT", RESOURCE = "RESOURCE", PERMISSION = "PERMISSION", CRITICAL = "CRITICAL" } export declare enum ErrorSeverity { LOW = "LOW", MEDIUM = "MEDIUM", HIGH = "HIGH", CRITICAL = "CRITICAL" } export interface ErrorContext { component?: string; operation?: string; userId?: string; sessionId?: string; requestId?: string; metadata?: Record<string, any>; stackTrace?: string; timestamp?: number; originalError?: string; attempt?: number; maxRetries?: number; toolName?: string; toolsType?: string; agentName?: string; invalidTool?: any; errorType?: string; errorSeverity?: string; duration?: number; logStats?: Record<string, number>; errorStats?: Record<string, any>; } export declare class ReAgentError extends Error { readonly type: ErrorType; readonly severity: ErrorSeverity; readonly context: ErrorContext; readonly code?: string; readonly retryable: boolean; readonly timestamp: number; constructor(message: string, type?: ErrorType, severity?: ErrorSeverity, context?: ErrorContext, code?: string, retryable?: boolean); toJSON(): Record<string, any>; toString(): string; } export declare class ErrorHandler { private static instance; private errorCounts; private lastErrors; private readonly maxSimilarErrors; private readonly similarErrorWindow; private constructor(); static getInstance(): ErrorHandler; static createError(message: string, type?: ErrorType, severity?: ErrorSeverity, context?: ErrorContext, code?: string, retryable?: boolean): ReAgentError; handleError(error: Error | ReAgentError, context?: ErrorContext): ReAgentError; private shouldSuppressDuplicateError; private logError; wrapAsync<T>(fn: () => Promise<T>, context: ErrorContext, errorType?: ErrorType, severity?: ErrorSeverity): Promise<T>; wrap<T>(fn: () => T, context: ErrorContext, errorType?: ErrorType, severity?: ErrorSeverity): T; retry<T>(fn: () => Promise<T>, context: ErrorContext, maxRetries?: number, delayMs?: number, backoffMultiplier?: number): Promise<T>; getErrorStats(): Record<string, any>; clearErrorStats(): void; } export declare const errorHandler: ErrorHandler; //# sourceMappingURL=error-handler.d.ts.map