import { z } from "zod"; import { LLM } from "../llms/base"; import { SearchResult } from "../types"; import { HistoryManager } from "../storage/base"; export declare const SearchAgentDecisionSchema: z.ZodObject<{ needsAdditionalSteps: z.ZodBoolean; reasoning: z.ZodDefault>; needsAnotherHop: z.ZodDefault>; hopReasoning: z.ZodDefault>; nextSteps: z.ZodDefault; parameters: z.ZodDefault>; memoryId: z.ZodDefault>; entityId: z.ZodDefault>; timeRange: z.ZodDefault>; end: z.ZodDefault>; }, "strip", z.ZodTypeAny, { start: string | null; end: string | null; }, { start?: string | null | undefined; end?: string | null | undefined; }>]>>>; count: z.ZodDefault>; researchQuery: z.ZodDefault>; researchType: z.ZodDefault>; includeMessages: z.ZodDefault>; exact: z.ZodDefault>; dateContext: z.ZodDefault>; }, "strip", z.ZodTypeAny, { exact: boolean | null; timeRange: string | { start: string | null; end: string | null; } | null; memoryId: string | null; messageId: string | null; entityId: string | null; count: number | null; researchQuery: string | null; researchType: string | null; includeMessages: boolean | null; dateContext: string | null; }, { exact?: boolean | null | undefined; timeRange?: string | { start?: string | null | undefined; end?: string | null | undefined; } | null | undefined; memoryId?: string | null | undefined; messageId?: string | null | undefined; entityId?: string | null | undefined; count?: number | null | undefined; researchQuery?: string | null | undefined; researchType?: string | null | undefined; includeMessages?: boolean | null | undefined; dateContext?: string | null | undefined; }>>>; priority: z.ZodDefault>; }, "strip", z.ZodTypeAny, { action: "get_next_messages" | "get_prev_messages" | "get_entity_memories" | "get_time_based_memories" | "semantic_research" | "get_message_details" | "get_conversation_context" | "search_all_messages" | "get_messages_by_pattern" | "deduce_memory_date" | "finished"; parameters: { exact: boolean | null; timeRange: string | { start: string | null; end: string | null; } | null; memoryId: string | null; messageId: string | null; entityId: string | null; count: number | null; researchQuery: string | null; researchType: string | null; includeMessages: boolean | null; dateContext: string | null; } | null; priority: number | null; }, { action: "get_next_messages" | "get_prev_messages" | "get_entity_memories" | "get_time_based_memories" | "semantic_research" | "get_message_details" | "get_conversation_context" | "search_all_messages" | "get_messages_by_pattern" | "deduce_memory_date" | "finished"; parameters?: { exact?: boolean | null | undefined; timeRange?: string | { start?: string | null | undefined; end?: string | null | undefined; } | null | undefined; memoryId?: string | null | undefined; messageId?: string | null | undefined; entityId?: string | null | undefined; count?: number | null | undefined; researchQuery?: string | null | undefined; researchType?: string | null | undefined; includeMessages?: boolean | null | undefined; dateContext?: string | null | undefined; } | null | undefined; priority?: number | null | undefined; }>, "many">>>; }, "strip", z.ZodTypeAny, { needsAdditionalSteps: boolean; reasoning: string | null; needsAnotherHop: boolean | null; hopReasoning: string | null; nextSteps: { action: "get_next_messages" | "get_prev_messages" | "get_entity_memories" | "get_time_based_memories" | "semantic_research" | "get_message_details" | "get_conversation_context" | "search_all_messages" | "get_messages_by_pattern" | "deduce_memory_date" | "finished"; parameters: { exact: boolean | null; timeRange: string | { start: string | null; end: string | null; } | null; memoryId: string | null; messageId: string | null; entityId: string | null; count: number | null; researchQuery: string | null; researchType: string | null; includeMessages: boolean | null; dateContext: string | null; } | null; priority: number | null; }[] | null; }, { needsAdditionalSteps: boolean; reasoning?: string | null | undefined; needsAnotherHop?: boolean | null | undefined; hopReasoning?: string | null | undefined; nextSteps?: { action: "get_next_messages" | "get_prev_messages" | "get_entity_memories" | "get_time_based_memories" | "semantic_research" | "get_message_details" | "get_conversation_context" | "search_all_messages" | "get_messages_by_pattern" | "deduce_memory_date" | "finished"; parameters?: { exact?: boolean | null | undefined; timeRange?: string | { start?: string | null | undefined; end?: string | null | undefined; } | null | undefined; memoryId?: string | null | undefined; messageId?: string | null | undefined; entityId?: string | null | undefined; count?: number | null | undefined; researchQuery?: string | null | undefined; researchType?: string | null | undefined; includeMessages?: boolean | null | undefined; dateContext?: string | null | undefined; } | null | undefined; priority?: number | null | undefined; }[] | null | undefined; }>; export interface SearchAgentOptions { userId?: string; agentId?: string; runId?: string; maxSteps?: number; enableMultihop?: boolean; maxHops?: number; reasoningCustomInstructions?: string; } export interface SearchFunction { (query: string, options?: any): Promise; } export interface AgentStatistics { totalHops: number; totalAgentCalls: number; agentCallsByName: Record; totalStepsExecuted: number; successfulSteps: number; additionalResultsFound: number; startTime: number; endTime?: number; } export declare class SearchAgents { private llm; private db; private searchFunction?; private statistics; constructor(llm: LLM, db: HistoryManager, searchFunction?: SearchFunction | undefined); private trackAgentCall; private logSummary; finalizeSingleHopAnalysis(): void; private addPatternSearchIfNeeded; analyzeSearchNeed(query: string, searchResult: SearchResult, options: SearchAgentOptions, hopNumber?: number): Promise; executeMultihopAnalysis(query: string, initialSearchResult: SearchResult, options: SearchAgentOptions): Promise<{ finalResult: SearchResult; hopResults: Array<{ hopNumber: number; decision: SearchAgentDecision; stepResults: Array<{ action: string; results: any; success: boolean; }>; additionalResults: any[]; }>; }>; executeSteps(decision: SearchAgentDecision, options: SearchAgentOptions, shouldLogSummary?: boolean, query?: string): Promise<{ stepResults: Array<{ action: string; results: any; success: boolean; }>; additionalResults: any[]; }>; private deduceMemoryDate; private filterAdditionalResults; } interface SearchAgentDecision { needsAdditionalSteps: boolean; reasoning: string; needsAnotherHop: boolean; hopReasoning: string; nextSteps: Array<{ action: string; parameters: Record; priority: number; }>; } export {};