import { AgentResult, type AgentStreamEvent, type InvokableAgent, type InvokeArgs, type InvokeOptions, type LocalAgent, type localAgentSymbol } from '../types/agent.js'; import { Message, type MessageData, type SystemPrompt, type SystemPromptData } from '../types/messages.js'; import type { JSONValue } from '../types/json.js'; import { McpClient } from '../mcp.js'; import { type Tool } from '../tools/tool.js'; import { Model } from '../models/model.js'; import type { BaseModelConfig } from '../models/model.js'; import { ToolRegistry } from '../registry/tool-registry.js'; import { StateStore } from '../state-store.js'; import type { Plugin } from '../plugins/plugin.js'; import type { InterventionHandler } from '../interventions/handler.js'; import { ConversationManager } from '../conversation-manager/conversation-manager.js'; import type { MiddlewareStage, MiddlewareHandler, MiddlewareInputHandler, MiddlewareOutputHandler, MiddlewareInputPhase, MiddlewareWrapPhase, MiddlewareOutputPhase } from '../middleware/index.js'; import type { HookableEventConstructor, HookCallback, HookCallbackOptions, HookCleanup } from '../hooks/types.js'; import { HookableEvent } from '../hooks/events.js'; import type { AgentAsToolOptions } from './agent-as-tool.js'; import type { ToolCallerProxy } from './tool-caller.js'; import type { z } from 'zod'; import { MemoryManager } from '../memory/memory-manager.js'; import type { MemoryManagerConfig } from '../memory/index.js'; import { SessionManager } from '../session/session-manager.js'; import type { AttributeValue } from '@opentelemetry/api'; import type { RetryStrategy } from '../retry/retry-strategy.js'; import { InterruptState } from '../interrupt.js'; import type { TakeSnapshotOptions } from './snapshot.js'; import type { Snapshot } from '../types/snapshot.js'; import type { Sandbox } from '../sandbox/base.js'; /** * Recursive type definition for nested tool arrays. * Allows tools to be organized in nested arrays of any depth. * * {@link Agent} instances in the array are automatically wrapped via * {@link Agent.asTool}, so they can be passed directly without calling * `.asTool()` explicitly. */ export type ToolList = (Tool | McpClient | Agent | ToolList)[]; /** * Strategy for executing tool calls that the model emits in a single assistant turn. * * - `'concurrent'` (default) — runs all tool calls from a single turn in parallel. Per-tool event * order (`BeforeToolCallEvent` → `ToolStreamUpdateEvent*` → `AfterToolCallEvent` → * `ToolResultEvent`) is preserved, while cross-tool events may interleave. * - `'sequential'` — runs tool calls one at a time * * Cancellation works identically in both modes: {@link Agent.cancel} flips * {@link Agent.cancelSignal} and tools must observe it cooperatively to stop early. * In concurrent mode, prompt batch-wide cancellation requires every in-flight tool * to honor the signal. */ export type ToolExecutorStrategy = 'sequential' | 'concurrent'; /** * Supported values for the `contextManager` parameter. */ export declare const CONTEXT_MANAGER_STRATEGIES: readonly ["auto", "agentic"]; export type ContextManagerStrategy = (typeof CONTEXT_MANAGER_STRATEGIES)[number]; /** * Configuration object for creating a new Agent. */ export type AgentConfig = { /** * The model instance that the agent will use to make decisions. * Accepts either a Model instance or a string representing a Bedrock model ID. * When a string is provided, it will be used to create a BedrockModel instance. * * @example * ```typescript * // Using a string model ID (creates BedrockModel) * const agent = new Agent({ * model: 'global.anthropic.claude-sonnet-4-6' * }) * * // Using an explicit BedrockModel instance with configuration * const agent = new Agent({ * model: new BedrockModel({ * modelId: 'global.anthropic.claude-sonnet-4-6', * temperature: 0.7, * maxTokens: 2048 * }) * }) * ``` */ model?: Model | string; /** An initial set of messages to seed the agent's conversation history. */ messages?: Message[] | MessageData[]; /** * An initial set of tools to register with the agent. * Accepts nested arrays of tools at any depth, which will be flattened automatically. * {@link Agent} instances are automatically wrapped as tools via {@link Agent.asTool}. */ tools?: ToolList; /** * A system prompt which guides model behavior. */ systemPrompt?: SystemPrompt | SystemPromptData; /** Optional initial state values for the agent. */ appState?: Record; /** * Optional initial model-provider state (e.g., restoring `responseId` from a * prior session). Typically only set when hydrating from a snapshot. */ modelState?: Record; /** * Enable automatic printing of agent output to console. * When true, prints text generation, reasoning, and tool usage as they occur. * Defaults to true. */ printer?: boolean; /** * Conversation manager for handling message history and context overflow. * Defaults to SlidingWindowConversationManager with windowSize of 40. */ conversationManager?: ConversationManager; /** * Context management strategy. * * - `"auto"`: SummarizingConversationManager with proactive compression + ContextOffloader. * - `"agentic"`: Lets the model drive context management via injected tools. * * If `conversationManager` is also provided, the user's conversation manager is used instead. * Defaults to undefined (SlidingWindowConversationManager, no offloader). * * @remarks The offloader uses in-memory storage that does not persist across process * restarts. For agents using `sessionManager`, provide an explicit `ContextOffloader` * with durable storage via the `plugins` parameter. */ contextManager?: ContextManagerStrategy; /** * Plugins to register with the agent. */ plugins?: Plugin[]; /** * Retry strategy (or strategies) for failed model/tool calls. * * - Omitted: a sensible default {@link DefaultModelRetryStrategy} with exponential backoff is used. * - Single strategy: the given strategy is used. * - Array of strategies: all are registered, in the given order. Passing two * instances of the same concrete class logs a warning — they will collide * on `plugin.name` when the plugin registry initializes. * - `null` or `[]`: retries are explicitly disabled; failures propagate to the caller. */ retryStrategy?: RetryStrategy | RetryStrategy[] | null; /** * Intervention handlers evaluated in registration order at each lifecycle point. */ interventions?: InterventionHandler[]; /** * Zod schema for structured output validation. */ structuredOutputSchema?: z.ZodSchema; /** * Session manager for saving and restoring agent sessions */ sessionManager?: SessionManager; /** * Memory manager for cross-session memory retrieval and storage. * Manages one or more memory stores and exposes search/add tools. * Accepts a {@link MemoryManager} instance or a {@link MemoryManagerConfig} object (auto-wrapped). */ memoryManager?: MemoryManager | MemoryManagerConfig; /** * Custom trace attributes to include in all spans. * These attributes are merged with standard attributes in telemetry spans. * Telemetry must be enabled globally via telemetry.setupTracer() for these to take effect. */ traceAttributes?: Record; /** * Optional name for the agent. Defaults to "Strands Agent". */ name?: string; /** * Optional description of what the agent does. */ description?: string; /** * Optional unique identifier for the agent. Defaults to "agent". */ id?: string; /** * Strategy for executing tool calls from a single assistant turn. * Defaults to `'concurrent'`. See {@link ToolExecutorStrategy} for details. */ toolExecutor?: ToolExecutorStrategy; /** * Execution environment for running commands, code, and file operations. * When provided, sandbox-aware tools route operations through it. * * Two distinct intents, even though they resolve to the same host execution * in Node today: * - Omitted: use the environment's default sandbox (host execution in Node). * This default is the slot reserved for richer behavior later. * - `false`: explicitly opt out of a managed sandbox and run on the host. * * Keep `false` distinct from omitting so the opt-out stays stable even if the * default changes. */ sandbox?: Sandbox | false; }; /** * Orchestrates the interaction between a model, a set of tools, and MCP clients. * The Agent is responsible for managing the lifecycle of tools and clients * and invoking the core decision-making loop. */ export declare class Agent implements LocalAgent, InvokableAgent { /** @internal */ readonly [localAgentSymbol]: true; /** * The conversation history of messages between user and assistant. */ messages: Message[]; /** * App state storage accessible to tools and application logic. * State is not passed to the model during inference. */ readonly appState: StateStore; /** * Runtime state for the model provider. Used by stateful models to persist * provider-specific data (e.g., response IDs for conversation chaining) * across invocations. */ readonly modelState: StateStore; private readonly _conversationManager; /** * The model provider used by the agent for inference. */ model: Model; /** * The system prompt to pass to the model provider. */ systemPrompt?: SystemPrompt; /** * The name of the agent. */ readonly name: string; /** * The unique identifier of the agent instance. */ readonly id: string; /** * Optional description of what the agent does. */ readonly description?: string; /** * The session manager for saving and restoring agent sessions, if configured. */ readonly sessionManager?: SessionManager | undefined; /** * The memory manager for cross-session memory retrieval and storage, if configured. */ readonly memoryManager?: MemoryManager | undefined; private readonly _sandbox; /** * Execution environment for running commands, code, and file operations. * * @throws DefaultNotConfiguredError if no sandbox is configured for this * environment (e.g. browsers, where no host default is registered). */ get sandbox(): Sandbox; private readonly _hooksRegistry; private readonly _middlewareRegistry; private readonly _pluginRegistry; private readonly _interventionRegistry; private _toolRegistry; private _mcpClients; private _initialized; private _isInvoking; private _abortController; private _abortSignal; private _printer?; private _structuredOutputSchema?; /** Tracer instance for creating and managing OpenTelemetry spans. */ private _tracer; /** Meter instance for accumulating loop metrics during invocation. */ private _meter; /** Interrupt state for human-in-the-loop workflows. */ _interruptState: InterruptState; /** Strategy for executing tool calls from a single assistant turn. */ private readonly _toolExecutor; /** Direct tool caller — created via {@link ToolCaller.create} factory. */ private readonly _toolCaller; /** * Creates an instance of the Agent. * @param config - The configuration for the agent. */ constructor(config?: AgentConfig); /** * Register a hook callback for a specific event type. * * @param eventType - The event class constructor to register the callback for * @param callback - The callback function to invoke when the event occurs * @param options - Optional configuration including execution order * @returns Cleanup function that removes the callback when invoked * * @example * ```typescript * const agent = new Agent({ model }) * * const cleanup = agent.addHook(BeforeInvocationEvent, (event) => { * console.log('Invocation started') * }) * * // Later, to remove the hook: * cleanup() * ``` */ addHook(eventType: HookableEventConstructor, callback: HookCallback, options?: HookCallbackOptions): HookCleanup; /** * Register an Input phase handler that transforms context before execution. * Input handlers run before Wrap and Output handlers. * * @example * ```typescript * agent.addMiddleware(InvokeModelStage.Input, async (context) => ({ * ...context, * systemPrompt: injectToSystemPrompt(context), * })) * ``` */ addMiddleware(phase: MiddlewareInputPhase, handler: MiddlewareInputHandler): () => void; /** * Register a Wrap phase handler via the explicit `.Wrap` sub-token. * Equivalent to passing the stage token directly. */ addMiddleware(phase: MiddlewareWrapPhase, handler: MiddlewareHandler): () => void; /** * Register an Output phase handler that transforms the result after execution. * Output handlers see the result after Wrap handlers complete. * Execution order: Input → Wrap → Output. * * @example * ```typescript * agent.addMiddleware(InvokeModelStage.Output, async (result) => { * log(`Model returned stopReason=${result.result.stopReason}`) * return result * }) * ``` */ addMiddleware(phase: MiddlewareOutputPhase, handler: MiddlewareOutputHandler): () => void; /** * Register a middleware handler for a given stage (Wrap phase). * Middleware wraps stage execution and can intercept, transform, or short-circuit operations. * * @param stage - The stage token identifying the interception point * @param handler - The middleware handler function (async generator) * @returns A cleanup function that removes the middleware when called * * @example * ```typescript * const cleanup = agent.addMiddleware(InvokeModelStage, async function* (context, next) { * const start = Date.now() * const result = yield* next(context) * console.log(`Model call took ${Date.now() - start}ms`) * return result * }) * * // Later, remove the middleware: * cleanup() * ``` */ addMiddleware(stage: MiddlewareStage, handler: MiddlewareHandler): () => void; initialize(): Promise; /** * Acquires the invocation lock. Throws if an invocation is already in progress. * Callers must release via try/finally with `this._isInvoking = false`. */ private acquireLock; /** * Throws {@link CancelledError} if cancellation has been requested. * Called at cancellation checkpoints within the agent loop. */ private _throwIfCancelled; /** * Validates the per-invocation budget caps in {@link InvokeOptions.limits}. * Called once at the top of `_stream` so bad inputs fail fast with a clear * error instead of silently no-op'ing (`NaN`, `Infinity`) or tripping * pathologically (zero swallows the user input; negative trips immediately). * * Each cap, when set, must be a positive finite number. Fractional values * are accepted — harmless, and useful for token budgets derived from * arithmetic. */ private _validateLimits; /** * Evaluates the per-invocation budget caps in {@link InvokeOptions.limits} * against the current invocation's metrics. Called at the top of each * agent-loop iteration, after `_throwIfCancelled` and before `startCycle`. * * Reads from {@link AgentMetrics.latestAgentInvocation} (scoped to the * current invocation) — not `cycleCount` / `accumulatedUsage`, which are * lifetime accumulators that would cause caps to fire prematurely on the * second `invoke()` call against a reused agent. * * Priority on simultaneous trip: turns → totalTokens → outputTokens. * * Returns the {@link StopReason} the loop should terminate with, or * `undefined` if every configured cap is still within budget. */ private _checkLimits; /** * The tools this agent can use. */ get tools(): Tool[]; /** * The tool registry for managing the agent's tools. */ get toolRegistry(): ToolRegistry; /** * Whether the agent is currently processing an invocation. */ get isInvoking(): boolean; /** * Direct tool calling accessor. * * Returns a proxy where each property is a {@link ToolHandle} with * `.invoke()` and `.stream()` methods: * ```typescript * const result = await agent.tool.calculator!.invoke({ a: 5, b: 3 }) * * for await (const event of agent.tool.calculator!.stream({ a: 5, b: 3 })) { * console.log('progress:', event) * } * ``` * * Supports underscore-to-hyphen and case-insensitive name resolution. * Results are recorded in message history by default (pass * `{ recordDirectToolCall: false }` to skip). */ get tool(): ToolCallerProxy; /** * The cancellation signal for the current invocation. * * Tools can pass this to cancellable operations (e.g., `fetch(url, { signal: agent.cancelSignal })`). * Hooks can check `event.agent.cancelSignal.aborted` to detect cancellation. */ get cancelSignal(): AbortSignal; /** * Cancels the current agent invocation cooperatively. * * The agent will stop at the next cancellation checkpoint: * - During model response streaming * - Before tool execution * - Between sequential tool executions * - At the top of each agent loop cycle * * If a tool is already executing, it will run to completion unless * the tool checks {@link LocalAgent.cancelSignal | cancelSignal} internally. * * Hook callbacks can check `event.agent.cancelSignal.aborted` to detect * cancellation and adjust their behavior accordingly. * * The stream/invoke call will return an AgentResult with `stopReason: 'cancelled'`. * If the agent is not currently invoking, this is a no-op. * * @example * ```typescript * const agent = new Agent({ model, tools }) * * // Cancel after 5 seconds * setTimeout(() => agent.cancel(), 5000) * const result = await agent.invoke('Do something') * console.log(result.stopReason) // 'cancelled' * ``` */ cancel(): void; /** * Whether the current invocation has been cancelled. * Returns `false` when the agent is idle. */ private get isCancelled(); /** * Invokes the agent and returns the final result. * * This is a convenience method that consumes the stream() method and returns * only the final AgentResult. Use stream() if you need access to intermediate * streaming events. * * @param args - Arguments for invoking the agent * @param options - Optional per-invocation options * @returns Promise that resolves to the final AgentResult * * @example * ```typescript * const agent = new Agent({ model, tools }) * const result = await agent.invoke('What is 2 + 2?') * console.log(result.lastMessage) // Agent's response * ``` */ invoke(args: InvokeArgs, options?: InvokeOptions): Promise; /** * Streams the agent execution, yielding events and returning the final result. * * The agent loop manages the conversation flow by: * 1. Streaming model responses and yielding all events * 2. Executing tools when the model requests them * 3. Continuing the loop until the model completes without tool use * * Use this method when you need access to intermediate streaming events. * For simple request/response without streaming, use invoke() instead. * * An explicit goal of this method is to always leave the message array in a way that * the agent can be reinvoked with a user prompt after this method completes. To that end * assistant messages containing tool uses are only added after tool execution succeeds * with valid toolResponses * * @param args - Arguments for invoking the agent * @param options - Optional per-invocation options * @returns Async generator that yields AgentStreamEvent objects and returns AgentResult * * @example * ```typescript * const agent = new Agent({ model, tools }) * * for await (const event of agent.stream('Hello')) { * console.log('Event:', event.type) * } * // Messages array is mutated in place and contains the full conversation * ``` */ stream(args: InvokeArgs, options?: InvokeOptions): AsyncGenerator; /** * Invokes the AgentStreamStage middleware chain. * Hooks fire outside this method (in stream()'s resume loop). */ private _streamWithMiddleware; /** * Single-pass stream through _stream() with event processing. * No resume loop, no lifecycle events — those are handled by stream()'s resume loop. */ private _streamCore; /** * Returns a {@link Tool} that wraps this agent, allowing it to be used * as a tool by another agent. * * The returned tool accepts a single `input` string parameter, invokes * this agent, and returns the text response as a tool result. * * **Note:** You can also pass an Agent directly in another agent's * {@link AgentConfig.tools | tools} array — it will be wrapped * automatically via this method. * * @param options - Optional configuration for the tool name, description, and context preservation * @returns A Tool wrapping this agent * * @example * ```typescript * const researcher = new Agent({ name: 'researcher', description: 'Finds info', printer: false }) * * // Explicit wrapping * const writer = new Agent({ tools: [researcher.asTool()] }) * * // Automatic wrapping (equivalent) * const writer = new Agent({ tools: [researcher] }) * ``` */ asTool(options?: AgentAsToolOptions): Tool; /** * Captures a point-in-time snapshot of the agent's current state. * * Use snapshots to checkpoint agent state for later restoration, enabling * use cases like undo/redo, branching conversations, and session persistence. * * Fields are selected via a preset/include/exclude model: * 1. Start with preset fields (e.g. `'session'` captures all fields) * 2. Add any `include` fields * 3. Remove any `exclude` fields * * @param options - Controls which fields to capture and optional app data to store * @returns A {@link Snapshot} containing the captured agent state * @throws Error if no fields would be included after applying options * * @example * ```typescript * // Capture all session-relevant state * const snapshot = agent.takeSnapshot({ preset: 'session' }) * * // Capture only messages and state * const partial = agent.takeSnapshot({ include: ['messages', 'state'] }) * * // Capture session state but exclude interrupts * const noInterrupts = agent.takeSnapshot({ preset: 'session', exclude: ['interrupts'] }) * * // Attach application-owned metadata * const withMeta = agent.takeSnapshot({ preset: 'session', appData: { userId: 'u-123' } }) * ``` */ takeSnapshot(options: TakeSnapshotOptions): Snapshot; /** * Restores agent state from a previously captured snapshot. * * Only fields present in `snapshot.data` are restored; absent fields are left * unchanged. This allows partial snapshots to update specific aspects of state * without affecting others. * * @param snapshot - The snapshot to restore from * @throws Error if `snapshot.schemaVersion` is incompatible or scope is wrong * * @example * ```typescript * // Save and restore a conversation checkpoint * const checkpoint = agent.takeSnapshot({ preset: 'session' }) * * // ... agent continues processing ... * * // Restore to the checkpoint * agent.loadSnapshot(checkpoint) * * // Restore from a JSON-serialized snapshot (e.g. from storage) * const stored = JSON.parse(savedSnapshotJson) * agent.loadSnapshot(stored) * ``` */ loadSnapshot(snapshot: Snapshot): void; /** * Invokes hook callbacks and printer for a stream event. * * @param event - The event to process * @returns The event after processing */ private _invokeCallbacks; /** * Internal implementation of the agent streaming logic. * Separated to centralize printer event processing in the public stream method. * * @param args - Arguments for invoking the agent * @param options - Optional per-invocation options * @returns Async generator that yields AgentStreamEvent objects and returns AgentResult */ private _stream; /** * Extracts the validated structured output result from tool execution. * * @param toolUseMessage - The assistant message containing tool use blocks * @param toolResultMessage - The message containing tool results * @returns The parsed structured output, or undefined if not found */ private _extractStructuredOutput; /** * Creates an AgentResult for an interrupt stop. * * @param invocationState - The current invocation state * @returns AgentResult with stopReason 'interrupt' */ private _createInterruptResult; /** * Extracts interrupt response content blocks from invocation args. * * @param args - The invocation arguments * @returns Array of InterruptResponseContent blocks, empty if none found * @throws TypeError if args mix interrupt responses with other content */ private _extractInterruptResponses; /** * Normalizes agent invocation input into an array of messages to append. * * @param args - Optional arguments for invoking the model * @returns Array of messages to append to the conversation */ private _normalizeInput; /** * Invokes the model provider and streams all events. * * @param args - Optional arguments for invoking the model * @param toolChoice - Optional tool choice to force specific tool usage * @returns Object containing the assistant message, stop reason, and optional redaction message */ private _invokeModel; /** * Invokes the model through the InvokeModelStage middleware chain. * Builds an InvokeModelContext from current agent state and composes the * middleware chain with a terminal function that calls _streamFromModel * using context fields directly (not re-derived from the agent). * * @param invocationState - Per-invocation state shared across hooks and tools * @param toolChoice - Optional tool choice to force specific tool usage * @returns StreamAggregatedResult from the model (or middleware short-circuit) */ private _invokeModelWithMiddleware; /** * Streams events from the model and dispatches appropriate events for each. * * The model's `streamAggregated()` yields two kinds of output: * - **ModelStreamEvent**: Transient streaming deltas (partial data while generating). * Wrapped in {@link ModelStreamUpdateEvent} before yielding. * - **ContentBlock**: Fully assembled results (after all deltas accumulate). * Wrapped in {@link ContentBlockEvent} before yielding. * * These are separate event classes because they represent different granularities * (partial deltas vs finished blocks). Both are yielded in the stream and hookable. * * @param messages - Messages to send to the model * @param streamOptions - Options for streaming * @returns StreamAggregatedResult containing message, stop reason, and optional redaction message */ private _streamFromModel; /** * Emits `BeforeToolsEvent`, handles the pre-launch cancel paths, then * delegates per-tool execution to the configured {@link ToolExecutorStrategy}. * Always pairs `BeforeToolsEvent` with a terminal `AfterToolsEvent`, even on * the invariant-violation throw path. * * @param assistantMessage - The assistant message containing tool use blocks * @param toolRegistry - Registry containing available tools * @returns Tool-result message and the dispatched AfterToolsEvent */ private executeTools; /** * Emits a `ToolResultEvent` for every block plus an `AfterToolsEvent`, and * returns the resulting tool-result message and dispatched event. Used by the pre-launch cancel * paths shared across executors. */ private _yieldCancelledToolResults; /** * Executes tools one at a time, honoring `agent.cancelSignal` between * iterations to short-circuit not-yet-started tools. */ private _executeToolsSequential; /** * Produces one error ToolResultBlock per tool use block, each carrying * `message` as its error text. Shared by pre-launch cancel paths. */ private _cancelAllAsResults; /** * Executes tools concurrently by merging N per-tool {@link executeTool} * async generators via `Promise.race`. Per-tool event order is preserved * (because each generator is iterated serially); cross-tool events may * interleave at race resolution boundaries. * * Per-tool retry (`AfterToolCallEvent.retry`) is isolated — it lives inside * `executeTool`'s own `while(true)` loop, so one tool retrying does not * disturb its siblings. */ private _executeToolsConcurrent; /** * Executes a single tool and returns the result. * If the tool is not found or fails to return a result, returns an error ToolResult * instead of throwing an exception. This allows the agent loop to continue and * let the model handle the error gracefully. * * @param toolUseBlock - Tool use block to execute * @param toolRegistry - Registry containing available tools * @returns Tool result block */ private executeTool; private _executeToolWithMiddleware; private _executeToolCore; /** * Redacts the last message in the conversation history. * Called when guardrails block user input and redaction is enabled. * * Follows the redaction strategy: * - If the message contains at least one toolResult block, all toolResult blocks * are kept with redacted content, and all other blocks are discarded. * - Otherwise, the entire content is replaced with a single text block containing * the redaction message. * * @param redactMessage - The redaction message to replace the content with */ private _redactLastMessage; /** * Estimate the input token count for the next model call. * * Uses the token counting strategy: reads inputTokens + outputTokens * from the last assistant message's metadata as a known baseline, then estimates * only new messages added after it. Falls back to full estimation when no metadata * is available (cold start or first call). * * @param streamOptions - The stream options containing system prompt and tool specs * @returns Estimated input token count */ private _estimateInputTokens; /** * Appends a message to the conversation history and fires MessageAddedEvent hooks. * * Used by {@link ToolCaller} (via the helper passed to `ToolCaller.create`) for * direct tool calls that cannot yield events into the agent stream. This stays * private — callers outside the agent should never directly mutate messages. */ private _appendMessageAndFireHooks; /** * Appends a message to the conversation history and returns the event for yielding. * * @param message - The message to append * @returns MessageAddedEvent to be yielded */ private _appendMessage; } //# sourceMappingURL=agent.d.ts.map