/** * 🧠 Smart AI Agent - Advanced LangGraph-based AI Agent * Inspired by Endorphin AI's sophisticated agent architecture * * Features: * - LangGraph State Management with memory persistence * - Intelligent loop detection and prevention * - Advanced token tracking and cost management * - Tool selection intelligence with reasoning * - Conversation memory for context awareness * - Smart stop conditions and completion logic */ import { Tool } from '@langchain/core/tools'; export interface SmartAgentConfig { openai: { apiKey: string; modelName: string; }; agent: { recursionLimit: number; timeout: number; stopPhrases: string[]; }; execution: { stepDelay: number; maxRetries: number; retryDelay: number; }; } export interface AgentCall { historyId: number; timestamp: string; thinking: string; prompt: string; response: string; tokenUsage: { promptTokens: number; responseTokens: number; totalTokens: number; cost: number; model: string; }; duration: number; context: string; } export interface TestSession { sessionId: string; testName: string; startTime: number; agentHistory: AgentCall[]; totalCost: number; totalTokens: number; } export declare class SmartAIAgent { private llm; private config; private currentSession; private agentCallCounter; private tools; private messageHistory; constructor(config: SmartAgentConfig); /** * Set the current test session for tracking */ setCurrentSession(session: TestSession | null): void; /** * Track AI calls with detailed analytics */ private trackAICall; /** * Set tools for the agent */ setTools(tools: Tool[]): void; /** * Intelligent similarity detection for loop prevention */ private isSimilarMessage; /** * Calculate string similarity using Levenshtein distance */ private calculateSimilarity; /** * Levenshtein distance calculation */ private levenshteinDistance; /** * Check for intelligent stop conditions */ private shouldStop; /** * Execute intelligent agent reasoning */ private executeReasoning; /** * Execute a task with intelligent agent reasoning */ executeTask(taskDescription: string): Promise<{ success: boolean; result: string; session?: TestSession; }>; /** * Get current session statistics */ getSessionStats(): TestSession | null; /** * Get Smart AI Agent statistics for the demo */ getSmartAgentStats(): { agentCalls: number; toolExecutions: number; successRate: number; avgResponseTime: number; estimatedCost: number; }; /** * Clear session and reset agent */ clearSession(): void; } //# sourceMappingURL=SmartAIAgent.d.ts.map