import { AgentAdapter } from './agent-adapter.js'; import { ChatMessage, ToolCall, ToolDefinition } from './types.js'; export interface AgentRunnerConfig { /** The adapter instance that handles communication with the AI model */ adapter: AgentAdapter; /** The user prompt to send to the agent */ prompt: string; /** Optional tools the agent can call during execution */ tools?: ToolDefinition[]; /** Execution mode: 'one-shot' stops after first response, 'multi-turn' allows tool usage loops. @default 'one-shot' */ mode?: 'one-shot' | 'multi-turn'; /** Maximum conversation turns in multi-turn mode to prevent infinite loops. @default 20 */ maxTurns?: number; /** Callback fired when agent starts generating a new message */ onStart?: (messageId: string) => void; /** Callback fired for each text chunk as it streams in */ onDelta?: (delta: string) => void; /** Callback fired when agent requests a tool call */ onToolCall?: (toolCall: ToolCall) => void; /** Callback fired when execution completes with final result */ onComplete?: (result: AgentRunnerResult) => void; } export interface AgentRunnerResult { /** Complete message history including user, assistant, and tool messages */ messages: ChatMessage[]; /** The final assistant message returned by the agent */ finalMessage: ChatMessage; /** All tool calls executed during the conversation */ toolCalls: ToolCall[]; /** Number of conversation turns completed */ turns: number; /** Whether execution completed successfully without errors */ success: boolean; /** Reason execution stopped: 'text-response' (natural completion), 'max-turns' (hit turn limit), 'error' (failed), or 'one-shot-complete' (single turn mode) */ stoppedReason: 'text-response' | 'max-turns' | 'error' | 'one-shot-complete'; } export declare class AgentRunner { #private; private constructor(); static run(config: AgentRunnerConfig): Promise; }