import { AgentStatus, AgentOptions, AgentRunStreamingOptions, AgentRunNonStreamingOptions, AgentEventStream, Tool, SummaryRequest, SummaryResponse, IAgent, ChatCompletionCreateParams, ChatCompletion } from '@multimodal/agent-interface'; import { BaseAgent } from './base-agent'; import { AgentEventStreamProcessor } from './event-stream'; import { ResolvedModel, OpenAI, RequestOptions, ChatCompletionChunk } from '@multimodal/model-provider'; import { AgentExecutionController } from './execution-controller'; /** * An event-stream driven agent framework for building effective multimodal Agents. * * - Multi-turn reasoning agent loop * - highly customizable, easy to build higher-level Agents * - Tool registration and execution * - Multimodal context awareness and management * - Communication with multiple LLM providers * - Event stream management for tracking agent loop state */ export declare class Agent extends BaseAgent implements IAgent { private instructions; private maxIterations; private maxTokens; protected name: string; protected id: string; protected eventStream: AgentEventStreamProcessor; private toolManager; private modelResolver; private temperature; private reasoningOptions; private runner; logger: import("@agent-infra/logger/dist/console-logger").ConsoleLogger; protected executionController: AgentExecutionController; private customLLMClient?; initialized: boolean; isReplaySnapshot: boolean; private currentResolvedModel?; private isCustomLLMClientSet; private executionStartTime; /** * Creates a new Agent instance. * * @param options - Configuration options for the agent including instructions, * tools, model selection, and runtime parameters. */ constructor(options?: AgentOptions); /** * Initialize early resolved model if model configuration is available * This allows LLM client to be available immediately after instantiation */ private initializeEarlyResolvedModel; /** * Custom LLM client for testing or custom implementations * * @param customLLMClient - OpenAI-compatible llm client */ setCustomLLMClient(client: OpenAI): void; /** * Gets the current iteration/loop number of the agent's reasoning process * This is useful for tracking progress and debugging * * @returns The current loop iteration (1-based, 0 if not running) */ getCurrentLoopIteration(): number; /** * Registers a new tool that the agent can use during execution. * Tools are stored in a map keyed by the tool name. * * @param tool - The tool definition to register */ registerTool(tool: Tool): void; /** * Returns all registered tools as an array. * * @returns Array of all registered tool definitions */ getTools(): Tool[]; /** * Provides the default instructions used when none are specified. * These instructions define the agent's basic behavior and capabilities. * * @returns The default instructions string * @private */ private getDefaultPrompt; /** * Returns the event stream manager associated with this agent. * The event stream tracks all conversation events including messages, * tool calls, and system events. * * @returns The EventStream instance */ getEventStream(): AgentEventStreamProcessor; /** * Returns a string identifier for the agent, including ID if available. * Used for logging and identification purposes. * * @returns A string in format "name (id)" or just "name" if id is not available * @protected */ protected getAgentIdentifier(): string; /** * Executes the main agent reasoning loop. * * This method processes the user input, communicates with the LLM, * executes tools as requested by the LLM, and continues iterating * until a final answer is reached or max iterations are hit. * * @param input - String input for a basic text message * @returns The final response event from the agent (stream is false) */ run(input: string): Promise; /** * Executes the main agent reasoning loop with additional options. * * @param options - Object with input and optional configuration * @returns The final response event from the agent (when stream is false) */ run(options: AgentRunNonStreamingOptions): Promise; /** * Executes the main agent reasoning loop with streaming support. * * @param options - Object with input and streaming enabled * @returns An async iterable of streaming events */ run(options: AgentRunStreamingOptions): Promise>; /** * Sanitize run options to remove sensitive or unnecessary data before including in events * @param options The run options to sanitize * @returns A safe version of run options for including in events * @private */ private sanitizeRunOptions; /** * Get the configured LLM client for making direct requests * * @returns The configured OpenAI-compatible LLM client instance */ getLLMClient(): OpenAI | undefined; /** * Generate a summary of the provided conversation messages * FIXME: using current event stream to generate summary. * * @param request The summary request containing messages and optional model settings * @returns Promise resolving to the summary response */ generateSummary(request: SummaryRequest): Promise; /** * Get the current resolved model configuration * This is available after the agent loop has started * * @returns The current resolved model configuration or undefined if not set */ getCurrentResolvedModel(): ResolvedModel | undefined; /** * Aborts the currently running agent task if one exists * @returns True if an execution was aborted, false otherwise */ abort(): boolean; /** * Returns the current execution status of the agent */ status(): AgentStatus; /** * Get the custom LLM client if it was provided * @returns The custom LLM client or undefined if none was provided */ getCustomLLMClient(): OpenAI | undefined; /** * Update the internal `isReplaySnapshot` state, used for the Agent Snapshot frmaework. */ _setIsReplay(): void; /** * Override the onAgentLoopEnd from BaseAgent to add execution controller cleanup */ onAgentLoopEnd(id: string): Promise; /** * Convenient method to call the current selected LLM * This method encapsulates the common pattern of getting the LLM client and resolved model, * and provides better error handling when these are not available. * * @param params - ChatCompletion parameters (model will be automatically set from current resolved model) * @param options - Optional request options (e.g., signal for abort) * @returns Promise resolving to the LLM response with proper type inference based on stream parameter * @throws Error if LLM client or resolved model is not available */ callLLM(params: Omit & { stream?: false; }, options?: RequestOptions): Promise; callLLM(params: Omit & { stream: true; }, options?: RequestOptions): Promise>; /** * Returns all available tools, filtered/modified by onRetrieveTools hook * * This method provides a way to get the current set of tools that would be * available to the agent, after passing through the onRetrieveTools hook. * * Note: If the onRetrieveTools implementation depends on runtime state that * changes during execution, the result of this method may differ from * the actual tools used during run(). * * @returns Promise resolving to array of available tool definitions */ getAvailableTools(): Promise; } //# sourceMappingURL=agent.d.ts.map