import { ToolExecutionOptions, ToolNeedsApprovalFunction, ProviderOptions as ProviderOptions$1, ModelMessage, DataContent as DataContent$1, UserContent, AssistantContent, ToolContent } from '@ai-sdk/provider-utils'; export { AssistantContent, FilePart, ImagePart, ProviderOptions, TextPart, ToolContent, UserContent } from '@ai-sdk/provider-utils'; import { Tool as Tool$1, EmbeddingModel, TextStreamPart, generateText, StreamTextResult, UIMessage, LanguageModel, CallSettings, Output, ToolChoice, ToolSet, GenerateTextResult, InferGenerateOutput, GenerateObjectResult, AsyncIterableStream as AsyncIterableStream$1, Warning, LanguageModelUsage, FinishReason, TextUIPart, FileUIPart } from 'ai'; export { LanguageModel, Tool as VercelTool, hasToolCall, stepCountIs } from 'ai'; import * as zod from 'zod'; import { z } from 'zod'; import { Span, Tracer, SpanOptions, SpanStatusCode as SpanStatusCode$1, context, trace, SpanKind as SpanKind$1, Context } from '@opentelemetry/api'; export { ROOT_CONTEXT, Span, SpanOptions, Tracer, context, propagation, trace } from '@opentelemetry/api'; import { Logger, LogFn, LogBuffer } from '@voltagent/internal'; import { AnthropicProviderOptions } from '@ai-sdk/anthropic'; import { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google'; import { OpenAIResponsesProviderOptions } from '@ai-sdk/openai'; import { XaiProviderOptions, XaiResponsesProviderOptions } from '@ai-sdk/xai'; import { AsyncIterableStream } from '@voltagent/internal/utils'; export { AsyncIterableStream, createAsyncIterableStream } from '@voltagent/internal/utils'; import { DangerouslyAllowAny, PlainObject } from '@voltagent/internal/types'; import * as TF from 'type-fest'; import { LogRecordProcessor, LoggerProvider, ReadableLogRecord, SdkLogRecord } from '@opentelemetry/sdk-logs'; import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node'; import { SpanProcessor, BasicTracerProvider, ReadableSpan, Span as Span$1 } from '@opentelemetry/sdk-trace-base'; import { A2AServerLike, A2AServerDeps, A2AServerMetadata, A2AServerFactory } from '@voltagent/internal/a2a'; import { MCPServerLike, MCPServerDeps, MCPServerMetadata, MCPServerFactory } from '@voltagent/internal/mcp'; import { ElicitRequest, ElicitResult, ClientCapabilities, ListResourcesResult } from '@modelcontextprotocol/sdk/types.js'; /** * Represents a collection of related tools with optional shared instructions. */ type Toolkit = { /** * Unique identifier name for the toolkit. Used for management and potentially logging. */ name: string; /** * A brief description of what the toolkit does or what tools it contains. * Optional. */ description?: string; /** * Shared instructions for the LLM on how to use the tools within this toolkit. * These instructions are intended to be added to the system prompt if `addInstructions` is true. * Optional. */ instructions?: string; /** * Whether to automatically add the toolkit's `instructions` to the agent's system prompt. * If true, the instructions from individual tools within this toolkit might be ignored * by the Agent's system message generation logic to avoid redundancy. * Defaults to false. */ addInstructions?: boolean; /** * An array of Tool instances that belong to this toolkit. */ tools: (Tool | Tool$1)[]; }; /** * Helper function for creating a new toolkit. * Provides default values and ensures the basic structure is met. * * @param options - The configuration options for the toolkit. * @returns A Toolkit object. */ declare const createToolkit: (options: Toolkit) => Toolkit; declare abstract class BaseToolManager | never = BaseToolManager> { /** * User tools managed by this manager. * Includes server-side and client-side tools (no server execute) managed separately from server-executable tools. */ protected baseTools: Map; /** * Provider-defined tools managed by providers */ protected providerTools: Map; /** * Toolkits managed by this manager. */ protected toolkits: Map; /** * Logger instance */ protected logger: Logger; /** * Creates a new ToolManager. * Accepts individual tools, provider-defined tools, and toolkits. */ protected constructor(items?: TItems[], logger?: Logger); /** Not all inheritances of BaseToolManager support toolkits - thus this is abstract */ abstract addToolkit(toolkit: Toolkit): boolean; /** * Add multiple tools or toolkits to the manager. */ addItems(items: TItems[]): void; addStandaloneTool(tool: AgentTool | Tool$1): boolean; /** * Remove a standalone tool by name. Does not remove tools from toolkits. * @returns true if the tool was removed, false if it wasn't found. */ removeTool(toolName: string): boolean; /** * Remove a toolkit by name. * @returns true if the toolkit was removed, false if it wasn't found. */ removeToolkit(toolkitName: string): boolean; /** * Get all toolkits managed by this manager. */ getToolkits(): TToolkitManager[]; /** * Get standalone tools and standalone tools within toolkits as a flattened list. */ getAllBaseTools(): BaseTool[]; /** * Get provider-defined tools managed externally by providers. */ getAllProviderTools(): ProviderTool[]; /** * Get all kinds of tools, owned by this manager and inside toolkits as a flattened list. * */ getAllTools(): (BaseTool | ProviderTool)[]; /** * Get a tool by name across standalone tools and toolkits. */ getToolByName(toolName: string): BaseTool | ProviderTool | undefined; /** * Get names of all tools (standalone and inside toolkits), deduplicated. */ getAllToolNames(): string[]; /** * Returns tools owned directly by this manager (standalone tools), excluding tools inside toolkits. */ protected getStandaloneTools(): (BaseTool | ProviderTool)[]; /** * Check if any tool with the given name exists in this manager or nested toolkits. */ hasToolInAny(toolName: string): boolean; private getToolkitManagers; } declare class ToolkitManager extends BaseToolManager { readonly name: string; /** * A brief description of what the toolkit does or what tools it contains. * Optional. */ readonly description?: string | undefined; /** * Shared instructions for the LLM on how to use the tools within this toolkit. * These instructions are intended to be added to the system prompt if `addInstructions` is true. * Optional. */ readonly instructions?: string | undefined; /** * Whether to automatically add the toolkit's `instructions` to the agent's system prompt. * If true, the instructions from individual tools within this toolkit might be ignored * by the Agent's system message generation logic to avoid redundancy. * Defaults to false. */ readonly addInstructions: boolean; /** * Constructor does not accept toolkits - only tools * */ constructor(name: string, items?: (AgentTool | Tool$1)[], /** * A brief description of what the toolkit does or what tools it contains. * Optional. */ description?: string | undefined, /** * Shared instructions for the LLM on how to use the tools within this toolkit. * These instructions are intended to be added to the system prompt if `addInstructions` is true. * Optional. */ instructions?: string | undefined, /** * Whether to automatically add the toolkit's `instructions` to the agent's system prompt. * If true, the instructions from individual tools within this toolkit might be ignored * by the Agent's system message generation logic to avoid redundancy. * Defaults to false. */ addInstructions?: boolean, logger?: Logger); /** * Toolkits are not supported inside a ToolkitManager (toolkits contain tools only). * Keep the same signature as BaseToolManager.addToolkit to preserve type compatibility, * but implement as a no-op (or warn) so callers won't crash. */ addToolkit(toolkit: Toolkit): boolean; } declare class ToolManager extends BaseToolManager { /** * Creates a new ToolManager. * Accepts individual tools, provider-defined tools, and toolkits. */ constructor(items?: (AgentTool | Tool$1 | Toolkit)[], logger?: Logger); /** * Add a toolkit to the manager. * If a toolkit with the same name already exists, it will be replaced. * Also checks if any tool within the toolkit conflicts with existing standalone tools or tools in other toolkits. * @returns true if the toolkit was successfully added or replaced. */ addToolkit(toolkit: Toolkit): boolean; prepareToolsForExecution(createToolExecuteFunction: (tool: AgentTool) => (args: any, options?: ToolExecutionOptions) => ToolExecutionResult): Record; /** * Get agent's tools (including those in toolkits) for API exposure. */ getToolsForApi(): ApiToolInfo[]; } /** * Status of a tool at any given time */ type ToolStatus = "idle" | "working" | "error" | "completed"; /** * Tool status information */ type ToolStatusInfo = { name: string; status: ToolStatus; result?: any; error?: any; input?: any; output?: any; timestamp: Date; parameters?: any; }; /** * THIS FILE IS AUTO-GENERATED - DO NOT EDIT * Generated from https://models.dev/api.json */ type EmbeddingModelsMap = { readonly azure: readonly [ "cohere-embed-v-4-0", "cohere-embed-v3-english", "cohere-embed-v3-multilingual", "text-embedding-3-large", "text-embedding-3-small", "text-embedding-ada-002" ]; readonly "azure-cognitive-services": readonly [ "cohere-embed-v-4-0", "cohere-embed-v3-english", "cohere-embed-v3-multilingual", "text-embedding-3-large", "text-embedding-3-small", "text-embedding-ada-002" ]; readonly "cloudflare-ai-gateway": readonly [ "workers-ai/@cf/pfnet/plamo-embedding-1b", "workers-ai/@cf/qwen/qwen3-embedding-0.6b" ]; readonly google: readonly ["gemini-embedding-001"]; readonly "google-vertex": readonly ["gemini-embedding-001"]; readonly huggingface: readonly ["Qwen/Qwen3-Embedding-4B", "Qwen/Qwen3-Embedding-8B"]; readonly inference: readonly ["qwen/qwen3-embedding-4b"]; readonly mistral: readonly ["mistral-embed"]; readonly nvidia: readonly ["nvidia/llama-embed-nemotron-8b"]; readonly openai: readonly [ "text-embedding-3-large", "text-embedding-3-small", "text-embedding-ada-002" ]; readonly "privatemode-ai": readonly ["qwen3-embedding-4b"]; readonly vercel: readonly [ "alibaba/qwen3-embedding-0.6b", "alibaba/qwen3-embedding-4b", "alibaba/qwen3-embedding-8b", "amazon/titan-embed-text-v2", "cohere/embed-v4.0", "google/gemini-embedding-001", "google/text-embedding-005", "google/text-multilingual-embedding-002", "mistral/codestral-embed", "mistral/mistral-embed", "openai/text-embedding-3-large", "openai/text-embedding-3-small", "openai/text-embedding-ada-002" ]; }; type EmbeddingProviderId = keyof EmbeddingModelsMap; type EmbeddingRouterModelId = { [P in EmbeddingProviderId]: `${P}/${EmbeddingModelsMap[P][number]}`; }[EmbeddingProviderId] | (string & {}); type EmbeddingModelInstance$1 = Exclude; type EmbeddingModelReference = EmbeddingRouterModelId | EmbeddingModelInstance$1; /** * Embedding adapter interface for converting text to vectors */ interface EmbeddingAdapter$1 { /** * Embed a single text string into a vector */ embed(text: string): Promise; /** * Embed multiple texts in a batch for efficiency */ embedBatch(texts: string[]): Promise; /** * Get the dimensionality of the embeddings * Returns undefined if dimensions are not yet known */ getDimensions(): number | undefined; /** * Get the model name for debugging/logging */ getModelName(): string; } /** * Options for embedding adapter initialization */ interface EmbeddingOptions { /** * Maximum number of texts to process in a single batch */ maxBatchSize?: number; /** * Timeout for embedding operations in milliseconds */ timeout?: number; /** * Whether to normalize embeddings to unit vectors */ normalize?: boolean; } type ToolSearchSelection = { name: string; score?: number; reason?: string; }; type ToolSearchResultItem = { name: string; description: string | null; tags: string[] | null; parametersSchema: unknown | null; outputSchema: unknown | null; score?: number; reason?: string; }; type ToolSearchResult = { query: string; selections: ToolSearchSelection[]; tools: ToolSearchResultItem[]; }; type ToolSearchCandidate = { name: string; description?: string; tags?: string[]; parameters?: unknown; outputSchema?: unknown; tool: Tool | ProviderTool; }; type ToolSearchContext = { agentId: string; agentName: string; operationContext: OperationContext; searchToolName?: string; parentSpan?: Span; }; type ToolSearchStrategy = { select: (params: { query: string; tools: ToolSearchCandidate[]; topK: number; context: ToolSearchContext; }) => Promise; }; type ToolRoutingEmbeddingConfig = { model: EmbeddingAdapter$1 | EmbeddingModelReference; normalize?: boolean; maxBatchSize?: number; topK?: number; toolText?: (tool: ToolSearchCandidate) => string; }; type ToolRoutingEmbeddingInput = ToolRoutingEmbeddingConfig | EmbeddingAdapter$1 | EmbeddingModelReference; type ToolRoutingConfig = { pool?: (Tool | Toolkit | Tool$1)[]; expose?: (Tool | Toolkit | Tool$1)[]; embedding?: ToolRoutingEmbeddingInput; topK?: number; enforceSearchBeforeCall?: boolean; }; declare const createEmbeddingToolSearchStrategy: (input: ToolRoutingEmbeddingInput) => ToolSearchStrategy; /** * JSON value types (matches AI SDK's JSONValue) */ type JSONValue = string | number | boolean | null | { [key: string]: JSONValue; } | Array; type ToolExecutionResult = PromiseLike | AsyncIterable | T; interface ToolHookOnStartArgs { tool: Tool; args: unknown; options?: ToolExecuteOptions; } interface ToolHookOnEndArgs { tool: Tool; args: unknown; /** The successful output from the tool. Undefined on error. */ output: unknown | undefined; /** The error if the tool execution failed. */ error: unknown | undefined; options?: ToolExecuteOptions; } interface ToolHookOnEndResult { output?: unknown; } type ToolHookOnStart = (args: ToolHookOnStartArgs) => Promise | void; type ToolHookOnEnd = (args: ToolHookOnEndArgs) => Promise | Promise | ToolHookOnEndResult | undefined; type ToolHooks = { onStart?: ToolHookOnStart; onEnd?: ToolHookOnEnd; }; /** * Tool result output format for multi-modal content. * Matches AI SDK's LanguageModelV2ToolResultOutput type. */ type ToolResultOutput = { type: "text"; value: string; } | { type: "json"; value: JSONValue; } | { type: "error-text"; value: string; } | { type: "error-json"; value: JSONValue; } | { type: "content"; value: Array<{ type: "text"; text: string; } | { type: "media"; data: string; mediaType: string; }>; }; /** * Tool definition compatible with Vercel AI SDK */ type AgentTool = BaseTool; /** * Block access to user-defined and dynamic tools by requiring provider-defined type * */ type ProviderTool = Tool$1 & { type: "provider"; id: `${string}.${string}`; args: Record; supportsDeferredResults?: boolean; name: string; }; /** * Tool options for creating a new tool */ type ToolOptions = { /** * Unique identifier for the tool */ id?: string; /** * Name of the tool */ name: string; /** * Description of the tool */ description: string; /** * Tool parameter schema */ parameters: T; /** * Tool output schema (optional) */ outputSchema?: O; /** * Optional user-defined tags for organizing or labeling tools. */ tags?: string[]; /** * Whether the tool requires approval before execution. * When set to a function, it can decide dynamically per call. */ needsApproval?: boolean | ToolNeedsApprovalFunction>; /** * Provider-specific options for the tool. * Enables provider-specific functionality like cache control. * * @example * ```typescript * // Anthropic cache control * providerOptions: { * anthropic: { * cacheControl: { type: 'ephemeral' } * } * } * ``` */ providerOptions?: ProviderOptions$1; /** * Optional function to convert tool output to multi-modal content. * Enables returning images, media, or structured content to the LLM. * * Supported by: Anthropic, OpenAI * * @example * ```typescript * // Return image + text * toModelOutput: ({ output }) => ({ * type: 'content', * value: [ * { type: 'text', text: 'Screenshot taken' }, * { type: 'media', data: output.base64Image, mediaType: 'image/png' } * ] * }) * ``` */ toModelOutput?: (args: { output: O extends ToolSchema ? z.infer : unknown; }) => ToolResultOutput; /** * Function to execute when the tool is called. * @param args - The arguments passed to the tool * @param options - Optional execution options including context, abort signals, etc. * @returns A result or an AsyncIterable of results (last value is final). */ execute?: (args: z.infer, options?: ToolExecuteOptions) => ToolExecutionResult : unknown>; /** * Optional tool-specific hooks for lifecycle events. */ hooks?: ToolHooks; }; /** * Tool class for defining tools that agents can use */ declare class Tool { /** * Unique identifier for the tool */ readonly id: string; /** * Name of the tool */ readonly name: string; /** * Description of the tool */ readonly description: string; /** * Tool parameter schema */ readonly parameters: T; /** * Tool output schema */ readonly outputSchema?: O; /** * Optional user-defined tags for organizing or labeling tools. */ readonly tags?: string[]; /** * Whether the tool requires approval before execution. */ readonly needsApproval?: boolean | ToolNeedsApprovalFunction>; /** * Provider-specific options for the tool. * Enables provider-specific functionality like cache control. */ readonly providerOptions?: ProviderOptions$1; /** * Optional function to convert tool output to multi-modal content. * Enables returning images, media, or structured content to the LLM. */ readonly toModelOutput?: (args: { output: O extends ToolSchema ? z.infer : unknown; }) => ToolResultOutput; /** * Optional tool-specific hooks for lifecycle events. */ readonly hooks?: ToolHooks; /** * Internal discriminator to make runtime/type checks simpler across module boundaries. * Marking our Tool instances with a stable string avoids instanceof issues. */ readonly type: "user-defined"; /** * Function to execute when the tool is called. * @param args - The arguments passed to the tool * @param options - Optional execution options including context, abort signals, etc. * @returns A result or an AsyncIterable of results (last value is final). */ readonly execute?: (args: z.infer, options?: ToolExecuteOptions) => ToolExecutionResult : unknown>; /** * Whether this tool should be executed on the client side. * Returns true when no server-side execute handler is provided. */ readonly isClientSide: () => boolean; /** * Create a new tool */ constructor(options: ToolOptions); } /** * Helper function for creating a new tool */ declare function createTool(options: ToolOptions): Tool; declare function createTool(options: ToolOptions): Tool; /** * Alias for createTool function */ declare const tool: typeof createTool; /** * Token usage information */ type UsageInfo = { promptTokens: number; completionTokens: number; totalTokens: number; cachedInputTokens?: number; reasoningTokens?: number; }; /** * Base provider response type */ type ProviderResponse = { /** * Original response from the provider */ provider: TOriginalResponse; }; /** * Response type for text generation operations */ type ProviderTextResponse = { /** * Original response from the provider */ provider: TOriginalResponse; /** * Text response content */ text: string; /** * Token usage information */ usage?: UsageInfo; /** * Tool calls in the response (if applicable) */ toolCalls?: any[]; /** * Tool results in the response (if applicable) */ toolResults?: any[]; /** * Finish reason (if applicable) */ finishReason?: string; /** * Reasoning text from the model (if applicable) */ reasoning?: string; /** * Warnings from the model provider (if applicable) */ warnings?: any[]; }; type StreamPart = TextStreamPart & { subAgentId?: string; subAgentName?: string; executingAgentId?: string; executingAgentName?: string; parentAgentId?: string; parentAgentName?: string; agentPath?: string[]; }; /** * Response type for text streaming operations */ type ProviderTextStreamResponse = { /** * Original response from the provider */ provider: TOriginalResponse; /** * Text stream for consuming the response */ textStream: AsyncIterableStream; /** * Full stream for consuming all events (text, tool calls, reasoning, etc.) * This provides access to the complete stream of events from the provider * Optional - only available in providers that support it */ fullStream?: AsyncIterable; /** * The full generated text. * Resolved when the response is finished. * Optional - only available in providers that support it. */ text?: Promise; /** * The reason why generation stopped. * Resolved when the response is finished. * Optional - only available in providers that support it. */ finishReason?: Promise; /** * Token usage information. * Resolved when the response is finished. * Optional - only available in providers that support it. */ usage?: Promise; /** * Model's reasoning text (if available). * Resolved when the response is finished. * Optional - only available in providers that support it. */ reasoning?: Promise; }; /** * Response type for object generation operations */ type ProviderObjectResponse = { /** * Original response from the provider */ provider: TOriginalResponse; /** * Generated object */ object: TObject; /** * Token usage information */ usage?: UsageInfo; /** * Finish reason (if applicable) */ finishReason?: string; /** * Warnings from the model provider (if applicable) */ warnings?: any[]; }; /** * Response type for object streaming operations */ type ProviderObjectStreamResponse = { /** * Original response from the provider */ provider: TOriginalResponse; /** * Object stream for consuming partial objects */ objectStream: AsyncIterableStream>; /** * The generated object (typed according to the schema). * Resolved when the response is finished. * Optional - only available in providers that support it. */ object?: Promise; /** * Token usage information. * Resolved when the response is finished. * Optional - only available in providers that support it. */ usage?: Promise; /** * Warnings from the model provider. * Resolved when the response is finished. * Optional - only available in providers that support it. */ warnings?: Promise; }; /** * Data content type for binary data (keep our own for backward compatibility) */ type DataContent = DataContent$1; /** * Message content types from AI SDK */ type MessageContent = UserContent | AssistantContent | ToolContent | string; /** * Message role types */ type MessageRole = "user" | "assistant" | "system" | "tool"; /** * Base message type - now using AI SDK's ModelMessage for full compatibility */ type BaseMessage = ModelMessage; type ToolSchema = z.ZodType; /** * Tool execution context containing all tool-specific metadata. * Encapsulates both AI SDK fields and VoltAgent metadata for better organization. */ type ToolContext = { /** Name of the tool being executed */ name: string; /** Unique identifier for this specific tool call (from AI SDK) */ callId: string; /** Message history at the time of tool call (from AI SDK) */ messages: any[]; /** Abort signal for detecting cancellation (from AI SDK) */ abortSignal?: AbortSignal; }; type ToolExecuteOptions = Partial & { /** * Tool execution context containing all tool-specific metadata. * Includes both AI SDK fields (callId, messages, abortSignal) and * VoltAgent metadata (name). * * Optional for external callers (e.g., MCP servers) that may not have tool metadata. * When called from VoltAgent's agent, this is always populated. */ toolContext?: ToolContext; /** * Optional AbortController for cancelling the execution and accessing the signal. * Prefer using toolContext.abortSignal. */ abortController?: AbortController; /** * Additional options can be added in the future. */ [key: string]: any; }; type BaseTool = Tool; type BaseToolCall = { name: string; arguments: Record; }; type ProviderParams = T extends { doGenerate: (options: infer P) => any; } ? P extends { messages: any; model: any; } ? Omit : Record : Record; type BaseLLMOptions = { messages: BaseMessage[]; model: TModel; provider?: ProviderParams; }; interface StepWithContent { id: string; type: "text" | "tool_call" | "tool_result"; content: string; role: MessageRole; name?: string; arguments?: Record; result?: any; usage?: UsageInfo; subAgentId?: string; subAgentName?: string; } type StepFinishCallback = (step: StepWithContent) => void | Promise; type StepChunkCallback = (chunk: any) => void | Promise; interface GenerateTextOptions$1 { messages: BaseMessage[]; model: TModel; tools?: BaseTool[]; maxSteps?: number; provider?: ProviderOptions; onStepFinish?: StepFinishCallback; signal?: AbortSignal; } interface StreamTextOptions$1 { messages: BaseMessage[]; model: TModel; tools?: BaseTool[]; maxSteps?: number; provider?: ProviderOptions; onStepFinish?: StepFinishCallback; onChunk?: StepChunkCallback; onFinish?: StreamTextOnFinishCallback; onError?: StreamOnErrorCallback; signal?: AbortSignal; } interface GenerateObjectOptions$1 { messages: BaseMessage[]; model: TModel; schema: TSchema; provider?: ProviderOptions; onStepFinish?: StepFinishCallback; signal?: AbortSignal; } interface StreamObjectOptions$1 { messages: BaseMessage[]; model: TModel; schema: TSchema; provider?: ProviderOptions; onStepFinish?: StepFinishCallback; onFinish?: StreamObjectOnFinishCallback>; onError?: StreamOnErrorCallback; signal?: AbortSignal; } type InferStreamResponse = T extends { streamText: (...args: any[]) => Promise; } ? R : unknown; type InferMessage = T extends { toMessage: (message: BaseMessage) => infer R; } ? R : unknown; type InferTool = T extends { toTool?: (tool: BaseTool) => infer R; } ? R : unknown; type InferModel = T extends { model: infer R; } ? R : unknown; type InferGenerateTextResponse = T extends { generateText: (...args: any[]) => Promise; } ? R : unknown; type InferGenerateObjectResponse = T extends { generateObject: (...args: any[]) => Promise; } ? R : unknown; type InferProviderParams = T extends { generateText: (options: infer P) => any; } ? P extends { messages: any; model: any; tools?: any; maxSteps?: any; schema?: any; } ? Omit : Record : Record; type LLMProvider = { /** * Generates a text response based on the provided options. * Implementers should catch underlying SDK/API errors and throw a VoltAgentError. * @throws {VoltAgentError} If an error occurs during generation. */ generateText(options: GenerateTextOptions$1>): Promise>>; /** * Streams a text response based on the provided options. * Implementers should catch underlying SDK/API errors and throw a VoltAgentError. * @throws {VoltAgentError} If an error occurs during streaming. */ streamText(options: StreamTextOptions$1>): Promise>>; /** * Generates a structured object response based on the provided options and schema. * Implementers should catch underlying SDK/API errors and throw a VoltAgentError. * @throws {VoltAgentError} If an error occurs during generation. */ generateObject(options: GenerateObjectOptions$1, TSchema>): Promise, z.infer>>; /** * Streams a structured object response based on the provided options and schema. * Implementers should catch underlying SDK/API errors and throw a VoltAgentError. * @throws {VoltAgentError} If an error occurs during streaming. */ streamObject(options: StreamObjectOptions$1, TSchema>): Promise, z.infer>>; /** * Converts a base message to a provider-specific message. * @param message The base message to convert. * @returns The provider-specific message. */ toMessage(message: BaseMessage): InferMessage; /** * Optional tool conversion method. */ toTool?: (tool: BaseTool) => InferTool; /** * Returns a string representation of the model identifier. * @param model The model object/identifier specific to this provider. * @returns The string name of the model. */ getModelIdentifier(model: InferModel): string; }; type StopWhen = Parameters[0]["stopWhen"]; type PrepareStep = Parameters[0]["prepareStep"]; /** * LoggerProxy implements the Logger interface but delegates all calls to the current global logger. * This allows agents and workflows to be created before VoltAgent sets the global logger, * while still using the correct logger once it's available. * * When the logger package is not available, it also emits logs via OpenTelemetry Logs API. */ declare class LoggerProxy implements Logger { private bindings; private externalLogger?; constructor(bindings?: Record, externalLogger?: Logger); /** * Get the actual logger instance with bindings applied */ private getActualLogger; /** * Check if a log level should be logged based on the configured level */ private shouldLog; /** * Emit log via OpenTelemetry Logs API if available */ private emitOtelLog; trace: LogFn; debug: LogFn; info: LogFn; warn: LogFn; error: LogFn; fatal: LogFn; /** * Create a child logger with additional bindings */ child(childBindings: Record): Logger; } declare enum ActionType { START = "start", COMPLETE = "complete", ERROR = "error", GENERATION_START = "generationStart", GENERATION_COMPLETE = "generationComplete", STREAM_START = "streamStart", STREAM_COMPLETE = "streamComplete", STREAM_STEP = "streamStep", STREAMING = "streaming", OBJECT_GENERATION_START = "objectGenerationStart", OBJECT_GENERATION_COMPLETE = "objectGenerationComplete", STREAM_OBJECT_START = "streamObjectStart", STREAM_OBJECT_COMPLETE = "streamObjectComplete", TOOL_CALL = "toolCall", TOOL_ERROR = "toolError", DELEGATE = "delegate", EXECUTE = "execute", VALIDATE = "validate", STEP_START = "stepStart", STEP_COMPLETE = "stepComplete", SUSPEND = "suspend", RESUME = "resume", ACCESS = "access", STORE = "store", RETRIEVE = "retrieve" } /** * Helper to format retriever log messages */ declare function buildRetrieverLogMessage(retrieverName: string, action: ActionType | string, description: string): string; /** * Get the global logger instance from registry or create a default one */ declare function getGlobalLogger(): Logger; /** * Get the global log buffer */ declare function getGlobalLogBuffer(): LogBuffer; /** * Options for configuring the Retriever */ type RetrieverOptions = { /** * Name for the default tool created from this retriever * This is used for the pre-created 'tool' property * @default "search_knowledge" */ toolName?: string; /** * Description for the default tool created from this retriever * This is used for the pre-created 'tool' property * @default "Searches for relevant information in the knowledge base based on the query." */ toolDescription?: string; /** * Optional logger instance for the retriever * If not provided, a default logger will be created */ logger?: Logger; /** * Additional configuration specific to concrete retriever implementations */ [key: string]: any; }; /** * Options passed to retrieve method. * Includes all operation context fields for user-specific and context-aware retrieval. */ interface RetrieveOptions extends Partial { /** * User-managed context map for this specific retrieval operation * Can be used to store metadata, results, or any custom data * * Inherited from OperationContext but explicitly documented here for clarity */ context?: Map; /** * Optional logger instance for this retrieval operation. * Provides execution-scoped logging with full context. * Available when retriever is called from an agent or workflow context. * * Inherited from OperationContext but explicitly documented here for clarity */ logger?: Logger; /** * Optional user identifier for user-specific retrieval. * Can be used to filter results by user or implement multi-tenant retrieval. * * Inherited from OperationContext */ userId?: string; /** * Optional conversation identifier for conversation-aware retrieval. * Can be used to retrieve conversation-specific context or history. * * Inherited from OperationContext */ conversationId?: string; } /** * Retriever interface for retrieving relevant information */ type Retriever = { /** * Retrieve relevant documents based on input text * @param text The text to use for retrieval * @param options Configuration and context for the retrieval * @returns Promise resolving to a string with the retrieved content */ retrieve(text: string, options: RetrieveOptions): Promise; /** * Configuration options for the retriever * This is optional and may not be present in all implementations */ options?: RetrieverOptions; /** * Pre-created tool for easy destructuring * This is optional and may not be present in all implementations */ tool?: any; /** * Optional observability attributes for retriever spans. */ getObservabilityAttributes?: () => Record; }; /** * Abstract base class for Retriever implementations. * This class provides a common structure for different types of retrievers. */ declare abstract class BaseRetriever { /** * Options that configure the retriever's behavior */ protected options: RetrieverOptions; /** * Logger instance for the retriever */ protected logger: Logger; /** * Ready-to-use tool property for direct destructuring * This can be used with object destructuring syntax * * @example * ```typescript * // ✅ You can use destructuring with the tool property * const { tool } = new SimpleRetriever(); * * // And use it directly in an agent * const agent = new Agent({ * name: "RAG Agent", * model: "gpt-4", * provider, * tools: [tool], * }); * ``` */ readonly tool: AgentTool; /** * Constructor for the BaseRetriever class. * @param options - Configuration options for the retriever. */ constructor(options?: RetrieverOptions); /** * Abstract method that must be implemented by concrete retriever classes. * Retrieves relevant information based on the input text or messages. * * @param input - The input to use for retrieval (string or BaseMessage array) * @param options - Configuration and context for the retrieval * @returns Promise resolving to a string with the retrieved content */ abstract retrieve(input: string | BaseMessage[], options: RetrieveOptions): Promise; /** * Optional observability attributes for retriever spans. * Override in subclasses to add context (e.g. knowledge base metadata). */ getObservabilityAttributes(): Record; } /** * Available methods for subagent execution */ type SubAgentMethod = "streamText" | "generateText" | "streamObject" | "generateObject"; /** * Base configuration for a subagent with specific method and options */ interface BaseSubAgentConfig { /** The Agent instance to be used as a subagent */ agent: TAgent; } /** * Configuration for streamText method */ interface StreamTextSubAgentConfig extends BaseSubAgentConfig { /** The method to use when calling the subagent */ method: "streamText"; /** Options for streamText method */ options?: StreamTextOptions; } /** * Configuration for generateText method */ interface GenerateTextSubAgentConfig extends BaseSubAgentConfig { /** The method to use when calling the subagent */ method: "generateText"; /** Options for generateText method */ options?: GenerateTextOptions; } /** * Configuration for streamObject method */ interface StreamObjectSubAgentConfig extends BaseSubAgentConfig { /** The method to use when calling the subagent */ method: "streamObject"; /** Schema for object generation (required) */ schema: TSchema; /** Options for streamObject method */ options?: StreamObjectOptions; } /** * Configuration for generateObject method */ interface GenerateObjectSubAgentConfig extends BaseSubAgentConfig { /** The method to use when calling the subagent */ method: "generateObject"; /** Schema for object generation (required) */ schema: TSchema; /** Options for generateObject method */ options?: GenerateObjectOptions; } /** * Union type for all subagent configurations * Each configuration is type-safe with its specific options and requirements */ type SubAgentConfig = StreamTextSubAgentConfig | GenerateTextSubAgentConfig | StreamObjectSubAgentConfig | GenerateObjectSubAgentConfig | TAgent; /** * Helper function to create a type-safe subagent configuration * * @example * // Direct Agent instance (uses streamText by default) * const supervisorAgent = new Agent({ * name: "Supervisor", * instructions: "...", * model: myModel, * subAgents: [myAgent] * }); * * @example * // Using streamText with options * const subagent = createSubagent({ * agent: myAgent, * method: 'streamText', * options: { temperature: 0.7, maxTokens: 1000 } * }); * * @example * // Using generateObject with schema * const subagent = createSubagent({ * agent: myAgent, * method: 'generateObject', * schema: z.object({ result: z.string() }), * options: { temperature: 0.2 } * }); */ declare function createSubagent(config: StreamTextSubAgentConfig): StreamTextSubAgentConfig; declare function createSubagent(config: GenerateTextSubAgentConfig): GenerateTextSubAgentConfig; declare function createSubagent(config: StreamObjectSubAgentConfig): StreamObjectSubAgentConfig; declare function createSubagent(config: GenerateObjectSubAgentConfig): GenerateObjectSubAgentConfig; interface InputGuardrailBlockedEventData { code: "GUARDRAIL_INPUT_BLOCKED"; reason: "input_guardrail_blocked"; message: string; guardrailId?: string; guardrailName?: string; severity?: "info" | "warning" | "critical"; } interface InputGuardrailBlockedStreamPart { type: "input-guardrail-blocked"; data: InputGuardrailBlockedEventData; messageId?: string; } type VoltAgentStreamMetadata = { /** * Optional response message identifier (carried on start/step chunks). */ messageId?: string; /** * Optional identifier for the subagent that generated this event */ subAgentId?: string; /** * Optional identifier for the agent that actually executed the step * (same as subAgentId for first-level handoffs) */ executingAgentId?: string; /** * Optional name of the subagent that generated this event */ subAgentName?: string; /** * Optional name of the agent that actually executed the step * (same as subAgentName for first-level handoffs) */ executingAgentName?: string; /** * Parent agent reference when forwarded through supervisors */ parentAgentId?: string; parentAgentName?: string; /** * Ordered list of agent names from supervisor -> executing agent */ agentPath?: string[]; }; /** * Extended TextStreamPart type that includes optional VoltAgent metadata and * custom VoltAgent stream events. * * @template TOOLS - The tool set type parameter from ai-sdk */ type VoltAgentTextStreamPart = Record> = (TextStreamPart | InputGuardrailBlockedStreamPart) & VoltAgentStreamMetadata; /** * Extended StreamTextResult that uses VoltAgentTextStreamPart for fullStream. * This maintains compatibility with ai-sdk while adding subagent metadata support. * * @template TOOLS - The tool set type parameter */ type VoltAgentStreamTextResult = Record, OUTPUT = unknown> = Omit, "fullStream"> & { /** * Full stream with subagent metadata support */ readonly fullStream: AsyncIterable>; } & Record; /** * ReadableStream type for voice responses */ type ReadableStreamType = ReadableStream | NodeJS.ReadableStream | any; /** * Voice provider options */ type VoiceOptions = { /** * API key for the voice provider */ apiKey?: string; /** * Model to use for speech recognition */ speechModel?: string; /** * Model to use for text-to-speech */ ttsModel?: string; /** * Voice ID to use for text-to-speech */ voice?: string; /** * Additional provider-specific options */ options?: Record; }; /** * Voice event types */ type VoiceEventType = "speaking" | "listening" | "error" | "connected" | "disconnected"; /** * Voice event data types */ type VoiceEventData = { speaking: { text: string; audio?: NodeJS.ReadableStream; }; listening: { audio: NodeJS.ReadableStream; }; error: { message: string; code?: string; details?: unknown; }; connected: undefined; disconnected: undefined; }; /** * Voice metadata */ type VoiceMetadata = { id: string; name: string; language: string; gender?: "male" | "female" | "neutral"; metadata?: Record; }; /** * Base interface for voice providers */ type Voice = { /** * Convert text to speech */ speak(text: string | NodeJS.ReadableStream, options?: { voice?: string; speed?: number; pitch?: number; }): Promise; /** * Convert speech to text */ listen(audio: NodeJS.ReadableStream, options?: { language?: string; model?: string; stream?: boolean; }): Promise; /** * Connect to real-time voice service */ connect(options?: Record): Promise; /** * Disconnect from real-time voice service */ disconnect(): void; /** * Send audio data to real-time service */ send(audioData: NodeJS.ReadableStream | Int16Array): Promise; /** * Register event listener */ on(event: E, callback: (data: VoiceEventData[E]) => void): void; /** * Remove event listener */ off(event: E, callback: (data: VoiceEventData[E]) => void): void; /** * Get available voices */ getVoices(): Promise; }; /** * Vector adapter interface for vector storage and similarity search */ interface VectorAdapter$1 { /** * Store a vector with associated metadata */ store(id: string, vector: number[], metadata?: Record): Promise; /** * Store multiple vectors in batch */ storeBatch(items: VectorItem$1[]): Promise; /** * Search for similar vectors using cosine similarity */ search(vector: number[], options?: VectorSearchOptions): Promise; /** * Delete a vector by ID */ delete(id: string): Promise; /** * Delete multiple vectors by IDs */ deleteBatch(ids: string[]): Promise; /** * Clear all vectors */ clear(): Promise; /** * Get total count of stored vectors */ count(): Promise; /** * Get a specific vector by ID */ get(id: string): Promise; } /** * Item to store in vector database */ interface VectorItem$1 { /** * Unique identifier for the vector */ id: string; /** * The embedding vector */ vector: number[]; /** * Optional metadata associated with the vector */ metadata?: Record; /** * Optional text content that was embedded */ content?: string; } /** * Options for vector search */ interface VectorSearchOptions { /** * Maximum number of results to return */ limit?: number; /** * Minimum similarity threshold (0-1) */ threshold?: number; /** * Filter results by metadata */ filter?: Record; } /** * Search result with similarity score */ interface SearchResult$1 extends VectorItem$1 { /** * Similarity score (0-1, higher is more similar) */ score: number; /** * Distance from query vector (lower is closer) */ distance?: number; } /** * Memory V2 Type Definitions * Clean separation between conversation memory and telemetry */ /** * Extended UIMessage type with storage metadata */ type StoredUIMessage = UIMessage & { createdAt: Date; userId: string; conversationId: string; }; /** * Conversation type */ type Conversation = { id: string; resourceId: string; userId: string; title: string; metadata: Record; createdAt: string; updatedAt: string; }; /** * Input type for creating a conversation */ type CreateConversationInput = { id: string; resourceId: string; userId: string; title: string; metadata: Record; }; /** * Query builder options for conversations */ type ConversationQueryOptions = { userId?: string; resourceId?: string; limit?: number; offset?: number; orderBy?: "created_at" | "updated_at" | "title"; orderDirection?: "ASC" | "DESC"; }; /** * Options for getting messages */ type GetMessagesOptions = { limit?: number; before?: Date; after?: Date; roles?: string[]; }; type ConversationStepType = "text" | "tool_call" | "tool_result"; interface ConversationStepRecord { id: string; conversationId: string; userId: string; agentId: string; agentName?: string; operationId: string; stepIndex: number; type: ConversationStepType; role: MessageRole; content?: string; arguments?: Record | null; result?: Record | null; usage?: UsageInfo; subAgentId?: string; subAgentName?: string; createdAt: string; } interface GetConversationStepsOptions { limit?: number; operationId?: string; } /** * Memory options for MemoryManager */ type MemoryOptions = {}; type ConversationTitleConfig = { enabled?: boolean; model?: AgentModelValue; temperature?: number | null; maxOutputTokens?: number; maxLength?: number; systemPrompt?: string | null; }; type ConversationTitleGenerator = (params: { input: OperationContext["input"] | UIMessage; context: OperationContext; defaultTitle: string; }) => Promise; /** * Workflow state entry for suspension and resumption * Stores only the essential state needed to resume a workflow */ interface WorkflowStateEntry { /** Unique execution ID */ id: string; /** Workflow definition ID */ workflowId: string; /** Workflow name for reference */ workflowName: string; /** Current status */ status: "running" | "suspended" | "completed" | "cancelled" | "error"; /** Original input to the workflow */ input?: unknown; /** Execution context */ context?: Array<[string | symbol, unknown]>; /** Shared workflow state at the time of persistence */ workflowState?: Record; /** Suspension metadata including checkpoint data */ suspension?: { suspendedAt: Date; reason?: string; stepIndex: number; lastEventSequence?: number; checkpoint?: { stepExecutionState?: any; completedStepsData?: any[]; workflowState?: Record; stepData?: Record; usage?: UsageInfo; }; suspendData?: any; }; /** * Stream events collected during execution * Used for timeline visualization in UI */ events?: Array<{ id: string; type: string; name?: string; from?: string; startTime: string; endTime?: string; status?: string; input?: any; output?: any; metadata?: Record; context?: Record; }>; /** Final output of the workflow execution */ output?: unknown; /** Cancellation metadata */ cancellation?: { cancelledAt: Date; reason?: string; }; /** User ID if applicable */ userId?: string; /** Conversation ID if applicable */ conversationId?: string; /** Source execution ID if this run is a replay */ replayedFromExecutionId?: string; /** Source step ID used when this run was replayed */ replayFromStepId?: string; /** Additional metadata */ metadata?: Record; /** Timestamps */ createdAt: Date; updatedAt: Date; } interface WorkflowRunQuery { workflowId?: string; status?: WorkflowStateEntry["status"]; from?: Date; to?: Date; limit?: number; offset?: number; userId?: string; metadata?: Record; } /** * Working memory scope - conversation or user level */ type WorkingMemoryScope = "conversation" | "user"; /** * Simple memory update modes */ type MemoryUpdateMode = "replace" | "append"; /** * Options for updating working memory (simplified) */ type WorkingMemoryUpdateOptions = { /** How to update the memory (default: "replace") */ mode?: MemoryUpdateMode; }; /** * Working memory configuration * Auto-detects format: schema → JSON, template → markdown */ type WorkingMemoryConfig = { enabled: boolean; scope?: WorkingMemoryScope; } & ({ template: string; schema?: never; } | { schema: z.ZodObject; template?: never; } | { template?: never; schema?: never; }); /** * Memory V2 configuration options */ interface MemoryConfig { /** * Storage adapter for conversations and messages */ storage: StorageAdapter; /** * Optional embedding adapter or model reference for semantic operations */ embedding?: EmbeddingAdapterInput; /** * Optional vector adapter for similarity search */ vector?: VectorAdapter; /** * Enable caching for embeddings * @default false */ enableCache?: boolean; /** * Maximum number of embeddings to cache * @default 1000 */ cacheSize?: number; /** * Cache TTL in milliseconds * @default 3600000 (1 hour) */ cacheTTL?: number; /** * Working memory configuration * Enables agents to maintain important context */ workingMemory?: WorkingMemoryConfig; /** * Automatically generate a title for new conversations using the agent's model * (or the override model if provided). * @default false */ generateTitle?: boolean | ConversationTitleConfig; } /** * Embedding adapter config for Memory */ type EmbeddingAdapterConfig = EmbeddingOptions & { model: EmbeddingModelReference; }; /** * Embedding input options for Memory */ type EmbeddingAdapterInput = EmbeddingAdapter | EmbeddingModelReference | EmbeddingAdapterConfig; /** * Metadata about the underlying storage adapter */ interface MemoryStorageMetadata { /** Name of the configured storage adapter */ adapter: string; } /** * Summary of working memory configuration exposed to the UI */ interface WorkingMemorySummary { /** Whether working memory support is enabled */ enabled: boolean; /** Scope of working memory persistence */ scope?: WorkingMemoryScope; /** Output format (markdown/json) */ format: "markdown" | "json" | null; /** Indicates if a template is configured */ hasTemplate: boolean; /** Indicates if a schema is configured */ hasSchema: boolean; /** Template content if configured */ template?: string | null; /** Simplified schema field map if configured */ schema?: Record | null; } /** * Document type for RAG operations */ interface Document { id: string; content: string; metadata?: Record; } /** * Search options for semantic search */ interface SearchOptions { limit?: number; threshold?: number; filter?: Record; } /** * Search result from vector operations */ interface SearchResult { id: string; score: number; content?: string; metadata?: Record; } /** * Vector item for batch operations */ interface VectorItem { id: string; vector: number[]; metadata?: Record; } /** * Storage Adapter Interface * Handles persistence of conversations and messages */ interface StorageAdapter { addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise; addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise; getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise[]>; clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise; /** * Delete specific messages by ID for a conversation. * Adapters should perform an atomic delete when possible. If atomic deletes or transactions * are unavailable, a best-effort deletion (for example, clear + rehydrate) may be used. */ deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise; createConversation(input: CreateConversationInput): Promise; getConversation(id: string): Promise; getConversations(resourceId: string): Promise; getConversationsByUserId(userId: string, options?: Omit): Promise; queryConversations(options: ConversationQueryOptions): Promise; /** * Count conversations matching query filters (limit/offset ignored). */ countConversations(options: ConversationQueryOptions): Promise; updateConversation(id: string, updates: Partial>): Promise; deleteConversation(id: string): Promise; saveConversationSteps?(steps: ConversationStepRecord[]): Promise; getConversationSteps?(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise; getWorkingMemory(params: { conversationId?: string; userId?: string; scope: WorkingMemoryScope; }): Promise; setWorkingMemory(params: { conversationId?: string; userId?: string; content: string; scope: WorkingMemoryScope; }): Promise; deleteWorkingMemory(params: { conversationId?: string; userId?: string; scope: WorkingMemoryScope; }): Promise; getWorkflowState(executionId: string): Promise; queryWorkflowRuns(query: WorkflowRunQuery): Promise; setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise; updateWorkflowState(executionId: string, updates: Partial): Promise; getSuspendedWorkflowStates(workflowId: string): Promise; } /** * Embedding Adapter Interface * Handles text to vector conversions */ interface EmbeddingAdapter { /** * Embed a single text */ embed(text: string): Promise; /** * Embed multiple texts in batch */ embedBatch(texts: string[]): Promise; /** * Get embedding dimensions */ getDimensions(): number; /** * Get model name */ getModelName(): string; } /** * Vector Adapter Interface * Handles vector storage and similarity search */ interface VectorAdapter { /** * Store a single vector */ store(id: string, vector: number[], metadata?: Record): Promise; /** * Store multiple vectors in batch */ storeBatch(items: VectorItem[]): Promise; /** * Search for similar vectors */ search(vector: number[], options?: { limit?: number; filter?: Record; threshold?: number; }): Promise; /** * Delete a vector by ID */ delete(id: string): Promise; /** * Delete multiple vectors by IDs */ deleteBatch(ids: string[]): Promise; /** * Clear all vectors */ clear(): Promise; } /** * VoltOps Client Type Definitions * * All types related to VoltOps client functionality including * prompt management, telemetry, and API interactions. */ type ManagedMemoryStatus = "provisioning" | "ready" | "failed"; /** * Reference to a prompt in the VoltOps system */ type PromptReference = { /** Name of the prompt */ promptName: string; /** Specific version number (takes precedence over label) */ version?: number; /** Label to fetch (e.g., 'latest', 'production', 'staging') */ label?: string; /** Variables to substitute in the template */ variables?: Record; /** Per-prompt cache configuration (overrides global settings) */ promptCache?: { enabled?: boolean; ttl?: number; maxSize?: number; }; }; /** * Helper interface for prompt operations in agent instructions */ type PromptHelper = { /** Get prompt content by reference */ getPrompt: (reference: PromptReference) => Promise; }; /** * Enhanced dynamic value options with prompts support */ interface DynamicValueOptions { /** User context map */ context: Map; /** HTTP request headers for server-triggered agent calls, when available */ headers?: Record; /** Prompt helper (available when VoltOpsClient is configured) */ prompts: PromptHelper; } /** * Dynamic value type for agent configuration */ type DynamicValue = (options: DynamicValueOptions) => Promise | T; /** * VoltOps client configuration options */ type VoltOpsClientOptions = { /** Base URL of the VoltOps API (default: https://api.voltagent.dev) */ baseUrl?: string; /** * Public API key for VoltOps authentication * * @description Your VoltOps public key used for API authentication and prompt management. * This key is safe to use in client-side applications as it only provides read access. * * @format Should start with `pk_` prefix (e.g., `pk_1234567890abcdef`) * * @example * ```typescript * publicKey: process.env.VOLTAGENT_PUBLIC_KEY * ``` * * * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects */ publicKey?: string; /** * Secret API key for VoltOps authentication * * @description Your VoltOps secret key used for secure API operations and analytics. * This key provides full access to your VoltOps project and should be kept secure. * * @format Should start with `sk_` prefix (e.g., `sk_abcdef1234567890`) * * @example * ```typescript * secretKey: process.env.VOLTAGENT_SECRET_KEY * ``` * * * @obtain Get your API keys from: https://console.voltagent.dev/settings/projects */ secretKey?: string; /** Custom fetch implementation (optional) */ fetch?: typeof fetch; /** Enable prompt management (default: true) */ prompts?: boolean; /** Optional configuration for prompt caching */ promptCache?: { enabled?: boolean; ttl?: number; maxSize?: number; }; }; type VoltOpsFeedbackConfig = { type: "continuous" | "categorical" | "freeform"; min?: number; max?: number; categories?: Array<{ value: string | number; label?: string; description?: string; }>; [key: string]: any; }; type VoltOpsFeedbackExpiresIn = { days?: number; hours?: number; minutes?: number; }; type VoltOpsFeedbackToken = { id: string; url: string; expiresAt: string; feedbackConfig?: VoltOpsFeedbackConfig | null; }; type VoltOpsFeedbackTokenCreateInput = { traceId: string; key: string; feedbackConfig?: VoltOpsFeedbackConfig | null; expiresAt?: Date | string; expiresIn?: VoltOpsFeedbackExpiresIn; }; type VoltOpsFeedbackCreateInput = { traceId: string; key: string; id?: string; score?: number | boolean | null; value?: unknown; correction?: unknown; comment?: string | null; feedbackConfig?: VoltOpsFeedbackConfig | null; feedbackSource?: Record | null; feedbackSourceType?: string; createdAt?: Date | string; }; type VoltOpsFeedback = { id: string; trace_id: string; key: string; score?: number | boolean | null; value?: unknown; correction?: unknown; comment?: string | null; feedback_source?: Record | null; feedback_source_type?: string | null; feedback_config?: VoltOpsFeedbackConfig | null; created_at?: string; updated_at?: string; source_info?: Record | null; [key: string]: unknown; }; /** * Cached prompt data for performance optimization */ type CachedPrompt = { /** Prompt content */ content: string; /** When the prompt was fetched */ fetchedAt: number; /** Time to live in milliseconds */ ttl: number; }; interface VoltOpsActionExecutionResult { actionId: string; provider: string; requestPayload: Record; responsePayload: unknown; metadata?: Record | null; } type VoltOpsCredentialMetadata = { metadata?: Record; }; type VoltOpsStoredCredentialRef = { credentialId: string; } & VoltOpsCredentialMetadata; type WithCredentialMetadata = T & VoltOpsCredentialMetadata; type VoltOpsAirtableCredential = VoltOpsStoredCredentialRef | WithCredentialMetadata<{ apiKey: string; }>; type VoltOpsSlackCredential = VoltOpsStoredCredentialRef | WithCredentialMetadata<{ botToken: string; }>; type VoltOpsDiscordCredential = VoltOpsStoredCredentialRef | WithCredentialMetadata<{ botToken: string; }> | WithCredentialMetadata<{ webhookUrl: string; }>; type VoltOpsGoogleCalendarCredential = VoltOpsStoredCredentialRef | WithCredentialMetadata<{ accessToken?: string; refreshToken?: string; clientId?: string; clientSecret?: string; tokenType?: string; expiresAt?: string; }>; type VoltOpsGoogleDriveCredential = VoltOpsStoredCredentialRef | WithCredentialMetadata<{ accessToken?: string; refreshToken?: string; clientId?: string; clientSecret?: string; tokenType?: string; expiresAt?: string; }>; type VoltOpsPostgresCredential = VoltOpsStoredCredentialRef | WithCredentialMetadata<{ host: string; port?: number; user: string; password: string; database: string; ssl?: boolean; rejectUnauthorized?: boolean; }>; type VoltOpsGmailCredential = VoltOpsStoredCredentialRef | WithCredentialMetadata<{ accessToken?: string; refreshToken?: string; clientId?: string; clientSecret?: string; tokenType?: string; expiresAt?: string; }> | WithCredentialMetadata<{ clientEmail: string; privateKey: string; subject?: string | null; }>; interface VoltOpsGmailAttachment { filename?: string; content: string; contentType?: string; } interface VoltOpsAirtableCreateRecordParams { credential: VoltOpsAirtableCredential; baseId: string; tableId: string; fields: Record; typecast?: boolean; returnFieldsByFieldId?: boolean; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsAirtableUpdateRecordParams { credential: VoltOpsAirtableCredential; baseId: string; tableId: string; recordId: string; fields?: Record; typecast?: boolean; returnFieldsByFieldId?: boolean; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsAirtableDeleteRecordParams { credential: VoltOpsAirtableCredential; baseId: string; tableId: string; recordId: string; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsAirtableGetRecordParams { credential: VoltOpsAirtableCredential; baseId: string; tableId: string; recordId: string; returnFieldsByFieldId?: boolean; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsAirtableListRecordsParams { credential: VoltOpsAirtableCredential; baseId: string; tableId: string; view?: string; filterByFormula?: string; maxRecords?: number; pageSize?: number; offset?: string; fields?: string[]; sort?: Array<{ field: string; direction?: "asc" | "desc"; }>; returnFieldsByFieldId?: boolean; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsSlackBaseParams { credential: VoltOpsSlackCredential; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsSlackPostMessageParams extends VoltOpsSlackBaseParams { channelId?: string; channelName?: string; channelLabel?: string | null; defaultThreadTs?: string | null; targetType?: "conversation" | "user"; userId?: string; userName?: string; text?: string; blocks?: unknown; attachments?: unknown; threadTs?: string; metadata?: Record; linkNames?: boolean; unfurlLinks?: boolean; unfurlMedia?: boolean; } interface VoltOpsSlackDeleteMessageParams extends VoltOpsSlackBaseParams { channelId: string; messageTs: string; threadTs?: string; } interface VoltOpsSlackSearchMessagesParams extends VoltOpsSlackBaseParams { query: string; sort?: "relevance" | "timestamp"; sortDirection?: "asc" | "desc"; channelIds?: string[]; limit?: number; } type VoltOpsDiscordChannelType = "text" | "voice" | "announcement" | "category" | "forum"; interface VoltOpsDiscordConfig { guildId?: string; channelId?: string; threadId?: string; userId?: string; roleId?: string; } interface VoltOpsDiscordBaseParams { credential: VoltOpsDiscordCredential; catalogId?: string; projectId?: string | null; actionId?: string; config?: VoltOpsDiscordConfig | null; } interface VoltOpsDiscordSendMessageParams extends VoltOpsDiscordBaseParams { guildId?: string; channelId?: string; threadId?: string; content?: string; embeds?: unknown[]; components?: unknown[]; tts?: boolean; allowedMentions?: Record; replyToMessageId?: string; } interface VoltOpsDiscordSendWebhookMessageParams extends VoltOpsDiscordSendMessageParams { username?: string; avatarUrl?: string; } interface VoltOpsDiscordChannelMessageParams extends VoltOpsDiscordBaseParams { channelId: string; messageId: string; } interface VoltOpsDiscordListMessagesParams extends VoltOpsDiscordBaseParams { channelId: string; limit?: number; before?: string; after?: string; } interface VoltOpsDiscordReactionParams extends VoltOpsDiscordBaseParams { channelId: string; messageId: string; emoji: string; } interface VoltOpsDiscordCreateChannelParams extends VoltOpsDiscordBaseParams { guildId: string; name: string; type?: VoltOpsDiscordChannelType; topic?: string; } interface VoltOpsDiscordUpdateChannelParams extends VoltOpsDiscordBaseParams { channelId: string; name?: string; topic?: string; archived?: boolean; locked?: boolean; } interface VoltOpsDiscordDeleteChannelParams extends VoltOpsDiscordBaseParams { channelId: string; } interface VoltOpsDiscordGetChannelParams extends VoltOpsDiscordBaseParams { channelId: string; } interface VoltOpsDiscordListChannelsParams extends VoltOpsDiscordBaseParams { guildId: string; } interface VoltOpsDiscordListMembersParams extends VoltOpsDiscordBaseParams { guildId: string; limit?: number; after?: string; } interface VoltOpsDiscordMemberRoleParams extends VoltOpsDiscordBaseParams { guildId: string; userId: string; roleId: string; } interface VoltOpsPostgresBaseParams { credential: VoltOpsPostgresCredential; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsPostgresExecuteParams extends VoltOpsPostgresBaseParams { query: string; parameters?: unknown[]; applicationName?: string; statementTimeoutMs?: number; connectionTimeoutMs?: number; ssl?: { rejectUnauthorized?: boolean; }; } interface VoltOpsGmailBaseParams { credential: VoltOpsGmailCredential; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsGmailSendEmailParams extends VoltOpsGmailBaseParams { to: string | string[]; cc?: string | string[]; bcc?: string | string[]; subject: string; body?: string; bodyType?: "text" | "html"; htmlBody?: string; textBody?: string; replyTo?: string | string[]; from?: string; senderName?: string; inReplyTo?: string; threadId?: string; attachments?: VoltOpsGmailAttachment[]; draft?: boolean; } interface VoltOpsGmailReplyParams extends VoltOpsGmailSendEmailParams { } interface VoltOpsGmailSearchParams extends VoltOpsGmailBaseParams { from?: string; to?: string; subject?: string; label?: string; category?: string; after?: number; before?: number; maxResults?: number; pageToken?: string; query?: string; } interface VoltOpsGmailGetEmailParams extends VoltOpsGmailBaseParams { messageId: string; format?: "full" | "minimal" | "raw" | "metadata"; } interface VoltOpsGmailGetThreadParams extends VoltOpsGmailBaseParams { threadId: string; format?: "full" | "minimal" | "raw" | "metadata"; } interface VoltOpsGoogleCalendarBaseParams { credential: VoltOpsGoogleCalendarCredential; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsGoogleCalendarCreateParams extends VoltOpsGoogleCalendarBaseParams { calendarId?: string; summary: string; start: { dateTime: string; timeZone?: string | null; }; end: { dateTime: string; timeZone?: string | null; }; description?: string; location?: string; status?: string; attendees?: Array<{ email: string; optional?: boolean; comment?: string; }>; } interface VoltOpsGoogleCalendarUpdateParams extends VoltOpsGoogleCalendarBaseParams { eventId: string; calendarId?: string; summary?: string; description?: string; location?: string; status?: string; start?: { dateTime: string; timeZone?: string | null; } | null; end?: { dateTime: string; timeZone?: string | null; } | null; attendees?: Array<{ email: string; optional?: boolean; comment?: string; }>; } interface VoltOpsGoogleCalendarDeleteParams extends VoltOpsGoogleCalendarBaseParams { eventId: string; calendarId?: string; } interface VoltOpsGoogleCalendarListParams extends VoltOpsGoogleCalendarBaseParams { calendarId?: string; timeMin?: string; timeMax?: string; maxResults?: number; pageToken?: string; q?: string; showDeleted?: boolean; singleEvents?: boolean; orderBy?: string; } interface VoltOpsGoogleCalendarGetParams extends VoltOpsGoogleCalendarBaseParams { eventId: string; calendarId?: string; } interface VoltOpsGoogleDriveBaseParams { credential: VoltOpsGoogleDriveCredential; actionId?: string; catalogId?: string; projectId?: string | null; } interface VoltOpsGoogleDriveListParams extends VoltOpsGoogleDriveBaseParams { q?: string; pageSize?: number; pageToken?: string; orderBy?: string; includeTrashed?: boolean; } interface VoltOpsGoogleDriveGetFileParams extends VoltOpsGoogleDriveBaseParams { fileId: string; } interface VoltOpsGoogleDriveDownloadParams extends VoltOpsGoogleDriveBaseParams { fileId: string; } interface VoltOpsGoogleDriveUploadParams extends VoltOpsGoogleDriveBaseParams { name: string; mimeType?: string; parents?: string[]; content?: string; isBase64?: boolean; } interface VoltOpsGoogleDriveCreateFolderParams extends VoltOpsGoogleDriveBaseParams { name: string; parents?: string[]; } interface VoltOpsGoogleDriveMoveParams extends VoltOpsGoogleDriveBaseParams { fileId: string; newParentId: string; removeAllParents?: boolean; } interface VoltOpsGoogleDriveCopyParams extends VoltOpsGoogleDriveBaseParams { fileId: string; destinationParentId?: string; name?: string; } interface VoltOpsGoogleDriveDeleteParams extends VoltOpsGoogleDriveBaseParams { fileId: string; } interface VoltOpsGoogleDriveShareParams extends VoltOpsGoogleDriveBaseParams { fileId: string; } type VoltOpsActionsApi = { airtable: { createRecord: (params: VoltOpsAirtableCreateRecordParams) => Promise; updateRecord: (params: VoltOpsAirtableUpdateRecordParams) => Promise; deleteRecord: (params: VoltOpsAirtableDeleteRecordParams) => Promise; getRecord: (params: VoltOpsAirtableGetRecordParams) => Promise; listRecords: (params: VoltOpsAirtableListRecordsParams) => Promise; }; slack: { postMessage: (params: VoltOpsSlackPostMessageParams) => Promise; deleteMessage: (params: VoltOpsSlackDeleteMessageParams) => Promise; searchMessages: (params: VoltOpsSlackSearchMessagesParams) => Promise; }; discord: { sendMessage: (params: VoltOpsDiscordSendMessageParams) => Promise; sendWebhookMessage: (params: VoltOpsDiscordSendWebhookMessageParams) => Promise; deleteMessage: (params: VoltOpsDiscordChannelMessageParams) => Promise; getMessage: (params: VoltOpsDiscordChannelMessageParams) => Promise; listMessages: (params: VoltOpsDiscordListMessagesParams) => Promise; addReaction: (params: VoltOpsDiscordReactionParams) => Promise; removeReaction: (params: VoltOpsDiscordReactionParams) => Promise; createChannel: (params: VoltOpsDiscordCreateChannelParams) => Promise; updateChannel: (params: VoltOpsDiscordUpdateChannelParams) => Promise; deleteChannel: (params: VoltOpsDiscordDeleteChannelParams) => Promise; getChannel: (params: VoltOpsDiscordGetChannelParams) => Promise; listChannels: (params: VoltOpsDiscordListChannelsParams) => Promise; listMembers: (params: VoltOpsDiscordListMembersParams) => Promise; addMemberRole: (params: VoltOpsDiscordMemberRoleParams) => Promise; removeMemberRole: (params: VoltOpsDiscordMemberRoleParams) => Promise; }; gmail: { sendEmail: (params: VoltOpsGmailSendEmailParams) => Promise; replyToEmail: (params: VoltOpsGmailReplyParams) => Promise; searchEmail: (params: VoltOpsGmailSearchParams) => Promise; getEmail: (params: VoltOpsGmailGetEmailParams) => Promise; getThread: (params: VoltOpsGmailGetThreadParams) => Promise; }; googlecalendar: { createEvent: (params: VoltOpsGoogleCalendarCreateParams) => Promise; updateEvent: (params: VoltOpsGoogleCalendarUpdateParams) => Promise; deleteEvent: (params: VoltOpsGoogleCalendarDeleteParams) => Promise; listEvents: (params: VoltOpsGoogleCalendarListParams) => Promise; getEvent: (params: VoltOpsGoogleCalendarGetParams) => Promise; }; googledrive: { listFiles: (params: VoltOpsGoogleDriveListParams) => Promise; getFileMetadata: (params: VoltOpsGoogleDriveGetFileParams) => Promise; downloadFile: (params: VoltOpsGoogleDriveDownloadParams) => Promise; uploadFile: (params: VoltOpsGoogleDriveUploadParams) => Promise; createFolder: (params: VoltOpsGoogleDriveCreateFolderParams) => Promise; moveFile: (params: VoltOpsGoogleDriveMoveParams) => Promise; copyFile: (params: VoltOpsGoogleDriveCopyParams) => Promise; deleteFile: (params: VoltOpsGoogleDriveDeleteParams) => Promise; shareFilePublic: (params: VoltOpsGoogleDriveShareParams) => Promise; }; postgres: { executeQuery: (params: VoltOpsPostgresExecuteParams) => Promise; }; }; interface VoltOpsEvalsApi { runs: { create(payload?: VoltOpsCreateEvalRunRequest): Promise; appendResults(runId: string, payload: VoltOpsAppendEvalRunResultsRequest): Promise; complete(runId: string, payload: VoltOpsCompleteEvalRunRequest): Promise; fail(runId: string, payload: VoltOpsFailEvalRunRequest): Promise; }; scorers: { create(payload: VoltOpsCreateScorerRequest): Promise; }; } /** * API response for prompt fetch operations * Simplified format matching the desired response structure */ type PromptApiResponse = { /** Prompt name */ name: string; /** Prompt type */ type: "text" | "chat"; /** Prompt content object */ prompt: PromptContent; /** LLM configuration */ config: { model?: string; temperature?: number; max_tokens?: number; top_p?: number; frequency_penalty?: number; presence_penalty?: number; supported_languages?: string[]; [key: string]: any; }; /** Prompt version number */ version: number; /** Labels array */ labels: string[]; /** Tags array */ tags: string[]; /** Base prompt ID for tracking */ prompt_id: string; /** PromptVersion ID (the actual entity ID) */ prompt_version_id: string; }; /** * API client interface for prompt operations */ interface PromptApiClient { /** Fetch a prompt by reference */ fetchPrompt(reference: PromptReference): Promise; } /** * VoltOps prompt manager interface */ interface VoltOpsPromptManager { /** Get prompt content by reference */ getPrompt(reference: PromptReference): Promise; /** Preload prompts for better performance */ preload(references: PromptReference[]): Promise; /** Clear cache */ clearCache(): void; /** Get cache statistics */ getCacheStats(): { size: number; entries: string[]; }; } type VoltOpsEvalRunStatus = "pending" | "running" | "succeeded" | "failed" | "cancelled"; type VoltOpsTerminalEvalRunStatus = "succeeded" | "failed" | "cancelled"; type VoltOpsEvalResultStatus = "pending" | "running" | "passed" | "failed" | "error"; interface VoltOpsEvalRunSummary { id: string; status: VoltOpsEvalRunStatus | string; triggerSource: string; datasetId?: string | null; datasetVersionId?: string | null; datasetVersionLabel?: string | null; itemCount: number; successCount: number; failureCount: number; meanScore?: number | null; medianScore?: number | null; sumScore?: number | null; passRate?: number | null; startedAt?: string | null; completedAt?: string | null; durationMs?: number | null; tags?: string[] | null; createdAt: string; updatedAt: string; } interface VoltOpsCreateEvalRunRequest { experimentId?: string; datasetVersionId?: string; providerCredentialId?: string; triggerSource?: string; autoQueue?: boolean; } interface VoltOpsEvalRunResultScorePayload { scorerId: string; score?: number | null; threshold?: number | null; thresholdPassed?: boolean | null; metadata?: Record | null; } interface VoltOpsEvalRunResultLiveMetadata { traceId?: string | null; spanId?: string | null; operationId?: string | null; operationType?: string | null; sampling?: { strategy: string; rate?: number | null; } | null; triggerSource?: string | null; environment?: string | null; } interface VoltOpsAppendEvalRunResultPayload { id?: string; datasetItemId?: string | null; datasetItemHash: string; status?: VoltOpsEvalResultStatus; input?: unknown; expected?: unknown; output?: unknown; durationMs?: number | null; scores?: VoltOpsEvalRunResultScorePayload[]; metadata?: Record | null; traceIds?: string[] | null; liveEval?: VoltOpsEvalRunResultLiveMetadata | null; } interface VoltOpsAppendEvalRunResultsRequest { results: VoltOpsAppendEvalRunResultPayload[]; } interface VoltOpsEvalRunCompletionSummaryPayload { itemCount?: number; successCount?: number; failureCount?: number; meanScore?: number | null; medianScore?: number | null; sumScore?: number | null; passRate?: number | null; durationMs?: number | null; metadata?: Record | null; } interface VoltOpsEvalRunErrorPayload { message: string; code?: string; details?: Record; } interface VoltOpsCompleteEvalRunRequest { status: VoltOpsTerminalEvalRunStatus; summary?: VoltOpsEvalRunCompletionSummaryPayload; error?: VoltOpsEvalRunErrorPayload; } interface VoltOpsFailEvalRunRequest { error: VoltOpsEvalRunErrorPayload; } interface VoltOpsCreateScorerRequest { id: string; name: string; category?: string | null; description?: string | null; defaultThreshold?: number | null; thresholdOperator?: string | null; metadata?: Record | null; } interface VoltOpsScorerSummary { id: string; name: string; category?: string | null; description?: string | null; defaultThreshold?: number | null; thresholdOperator?: string | null; metadata?: Record | null; createdAt: string; updatedAt: string; } type VoltOpsTraceSortOrder = "asc" | "desc"; interface VoltOpsTraceListOptions { agentId?: string | string[]; model?: string | string[]; traceId?: string; limit?: number; offset?: number; sortBy?: string; sortOrder?: VoltOpsTraceSortOrder; environments?: string | string[]; status?: string | string[]; level?: string | string[]; tags?: string | string[]; userId?: string; startDate?: string | Date; endDate?: string | Date; minTokens?: number; maxTokens?: number; minCost?: number; maxCost?: number; minDuration?: number; maxDuration?: number; search?: string; conversationId?: string; entityType?: string | string[]; promptId?: string; promptVersion?: string; feedbackKey?: string | string[]; feedbackScore?: number; minFeedbackScore?: number; maxFeedbackScore?: number; feedbackValue?: string; feedbackSourceType?: string | string[]; } interface VoltOpsObservabilityTrace { trace_id: string; project_id: string; agent_id?: string; entity_type?: string; user_id?: string | null; conversation_id?: string | null; start_time: string; end_time?: string | null; status?: string | null; input?: unknown; output?: unknown; usage?: unknown; metadata?: Record | null; tags?: string[] | null; model?: string | null; level?: string | null; status_message?: string | null; service_name?: string; service_version?: string | null; span_count?: number; error_count?: number; duration_ms?: number | null; resource_attributes?: Record | null; created_at?: string; latest_feedback_score?: number | null; latest_feedback_key?: string | null; latest_feedback_comment?: string | null; latest_feedback_at?: string | null; [key: string]: unknown; } interface VoltOpsTraceListResponse { data: VoltOpsObservabilityTrace[]; total: number; pageCount: number; subscription?: unknown; } interface VoltOpsObservabilityApi { traces: { list(options?: VoltOpsTraceListOptions): Promise; }; } /** * Main VoltOps client interface */ interface VoltOpsClient$1 { /** Prompt management functionality */ prompts?: VoltOpsPromptManager; /** Configuration options */ options: VoltOpsClientOptions & { baseUrl: string; }; /** Actions client for third-party integrations */ actions: VoltOpsActionsApi; /** Evaluations API surface */ evals: VoltOpsEvalsApi; /** Observability read API surface */ observability: VoltOpsObservabilityApi; /** Create a feedback token for the given trace */ createFeedbackToken(input: VoltOpsFeedbackTokenCreateInput): Promise; /** Create a feedback entry for the given trace */ createFeedback(input: VoltOpsFeedbackCreateInput): Promise; /** Create a prompt helper for agent instructions */ createPromptHelper(agentId: string, historyEntryId?: string): PromptHelper; /** List managed memory databases available to the project */ listManagedMemoryDatabases(): Promise; /** List credentials for a managed memory database */ listManagedMemoryCredentials(databaseId: string): Promise; /** Create a credential for a managed memory database */ createManagedMemoryCredential(databaseId: string, input?: { name?: string; }): Promise; /** Managed memory storage operations */ managedMemory: ManagedMemoryVoltOpsClient; } /** * Chat message structure compatible with BaseMessage */ type ChatMessage = BaseMessage; /** * Content of a prompt - either text or chat messages */ interface PromptContent { type: "text" | "chat"; text?: string; messages?: ChatMessage[]; /** * Metadata about the prompt from VoltOps API * Available when prompt is fetched from VoltOps */ metadata?: { /** Base prompt ID for tracking */ prompt_id?: string; /** Specific PromptVersion ID (critical for analytics) */ prompt_version_id?: string; /** Prompt name */ name?: string; /** Prompt version number */ version?: number; /** Labels array (e.g., 'production', 'staging', 'latest') */ labels?: string[]; /** Tags array for categorization */ tags?: string[]; /** Prompt source location (e.g., "local-file" or "online") */ source?: "local-file" | "online"; /** Latest online version when available */ latest_version?: number; /** Whether the local prompt is older than the online version */ outdated?: boolean; /** LLM configuration from prompt */ config?: { model?: string; temperature?: number; max_tokens?: number; top_p?: number; frequency_penalty?: number; presence_penalty?: number; supported_languages?: string[]; [key: string]: any; }; }; } interface ManagedMemoryConnectionInfo { host: string; port: number; database: string; schema: string; tablePrefix: string; ssl: boolean; } interface ManagedMemoryDatabaseSummary { id: string; organization_id: string; name: string; region: string; schema_name: string; table_prefix: string; status: ManagedMemoryStatus; last_error?: string | null; metadata?: Record | null; created_at: string; updated_at: string; connection: ManagedMemoryConnectionInfo; } interface ManagedMemoryCredentialSummary { id: string; name: string; role: string; username: string; secret: string | null; expiresAt: string | null; isRevoked: boolean; createdAt: string; updatedAt: string; } interface ManagedMemoryCredentialListResult { connection: ManagedMemoryConnectionInfo; credentials: ManagedMemoryCredentialSummary[]; } interface ManagedMemoryCredentialCreateResult { connection: ManagedMemoryConnectionInfo; credential: ManagedMemoryCredentialSummary; } interface ManagedMemoryAddMessageInput { conversationId: string; userId: string; message: UIMessage; } interface ManagedMemoryAddMessagesInput { conversationId: string; userId: string; messages: UIMessage[]; } interface ManagedMemoryGetMessagesInput { conversationId: string; userId: string; options?: GetMessagesOptions; } interface ManagedMemoryClearMessagesInput { userId: string; conversationId?: string; } interface ManagedMemoryDeleteMessagesInput { conversationId: string; userId: string; messageIds: string[]; } interface ManagedMemoryGetConversationStepsInput { conversationId: string; userId: string; options?: GetConversationStepsOptions; } interface ManagedMemoryStoreVectorInput { id: string; vector: number[]; metadata?: Record; content?: string; } interface ManagedMemoryStoreVectorsBatchInput { items: ManagedMemoryStoreVectorInput[]; } interface ManagedMemorySearchVectorsInput { vector: number[]; limit?: number; threshold?: number; filter?: Record; } interface ManagedMemoryDeleteVectorsInput { ids: string[]; } interface ManagedMemoryUpdateConversationInput { conversationId: string; updates: Partial>; } interface ManagedMemoryWorkingMemoryInput { scope: WorkingMemoryScope; conversationId?: string; userId?: string; } interface ManagedMemorySetWorkingMemoryInput extends ManagedMemoryWorkingMemoryInput { content: string; } interface ManagedMemoryQueryWorkflowRunsInput { workflowId?: string; status?: WorkflowStateEntry["status"]; from?: Date; to?: Date; limit?: number; offset?: number; userId?: string; metadata?: Record; } interface ManagedMemoryWorkflowStateUpdateInput { executionId: string; updates: Partial; } interface ManagedMemoryMessagesClient { add(databaseId: string, input: ManagedMemoryAddMessageInput): Promise; addBatch(databaseId: string, input: ManagedMemoryAddMessagesInput): Promise; list(databaseId: string, input: ManagedMemoryGetMessagesInput): Promise; clear(databaseId: string, input: ManagedMemoryClearMessagesInput): Promise; delete(databaseId: string, input: ManagedMemoryDeleteMessagesInput): Promise; } interface ManagedMemoryConversationsClient { create(databaseId: string, input: CreateConversationInput): Promise; get(databaseId: string, conversationId: string): Promise; query(databaseId: string, options: ConversationQueryOptions): Promise; update(databaseId: string, input: ManagedMemoryUpdateConversationInput): Promise; delete(databaseId: string, conversationId: string): Promise; } interface ManagedMemoryWorkingMemoryClient { get(databaseId: string, input: ManagedMemoryWorkingMemoryInput): Promise; set(databaseId: string, input: ManagedMemorySetWorkingMemoryInput): Promise; delete(databaseId: string, input: ManagedMemoryWorkingMemoryInput): Promise; } interface ManagedMemoryWorkflowStatesClient { get(databaseId: string, executionId: string): Promise; set(databaseId: string, executionId: string, state: WorkflowStateEntry): Promise; update(databaseId: string, input: ManagedMemoryWorkflowStateUpdateInput): Promise; list(databaseId: string, input: ManagedMemoryQueryWorkflowRunsInput): Promise; query(databaseId: string, input: ManagedMemoryQueryWorkflowRunsInput): Promise; listSuspended(databaseId: string, workflowId: string): Promise; } interface ManagedMemoryStepsClient { save(databaseId: string, steps: ConversationStepRecord[]): Promise; list(databaseId: string, input: ManagedMemoryGetConversationStepsInput): Promise; } interface ManagedMemoryVectorsClient { store(databaseId: string, input: ManagedMemoryStoreVectorInput): Promise; storeBatch(databaseId: string, input: ManagedMemoryStoreVectorsBatchInput): Promise; search(databaseId: string, input: ManagedMemorySearchVectorsInput): Promise; get(databaseId: string, vectorId: string): Promise; delete(databaseId: string, vectorId: string): Promise; deleteBatch(databaseId: string, input: ManagedMemoryDeleteVectorsInput): Promise; clear(databaseId: string): Promise; count(databaseId: string): Promise; } interface ManagedMemoryVoltOpsClient { messages: ManagedMemoryMessagesClient; conversations: ManagedMemoryConversationsClient; workingMemory: ManagedMemoryWorkingMemoryClient; workflowStates: ManagedMemoryWorkflowStatesClient; steps: ManagedMemoryStepsClient; vectors: ManagedMemoryVectorsClient; } interface VoltOpsActionsTransport { sendRequest(path: string, init?: RequestInit): Promise; } declare class VoltOpsActionsClient { private readonly transport; readonly airtable: { createRecord: (params: VoltOpsAirtableCreateRecordParams) => Promise; updateRecord: (params: VoltOpsAirtableUpdateRecordParams) => Promise; deleteRecord: (params: VoltOpsAirtableDeleteRecordParams) => Promise; getRecord: (params: VoltOpsAirtableGetRecordParams) => Promise; listRecords: (params: VoltOpsAirtableListRecordsParams) => Promise; }; readonly slack: { postMessage: (params: VoltOpsSlackPostMessageParams) => Promise; deleteMessage: (params: VoltOpsSlackDeleteMessageParams) => Promise; searchMessages: (params: VoltOpsSlackSearchMessagesParams) => Promise; }; readonly discord: { sendMessage: (params: VoltOpsDiscordSendMessageParams) => Promise; sendWebhookMessage: (params: VoltOpsDiscordSendWebhookMessageParams) => Promise; deleteMessage: (params: VoltOpsDiscordChannelMessageParams) => Promise; getMessage: (params: VoltOpsDiscordChannelMessageParams) => Promise; listMessages: (params: VoltOpsDiscordListMessagesParams) => Promise; addReaction: (params: VoltOpsDiscordReactionParams) => Promise; removeReaction: (params: VoltOpsDiscordReactionParams) => Promise; createChannel: (params: VoltOpsDiscordCreateChannelParams) => Promise; updateChannel: (params: VoltOpsDiscordUpdateChannelParams) => Promise; deleteChannel: (params: VoltOpsDiscordDeleteChannelParams) => Promise; getChannel: (params: VoltOpsDiscordGetChannelParams) => Promise; listChannels: (params: VoltOpsDiscordListChannelsParams) => Promise; listMembers: (params: VoltOpsDiscordListMembersParams) => Promise; addMemberRole: (params: VoltOpsDiscordMemberRoleParams) => Promise; removeMemberRole: (params: VoltOpsDiscordMemberRoleParams) => Promise; }; readonly gmail: { sendEmail: (params: VoltOpsGmailSendEmailParams) => Promise; replyToEmail: (params: VoltOpsGmailReplyParams) => Promise; searchEmail: (params: VoltOpsGmailSearchParams) => Promise; getEmail: (params: VoltOpsGmailGetEmailParams) => Promise; getThread: (params: VoltOpsGmailGetThreadParams) => Promise; }; readonly googlecalendar: { createEvent: (params: VoltOpsGoogleCalendarCreateParams) => Promise; updateEvent: (params: VoltOpsGoogleCalendarUpdateParams) => Promise; deleteEvent: (params: VoltOpsGoogleCalendarDeleteParams) => Promise; listEvents: (params: VoltOpsGoogleCalendarListParams) => Promise; getEvent: (params: VoltOpsGoogleCalendarGetParams) => Promise; }; readonly googledrive: { listFiles: (params: VoltOpsGoogleDriveListParams) => Promise; getFileMetadata: (params: VoltOpsGoogleDriveGetFileParams) => Promise; downloadFile: (params: VoltOpsGoogleDriveDownloadParams) => Promise; uploadFile: (params: VoltOpsGoogleDriveUploadParams) => Promise; createFolder: (params: VoltOpsGoogleDriveCreateFolderParams) => Promise; moveFile: (params: VoltOpsGoogleDriveMoveParams) => Promise; copyFile: (params: VoltOpsGoogleDriveCopyParams) => Promise; deleteFile: (params: VoltOpsGoogleDriveDeleteParams) => Promise; shareFilePublic: (params: VoltOpsGoogleDriveShareParams) => Promise; }; readonly postgres: { executeQuery: (params: VoltOpsPostgresExecuteParams) => Promise; }; constructor(transport: VoltOpsActionsTransport, options?: { useProjectEndpoint?: boolean; }); private readonly useProjectEndpoint; private get actionExecutionPath(); private createAirtableRecord; private updateAirtableRecord; private deleteAirtableRecord; private getAirtableRecord; private listAirtableRecords; private executeAirtableAction; private postSlackMessage; private deleteSlackMessage; private searchSlackMessages; private executeSlackAction; private sendGmailEmail; private replyGmailEmail; private searchGmailEmails; private getGmailEmail; private getGmailThread; private createCalendarEvent; private listDriveFiles; private getDriveFileMetadata; private downloadDriveFile; private uploadDriveFile; private createDriveFolder; private moveDriveFile; private copyDriveFile; private deleteDriveFile; private shareDriveFilePublic; private executeGoogleDriveAction; private updateCalendarEvent; private deleteCalendarEvent; private listCalendarEvents; private getCalendarEvent; private executePostgresQuery; private sendDiscordMessage; private sendDiscordWebhookMessage; private deleteDiscordMessage; private getDiscordMessage; private listDiscordMessages; private addDiscordReaction; private removeDiscordReaction; private handleDiscordReaction; private createDiscordChannel; private updateDiscordChannel; private deleteDiscordChannel; private getDiscordChannel; private listDiscordChannels; private listDiscordMembers; private addDiscordMemberRole; private removeDiscordMemberRole; private handleDiscordMemberRole; private executeDiscordAction; private buildDiscordMessageInput; private mergeDiscordConfig; private optionalIdentifier; private ensureArray; private normalizeDiscordChannelType; private ensureAirtableCredential; private ensureSlackCredential; private ensureDiscordCredential; private ensureGmailCredential; private ensureGoogleCalendarCredential; private ensureGoogleDriveCredential; private ensurePostgresCredential; private normalizeCredentialMetadata; private normalizeIdentifier; private ensureRecord; private sanitizeStringArray; private normalizeStringArray; private sanitizeSortArray; private normalizePositiveInteger; private trimString; private normalizeEmailList; private normalizeCalendarDateTime; private normalizeCalendarAttendees; private normalizeGmailBodyType; private normalizeGmailFormat; private normalizeGmailAttachments; private buildGmailSendInput; private executeGmailAction; private postActionExecution; private unwrapActionResponse; private mapActionExecution; private normalizeString; private normalizeRecord; private extractErrorMessage; } /** * VoltOps Client Implementation * * Unified client for both telemetry export and prompt management functionality. * Replaces the old telemetryExporter approach with a comprehensive solution. */ /** * Main VoltOps client class that provides unified access to both * telemetry export and prompt management functionality. */ declare class VoltOpsClient implements VoltOpsClient$1 { readonly options: VoltOpsClientOptions & { baseUrl: string; }; readonly prompts?: VoltOpsPromptManager; readonly managedMemory: ManagedMemoryVoltOpsClient; readonly actions: VoltOpsActionsClient; readonly evals: VoltOpsEvalsApi; readonly observability: VoltOpsObservabilityApi; private readonly logger; private get fetchImpl(); constructor(options: VoltOpsClientOptions); /** * Create a prompt helper for agent instructions */ createPromptHelper(_agentId: string): PromptHelper; /** * Check if observability is enabled and configured * @deprecated Observability is now handled by VoltAgentObservability */ isObservabilityEnabled(): boolean; /** * Check if the client has valid API keys */ hasValidKeys(): boolean; /** * Check if prompt management is enabled and configured */ isPromptManagementEnabled(): boolean; /** * Get the API base URL */ getApiUrl(): string; /** * Get authentication headers for API requests */ getAuthHeaders(): Record; sendRequest(path: string, init?: RequestInit): Promise; createFeedbackToken(input: VoltOpsFeedbackTokenCreateInput): Promise; createFeedback(input: VoltOpsFeedbackCreateInput): Promise; /** * Get prompt manager for direct access */ getPromptManager(): VoltOpsPromptManager | undefined; private createEvalRun; private appendEvalRunResults; private completeEvalRun; private failEvalRun; private createEvalScorer; private listObservabilityTraces; private request; private buildQueryString; private createManagedMemoryClient; listManagedMemoryDatabases(): Promise; listManagedMemoryCredentials(databaseId: string): Promise; createManagedMemoryCredential(databaseId: string, input?: { name?: string; }): Promise; private addManagedMemoryMessage; private addManagedMemoryMessages; private getManagedMemoryMessages; private clearManagedMemoryMessages; private deleteManagedMemoryMessages; private storeManagedMemoryVector; private storeManagedMemoryVectors; private searchManagedMemoryVectors; private getManagedMemoryVector; private deleteManagedMemoryVector; private deleteManagedMemoryVectors; private clearManagedMemoryVectors; private countManagedMemoryVectors; private createManagedMemoryConversation; private getManagedMemoryConversation; private queryManagedMemoryConversations; private updateManagedMemoryConversation; private deleteManagedMemoryConversation; private getManagedMemoryWorkingMemory; private setManagedMemoryWorkingMemory; private deleteManagedMemoryWorkingMemory; private getManagedMemoryWorkflowState; private setManagedMemoryWorkflowState; private updateManagedMemoryWorkflowState; private getManagedMemoryWorkflowStates; private saveManagedMemoryConversationSteps; private getManagedMemoryConversationSteps; /** * Static method to create prompt helper with priority-based fallback * Priority: Local prompts > Agent VoltOpsClient > Global VoltOpsClient > Fallback instructions */ static createPromptHelperWithFallback(agentId: string, agentName: string, fallbackInstructions: string, agentVoltOpsClient?: VoltOpsClient): PromptHelper; /** * Create a prompt helper from available sources without fallback instructions. * Priority: Local prompts > Agent VoltOpsClient > Global VoltOpsClient. */ static createPromptHelperFromSources(agentId: string, agentVoltOpsClient?: VoltOpsClient): PromptHelper | undefined; /** * Cleanup resources when client is no longer needed */ dispose(): Promise; private normalizeRunSummary; private normalizeDate; private normalizeScorerSummary; } /** * Factory function to create VoltOps client */ declare const createVoltOpsClient: (options: VoltOpsClientOptions) => VoltOpsClient; /** * Type guard to check if an error is an AbortError */ declare function isAbortError(error: unknown): error is AbortError; /** * Error thrown when an operation is aborted via AbortController */ declare class AbortError extends Error { name: "AbortError"; /** The reason passed to abort() method */ reason?: unknown; constructor(reason?: string); } type ClientHttpErrorCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451; declare abstract class ClientHTTPError extends Error { name: string; httpStatus: ClientHttpErrorCode; code: string; constructor(name: string, httpStatus: ClientHttpErrorCode, code: string, message: string); } type ToolDeniedErrorCode = "TOOL_ERROR" | "TOOL_FORBIDDEN" | "TOOL_PLAN_REQUIRED" | "TOOL_QUOTA_EXCEEDED"; /** * Error thrown when a tool execution is denied by a controller or policy layer */ declare class ToolDeniedError extends ClientHTTPError { constructor({ toolName, message, code, httpStatus, }: { toolName: string; message: string; code: ToolDeniedErrorCode | string; httpStatus: ClientHttpErrorCode; }); } type VoltAgentErrorOptions = { originalError?: unknown; code?: string; metadata?: Record; stage?: string; toolError?: ToolErrorInfo; }; /** * Type guard to check if an error is a VoltAgentError */ declare function isVoltAgentError(error: unknown): error is VoltAgentError; declare class VoltAgentError extends Error { name: "VoltAgentError"; /** * The original error object thrown by the provider or underlying system (if available). */ originalError?: unknown; /** * Optional error code or identifier from the provider. */ code?: string | number; /** * Additional metadata related to the error (e.g., retry info, request ID). */ metadata?: Record; /** * Information about the step or stage where the error occurred (optional, e.g., 'llm_request', 'tool_execution', 'response_parsing'). */ stage?: string; /** * If the error occurred during tool execution, this field contains the relevant details. Otherwise, it's undefined. */ toolError?: ToolErrorInfo; constructor(message: string, options?: VoltAgentErrorOptions); } type MiddlewareAbortOptions = { retry?: boolean; metadata?: TMetadata; }; /** * Error thrown by middleware abort() calls. */ declare class MiddlewareAbortError extends Error { name: "MiddlewareAbortError"; retry?: boolean; metadata?: TMetadata; middlewareId?: string; constructor(reason: string, options?: MiddlewareAbortOptions, middlewareId?: string); } declare function isMiddlewareAbortError(error: unknown): error is MiddlewareAbortError; type CancellationError = AbortError | ClientHTTPError; type SamplingPolicy = { type: "always"; } | { type: "never"; } | { type: "ratio"; rate: number; }; interface SamplingMetadata { strategy: "always" | "never" | "ratio"; rate?: number; applied?: boolean; } interface ScorerContext, Params extends Record = Record> { payload: Payload; params: Params; } type ScorerResult = { status?: "success"; score?: number | null; metadata?: Record | null; } | { status: "error"; score?: number | null; metadata?: Record | null; error: unknown; } | { status: "skipped"; score?: number | null; metadata?: Record | null; }; interface LocalScorerDefinition, Params extends Record = Record> { id: string; name: string; scorer: (context: ScorerContext) => ScorerResult | Promise; params?: Params | ((payload: Payload) => Params | undefined | Promise); metadata?: Record | null; sampling?: SamplingPolicy; } interface LocalScorerExecutionResult { id: string; name: string; status: "success" | "error" | "skipped"; score: number | null; metadata: Record | null; sampling?: SamplingMetadata; durationMs: number; error?: unknown; } interface ScorerLifecycleScope { run(executor: () => T | Promise): Promise; } interface RunLocalScorersArgs> { payload: Payload; scorers: LocalScorerDefinition[]; defaultSampling?: SamplingPolicy; baseArgs?: Record | ((payload: Payload) => Record | Promise>); onScorerStart?: (info: { definition: LocalScorerDefinition; sampling?: SamplingMetadata; }) => ScorerLifecycleScope | undefined; onScorerComplete?: (info: { definition: LocalScorerDefinition; execution: LocalScorerExecutionResult; context?: ScorerLifecycleScope; }) => void; } interface RunLocalScorersResult { results: LocalScorerExecutionResult[]; summary: { successCount: number; errorCount: number; skippedCount: number; }; } interface NormalizedScorerResult { score?: number | null; metadata?: Record | null; error?: unknown; status?: "success" | "error" | "skipped"; } declare function runLocalScorers>(args: RunLocalScorersArgs): Promise; declare function shouldSample(policy?: SamplingPolicy): boolean; declare function buildSamplingMetadata(policy?: SamplingPolicy): SamplingMetadata | undefined; declare function normalizeScorerResult(result: unknown): NormalizedScorerResult; interface ScorerPipelineContext, Params extends Record> { payload: Payload; params: Params; results: Record; } interface ScorerReasonContext, Params extends Record> extends ScorerPipelineContext { score: number | null; } type PreprocessFunctionStep, Params extends Record> = (context: ScorerPipelineContext) => unknown | Promise; type AnalyzeFunctionStep, Params extends Record> = (context: ScorerPipelineContext) => unknown | Promise; type GenerateScoreResult = number | { score: number; metadata?: Record | null; }; type PreprocessStep, Params extends Record> = PreprocessFunctionStep; type AnalyzeStep, Params extends Record> = AnalyzeFunctionStep; type GenerateScoreStep, Params extends Record> = (context: ScorerPipelineContext) => GenerateScoreResult | Promise; type GenerateReasonResult = string | { reason: string; metadata?: Record | null; }; type GenerateReasonStep, Params extends Record> = (context: ScorerReasonContext) => GenerateReasonResult | Promise; interface CreateScorerOptions = Record, Params extends Record = Record> { id: string; name?: string; metadata?: Record | null; preprocess?: PreprocessStep; analyze?: AnalyzeStep; generateScore?: GenerateScoreStep; generateReason?: GenerateReasonStep; } declare function createScorer = Record, Params extends Record = Record>(options: CreateScorerOptions): LocalScorerDefinition; interface WeightedBlendComponent, Params extends Record> { id: string; weight: number; step?: GenerateScoreStep; } interface WeightedBlendOptions { metadataKey?: string; } declare function weightedBlend, Params extends Record>(components: WeightedBlendComponent[], options?: WeightedBlendOptions): GenerateScoreStep; interface BuilderResultsSnapshot { prepare?: unknown; analyze?: unknown; score?: number | null; reason?: string | null; raw: Record; } interface BuilderContextBase, Params extends Record> { payload: Payload; params: Params; results: BuilderResultsSnapshot; } interface BuilderPrepareContext, Params extends Record> extends BuilderContextBase { kind: "prepare"; } interface BuilderAnalyzeContext, Params extends Record> extends BuilderContextBase { kind: "analyze"; } interface BuilderScoreContext, Params extends Record> extends BuilderContextBase { kind: "score"; } interface BuilderReasonContext, Params extends Record> extends BuilderContextBase { kind: "reason"; score: number | null; } type BuilderPrepareStep, Params extends Record> = (context: BuilderPrepareContext) => unknown | Promise; type BuilderAnalyzeStep, Params extends Record> = (context: BuilderAnalyzeContext) => unknown | Promise; type BuilderScoreStep, Params extends Record> = (context: BuilderScoreContext) => GenerateScoreResult | number | Promise; type BuilderReasonStep, Params extends Record> = (context: BuilderReasonContext) => GenerateReasonResult | string | Promise; type BuildScorerCustomOptions = Record, Params extends Record = Record> = { id: string; label?: string; description?: string; metadata?: Record | null; sampling?: SamplingPolicy; params?: Params | ((payload: Payload) => Params | undefined | Promise); }; type BuildScorerOptions = Record, Params extends Record = Record> = BuildScorerCustomOptions; interface BuildScorerRunArgs, Params extends Record> { payload: Payload; params?: Params; sampling?: SamplingPolicy; } interface BuildScorerRunResult, Params extends Record> { id: string; status: "success" | "error" | "skipped"; score: number | null; reason?: string; metadata: Record | null; durationMs: number; sampling?: ReturnType; rawResult: ScorerResult; payload: Payload; params: Params; steps: BuilderResultsSnapshot; } interface ScorerBuilder, Params extends Record> { prepare(step: BuilderPrepareStep): ScorerBuilder; analyze(step: BuilderAnalyzeStep): ScorerBuilder; score(step: BuilderScoreStep): ScorerBuilder; reason(step: BuilderReasonStep): ScorerBuilder; build(): LocalScorerDefinition; run(args: BuildScorerRunArgs): Promise>; getId(): string; getLabel(): string; getDescription(): string | undefined; } declare function buildScorer = Record, Params extends Record = Record>(options: BuildScorerOptions): ScorerBuilder; /** * Unified Observability Types for VoltAgent * * These types are used consistently across: * - WebSocket transmission * - Local storage persistence * - Remote export * - UI components * * This ensures type safety and eliminates unnecessary conversions. */ /** * Observability configuration */ interface ObservabilityConfig { serviceName?: string; serviceVersion?: string; instrumentationScopeName?: string; storage?: ObservabilityStorageAdapter; logger?: Logger; resourceAttributes?: Record; spanFilters?: SpanFilterConfig; /** * Controls whether flushOnFinish() runs automatically. * - "auto": flush only in serverless (default) * - "always": always flush * - "never": never flush */ flushOnFinishStrategy?: "auto" | "always" | "never"; voltOpsSync?: { sampling?: ObservabilitySamplingConfig; maxQueueSize?: number; maxExportBatchSize?: number; scheduledDelayMillis?: number; exportTimeoutMillis?: number; }; serverlessRemote?: ServerlessRemoteExportConfig; spanProcessors?: SpanProcessor[]; logProcessors?: LogRecordProcessor[]; } interface ObservabilitySamplingConfig { strategy?: "always" | "never" | "ratio" | "parent"; ratio?: number; } interface ServerlessRemoteEndpointConfig { url: string; headers?: Record; method?: string; } interface ServerlessRemoteExportConfig { traces?: ServerlessRemoteEndpointConfig; logs?: ServerlessRemoteEndpointConfig; sampling?: ObservabilitySamplingConfig; maxQueueSize?: number; maxExportBatchSize?: number; scheduledDelayMillis?: number; exportTimeoutMillis?: number; } /** * Span filter configuration */ interface SpanFilterConfig { enabled?: boolean; /** * Restrict span processing to spans originating from these tracer * instrumentation scope names. Defaults to the internal VoltAgent tracer * when omitted. */ instrumentationScopeNames?: string[]; /** * Restrict span processing to the provided `service.name` values. If empty * or undefined, this constraint is ignored. */ serviceNames?: string[]; } /** * Unified span format for all observability features * Serializable and compatible with OpenTelemetry concepts */ interface ObservabilitySpan { traceId: string; spanId: string; parentSpanId?: string; name: string; kind: SpanKind; startTime: string; endTime?: string; duration?: number; attributes: SpanAttributes; status: SpanStatus; events: SpanEvent[]; links?: SpanLink[]; resource?: Record; instrumentationScope?: { name: string; version?: string; }; } /** * Span kinds following OpenTelemetry specification */ declare enum SpanKind { INTERNAL = 0, SERVER = 1, CLIENT = 2, PRODUCER = 3, CONSUMER = 4 } /** * Span status codes */ declare enum SpanStatusCode { UNSET = 0, OK = 1, ERROR = 2 } /** * Span status */ interface SpanStatus { code: SpanStatusCode; message?: string; } /** * Span attributes with VoltAgent-specific fields */ interface SpanAttributes { "entity.id"?: string; "entity.type"?: "agent" | "workflow"; "entity.name"?: string; "operation.type"?: "generateText" | "streamText" | "tool-execution" | "workflow-execution"; "workflow.execution.id"?: string; "workflow.step.index"?: number; "workflow.step.type"?: string; "workflow.step.name"?: string; "workflow.replayed"?: boolean; "workflow.replay.source_trace_id"?: string; "workflow.replay.source_span_id"?: string; "workflow.replay.source_execution_id"?: string; "workflow.replay.source_step_id"?: string; "tool.name"?: string; "workspace.id"?: string; "workspace.name"?: string; "workspace.scope"?: "agent" | "conversation"; "workspace.operation"?: string; "workspace.fs.path"?: string; "workspace.fs.pattern"?: string; "workspace.fs.bytes"?: number; "workspace.fs.offset"?: number; "workspace.fs.limit"?: number; "workspace.fs.occurrences"?: number; "workspace.search.query"?: string; "workspace.search.mode"?: string; "workspace.search.top_k"?: number; "workspace.search.results"?: number; "workspace.sandbox.command"?: string; "workspace.sandbox.args"?: string[] | string; "workspace.sandbox.cwd"?: string; "workspace.sandbox.timeout_ms"?: number; "workspace.sandbox.exit_code"?: number; "workspace.skills.name"?: string; "workspace.skills.source"?: string; "user.id"?: string; "conversation.id"?: string; "model.name"?: string; "usage.prompt_tokens"?: number; "usage.completion_tokens"?: number; "usage.total_tokens"?: number; input?: any; output?: any; [key: string]: any; } /** * Span event */ interface SpanEvent { name: string; timestamp: string; attributes?: Record; } /** * Span link for trace correlation */ interface SpanLink { traceId: string; spanId: string; attributes?: Record; } /** * WebSocket event wrapper for observability */ interface ObservabilityWebSocketEvent { type: "span:start" | "span:end" | "span:error"; span: ObservabilitySpan; timestamp: string; } /** * Unified log record format for observability */ interface ObservabilityLogRecord { timestamp: string; traceId?: string; spanId?: string; traceFlags?: number; severityNumber?: number; severityText?: string; body: any; attributes?: Record; resource?: Record; instrumentationScope?: { name: string; version?: string; }; } /** * Storage adapter interface - uses ObservabilitySpan and ObservabilityLogRecord directly */ interface ObservabilityStorageAdapter { addSpan(span: ObservabilitySpan): Promise; updateSpan(spanId: string, updates: Partial): Promise; getSpan(spanId: string): Promise; getTrace(traceId: string): Promise; listTraces(limit?: number, offset?: number, filter?: { entityId?: string; entityType?: "agent" | "workflow"; }): Promise; saveLogRecord(logRecord: any): Promise; getLogsByTraceId(traceId: string): Promise; getLogsBySpanId(spanId: string): Promise; queryLogs(filter: LogFilter): Promise; deleteOldSpans(beforeTimestamp: number): Promise; deleteOldLogs(beforeTimestamp: number): Promise; clear(): Promise; getInfo?(): { adapter: string; displayName?: string; persistent?: boolean; description?: string; }; } /** * Log filter for querying */ interface LogFilter { traceId?: string; spanId?: string; severityNumber?: number; severityText?: string; instrumentationScope?: string; startTimeMin?: number; startTimeMax?: number; limit?: number; bodyContains?: string; attributeKey?: string; attributeValue?: any; } /** * Convert OpenTelemetry ReadableSpan to ObservabilitySpan * This is the ONLY conversion needed in the entire system */ declare function readableSpanToObservabilitySpan(readableSpan: any): ObservabilitySpan; /** * Build a tree structure from flat span list */ interface SpanTreeNode extends ObservabilitySpan { children: SpanTreeNode[]; depth: number; } declare function buildSpanTree(spans: ObservabilitySpan[]): SpanTreeNode[]; /** * Convert OpenTelemetry ReadableLogRecord to ObservabilityLogRecord */ declare function readableLogRecordToObservabilityLog(readableLog: any): ObservabilityLogRecord; /** * VoltAgentObservability (Node runtime) * * Wraps OpenTelemetry's NodeTracerProvider and configures VoltAgent-specific * processors/exporters. This retains the existing Node behavior. */ /** * VoltAgent Observability wrapper around OpenTelemetry for Node */ declare class VoltAgentObservability$1 { private provider; private loggerProvider; private tracer; private storage; private websocketProcessor?; private localStorageProcessor?; private config; private logger; private spanFilterOptions?; private instrumentationScopeName; private flushLock; constructor(config?: ObservabilityConfig); /** * Set up span processors */ private setupProcessors; private applySpanFilter; private resolveSpanFilterOptions; private tryInitializePinoBridge; private setupLogProcessors; getTracer(): Tracer; getLoggerProvider(): LoggerProvider; getStorage(): ObservabilityStorageAdapter; startSpan(name: string, options?: SpanOptions & { type?: string; attributes?: Record; }): Span; startActiveSpan(name: string, options: SpanOptions & { type?: string; attributes?: Record; }, fn: (span: Span) => T): T; getActiveSpan(): Span | undefined; setSpanAttributes(attributes: Record): void; addSpanEvent(name: string, attributes?: Record): void; setSpanStatus(code: SpanStatusCode$1, message?: string): void; recordException(error: Error): void; subscribeToWebSocketEvents(callback: (event: any) => void): (() => void) | undefined; getTraceFromStorage(traceId: string): Promise; getSpan(spanId: string): Promise; cleanupOldSpans(beforeTimestamp: number): Promise; getLogsByTraceId(traceId: string): Promise; getLogsBySpanId(spanId: string): Promise; shutdown(): Promise; forceFlush(): Promise; /** * Flushes spans on finish. * We force flush here to ensure spans are exported even if the runtime * is incorrectly detected or if we are in a short-lived process. */ flushOnFinish(): Promise; private shouldFlushOnFinish; private withFlushLock; getProvider(): NodeTracerProvider; getContext(): typeof context; getTraceAPI(): typeof trace; getSpanKind(): typeof SpanKind$1; getSpanStatusCode(): typeof SpanStatusCode$1; } /** * VoltAgentObservability (serverless runtime) * * Simplified observability pipeline for Workers/serverless runtimes. Uses * BasicTracerProvider and fetch-friendly processors only. */ declare class ServerlessVoltAgentObservability { private provider; private loggerProvider; private tracer; private storage; private websocketProcessor?; private localStorageProcessor?; private config; private resource; private spanFilterOptions?; private instrumentationScopeName; private spanStack; private flushLock; constructor(config?: ObservabilityConfig); private setupProcessors; private applySpanFilter; private resolveSpanFilterOptions; private setupLogProcessors; private initializeTelemetryPipeline; getTracer(): Tracer; getLoggerProvider(): LoggerProvider; getStorage(): ObservabilityStorageAdapter; startSpan(name: string, options?: SpanOptions & { type?: string; attributes?: Record; }): Span; startActiveSpan(name: string, options: SpanOptions & { type?: string; attributes?: Record; }, fn: (span: Span) => T): T; getActiveSpan(): Span | undefined; setSpanAttributes(attributes: Record): void; addSpanEvent(name: string, attributes?: Record): void; setSpanStatus(code: SpanStatusCode$1, message?: string): void; recordException(error: Error): void; subscribeToWebSocketEvents(callback: (event: any) => void): (() => void) | undefined; getTraceFromStorage(traceId: string): Promise; getSpan(spanId: string): Promise; cleanupOldSpans(beforeTimestamp: number): Promise; getLogsByTraceId(traceId: string): Promise; getLogsBySpanId(spanId: string): Promise; shutdown(): Promise; forceFlush(): Promise; /** * Flushes spans without blocking the response if waitUntil is available. * This is the preferred method to call at the end of a request. */ flushOnFinish(): Promise; private withFlushLock; getProvider(): BasicTracerProvider; getContext(): typeof context; getTraceAPI(): typeof trace; getSpanKind(): typeof SpanKind$1; getSpanStatusCode(): typeof SpanStatusCode$1; updateServerlessRemote(config: ServerlessRemoteExportConfig): void; private pushSpan; private popSpan; } /** * Minimal event emitter that works in both Node and edge runtimes. */ declare class SimpleEventEmitter { private listeners; on(event: string, listener: (...args: any[]) => void): this; off(event: string, listener: (...args: any[]) => void): this; once(event: string, listener: (...args: any[]) => void): this; emit(event: string, ...args: any[]): boolean; listenerCount(event: string): number; removeAllListeners(event?: string): void; } /** * WebSocketSpanProcessor * * OpenTelemetry SpanProcessor that broadcasts span events via WebSocket * for real-time observability in the Console UI. */ /** * Singleton EventEmitter for WebSocket broadcasting */ declare class WebSocketEventEmitter extends SimpleEventEmitter { private static instance; private constructor(); static getInstance(): WebSocketEventEmitter; emitWebSocketEvent(event: ObservabilityWebSocketEvent): void; onWebSocketEvent(callback: (event: ObservabilityWebSocketEvent) => void): () => void; } /** * WebSocket SpanProcessor for real-time event broadcasting */ declare class WebSocketSpanProcessor implements SpanProcessor { private emitter; private enabled; constructor(enabled?: boolean); /** * Called when a span is started */ onStart(span: Span, parentContext: Context): void; /** * Called when a span is ended */ onEnd(span: ReadableSpan): void; /** * Shutdown the processor */ shutdown(): Promise; /** * Force flush (no-op for WebSocket) */ forceFlush(): Promise; /** * Get the event emitter for subscribing to events */ static getEventEmitter(): WebSocketEventEmitter; /** * Subscribe to WebSocket events */ static subscribe(callback: (event: ObservabilityWebSocketEvent) => void): () => void; } /** * LocalStorageSpanProcessor * * OpenTelemetry SpanProcessor that persists spans to local storage * for crash resilience and historical analysis. */ /** * Local Storage SpanProcessor for span persistence */ declare class LocalStorageSpanProcessor implements SpanProcessor { private storage; private activeSpans; constructor(storage: ObservabilityStorageAdapter); /** * Called when a span is started */ onStart(span: Span, parentContext: Context): void; /** * Called when a span is ended */ onEnd(span: ReadableSpan): void; /** * Shutdown the processor */ shutdown(): Promise; /** * Force flush - ensure all spans are persisted */ forceFlush(): Promise; /** * Get storage adapter */ getStorage(): ObservabilityStorageAdapter; } /** * Lazy Remote Export Processor for OpenTelemetry * * This processor delays the initialization of remote export until * the VoltOpsClient is available in the global registry, solving * the race condition between Agent and VoltAgent initialization. */ interface LazyRemoteExportConfig { maxQueueSize?: number; maxExportBatchSize?: number; scheduledDelayMillis?: number; exportTimeoutMillis?: number; logger?: Logger; } declare class LazyRemoteExportProcessor implements SpanProcessor { private config; private actualProcessor?; private pendingSpans; private initialized; private initCheckInterval?; private logger?; constructor(config?: LazyRemoteExportConfig); /** * Called when a span is started */ onStart(_span: Span, _parentContext: Context): void; /** * Called when a span ends */ onEnd(span: ReadableSpan): void; /** * Force flush all pending spans */ forceFlush(): Promise; /** * Shutdown the processor */ shutdown(): Promise; /** * Start periodic check for VoltOpsClient availability */ private startInitializationCheck; /** * Try to initialize the actual processor */ private tryInitialize; } /** * SpanFilterProcessor * * Wraps another SpanProcessor and ensures only spans that match the * configured filter are forwarded. This prevents VoltAgent's * observability pipeline from processing spans that originate from * unrelated OpenTelemetry instrumentation. */ /** * Configuration for SpanFilterProcessor */ interface SpanFilterOptions { allowedServiceNames?: string[]; allowedInstrumentationScopes?: string[]; predicate?: (span: Span$1 | ReadableSpan) => boolean; } /** * SpanProcessor wrapper that filters spans before delegating */ declare class SpanFilterProcessor implements SpanProcessor { private readonly delegate; private readonly options; private readonly allowedServiceNames?; private readonly allowedInstrumentationScopes?; constructor(delegate: SpanProcessor, options?: SpanFilterOptions); onStart(span: Span$1, parentContext: Context): void; onEnd(span: ReadableSpan): void; shutdown(): Promise; forceFlush(): Promise; private shouldProcess; private extractInstrumentationScopeName; private extractServiceName; } /** * InMemoryStorageAdapter * * In-memory storage implementation for development and testing. * Provides fast access with automatic cleanup of old spans. */ /** * In-memory storage adapter for spans */ declare class InMemoryStorageAdapter$1 implements ObservabilityStorageAdapter { private spans; private traceIndex; private entityTraceIndex; private logs; private logTraceIndex; private logSpanIndex; private maxSpans; private maxLogs; private cleanupInterval; constructor(options?: { maxSpans?: number; maxLogs?: number; cleanupIntervalMs?: number; }); /** * Add a span */ addSpan(span: ObservabilitySpan): Promise; /** * Update a span */ updateSpan(spanId: string, updates: ObservabilitySpan | Partial): Promise; /** * Get a span by ID */ getSpan(spanId: string): Promise; /** * Get all spans in a trace */ getTrace(traceId: string): Promise; /** * Delete old spans (cleanup) */ deleteOldSpans(beforeTimestamp: number): Promise; /** * Internal cleanup method */ private cleanup; /** * Clear all spans and logs */ clear(): Promise; /** * Destroy the adapter */ destroy(): void; /** * List all traces with optional entity filter */ listTraces(limit?: number, offset?: number, filter?: { entityId?: string; entityType?: "agent" | "workflow"; }): Promise; /** * Save a log record */ saveLogRecord(logRecord: any): Promise; /** * Get logs by trace ID */ getLogsByTraceId(traceId: string): Promise; /** * Get logs by span ID */ getLogsBySpanId(spanId: string): Promise; /** * Query logs with filters */ queryLogs(filter: LogFilter): Promise; /** * Delete old logs */ deleteOldLogs(beforeTimestamp: number): Promise; /** * Internal cleanup for logs */ private cleanupLogs; /** * Rebuild log indexes after cleanup */ private rebuildLogIndexes; /** * Get statistics */ getStats(): { spanCount: number; traceCount: number; logCount: number; oldestSpan?: Date; newestSpan?: Date; oldestLog?: Date; newestLog?: Date; }; getInfo(): { adapter: string; displayName: string; persistent: boolean; description: string; }; } /** * Storage Log Processor * * Stores OpenTelemetry log records in the configured storage adapter */ declare class StorageLogProcessor implements LogRecordProcessor { private storage; constructor(storage: ObservabilityStorageAdapter); /** * Called when a log record is emitted */ onEmit(logRecord: ReadableLogRecord, _context?: Context): void; /** * Force flush any pending logs */ forceFlush(): Promise; /** * Shutdown the processor */ shutdown(): Promise; } /** * WebSocket Log Processor * * Streams OpenTelemetry log records via WebSocket for real-time monitoring */ declare class WebSocketLogProcessor implements LogRecordProcessor { private static emitter; /** * Called when a log record is emitted */ onEmit(logRecord: ReadableLogRecord, context?: Context): void; /** * Subscribe to log events */ static subscribe(callback: (log: ObservabilityLogRecord) => void): () => void; /** * Get subscriber count */ static getSubscriberCount(): number; /** * Serialize log record for transmission */ private serializeLogRecord; /** * Force flush any pending logs */ forceFlush(): Promise; /** * Shutdown the processor */ shutdown(): Promise; } /** * Remote Log Processor * * Exports OpenTelemetry log records to remote VoltOps API using OTLP protocol * Similar to LazyRemoteExportProcessor for spans, but for logs */ interface RemoteLogExportConfig { maxQueueSize?: number; maxExportBatchSize?: number; scheduledDelayMillis?: number; exportTimeoutMillis?: number; samplingConfig?: { strategy?: "always" | "never" | "ratio" | "parent"; ratio?: number; }; } /** * Lazy Remote Log Processor * * Delays initialization until VoltOpsClient is available, * then exports logs to VoltOps API using OTLP protocol */ declare class RemoteLogProcessor implements LogRecordProcessor { private config; private actualProcessor?; private pendingLogs; private initialized; private initCheckInterval?; constructor(config?: RemoteLogExportConfig); /** * Called to emit a log record */ onEmit(logRecord: SdkLogRecord): void; /** * Force flush all pending logs */ forceFlush(): Promise; /** * Shutdown the processor */ shutdown(): Promise; /** * Start periodic check for VoltOpsClient availability */ private startInitializationCheck; /** * Try to initialize the actual processor */ private tryInitialize; } /** * Sets the waitUntil function for the current execution context. * This is used by the observability pipeline to flush spans without blocking the response * in serverless environments (e.g., Cloudflare Workers, Vercel). * * @param waitUntil - The platform-specific waitUntil function * * @example * // In Next.js App Router * import { setWaitUntil } from '@voltagent/core'; * import { after } from 'next/server'; // or from context * * export async function POST(req: Request) { * // If using Vercel's waitUntil from context or similar * // setWaitUntil(ctx.waitUntil); * * // Or if using Next.js 15+ after() * // setWaitUntil(after); * * // ... agent code ... * } */ declare function setWaitUntil(waitUntil: (promise: Promise) => void): void; /** * VoltAgent Observability - Built on OpenTelemetry * * This module provides OpenTelemetry-based observability with: * - WebSocket real-time events via custom SpanProcessor * - Local storage via custom SpanProcessor * - OTLP export support * - Zero-configuration defaults */ declare const VoltAgentObservability: typeof VoltAgentObservability$1; type VoltAgentObservability = VoltAgentObservability$1 | ServerlessVoltAgentObservability; declare const createVoltAgentObservability: (config?: ObservabilityConfig) => VoltAgentObservability$1 | ServerlessVoltAgentObservability; /** * THIS FILE IS AUTO-GENERATED - DO NOT EDIT * Generated from https://models.dev/api.json */ type ProviderModelsMap = { readonly abacus: readonly [ "Qwen/QwQ-32B", "Qwen/Qwen2.5-72B-Instruct", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-32B", "Qwen/qwen3-coder-480b-a35b-instruct", "claude-3-7-sonnet-20250219", "claude-haiku-4-5-20251001", "claude-opus-4-1-20250805", "claude-opus-4-20250514", "claude-opus-4-5-20251101", "claude-sonnet-4-20250514", "claude-sonnet-4-5-20250929", "deepseek-ai/DeepSeek-R1", "deepseek-ai/DeepSeek-V3.1-Terminus", "deepseek-ai/DeepSeek-V3.2", "deepseek/deepseek-v3.1", "gemini-2.0-flash-001", "gemini-2.0-pro-exp-02-05", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o-2024-11-20", "gpt-4o-mini", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1", "gpt-5.1-chat-latest", "gpt-5.2", "gpt-5.2-chat-latest", "grok-4-0709", "grok-4-1-fast-non-reasoning", "grok-4-fast-non-reasoning", "grok-code-fast-1", "kimi-k2-turbo-preview", "llama-3.3-70b-versatile", "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8", "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo", "meta-llama/Meta-Llama-3.1-70B-Instruct", "meta-llama/Meta-Llama-3.1-8B-Instruct", "o3", "o3-mini", "o3-pro", "o4-mini", "openai/gpt-oss-120b", "qwen-2.5-coder-32b", "qwen3-max", "route-llm", "zai-org/glm-4.5", "zai-org/glm-4.6", "zai-org/glm-4.7" ]; readonly aihubmix: readonly [ "Kimi-K2-0905", "claude-haiku-4-5", "claude-opus-4-1", "claude-opus-4-5", "claude-sonnet-4-5", "coding-glm-4.7-free", "coding-minimax-m2.1-free", "deepseek-v3.2", "deepseek-v3.2-fast", "deepseek-v3.2-speciale", "deepseek-v3.2-think", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-pro-preview", "glm-4.7", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-5", "gpt-5-codex", "gpt-5-mini", "gpt-5-nano", "gpt-5-pro", "gpt-5.1", "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini", "gpt-5.2", "minimax-m2.1", "o4-mini", "qwen3-235b-a22b-instruct-2507", "qwen3-235b-a22b-thinking-2507", "qwen3-coder-480b-a35b-instruct" ]; readonly alibaba: readonly [ "qvq-max", "qwen-flash", "qwen-max", "qwen-mt-plus", "qwen-mt-turbo", "qwen-omni-turbo", "qwen-omni-turbo-realtime", "qwen-plus", "qwen-plus-character-ja", "qwen-turbo", "qwen-vl-max", "qwen-vl-ocr", "qwen-vl-plus", "qwen2-5-14b-instruct", "qwen2-5-32b-instruct", "qwen2-5-72b-instruct", "qwen2-5-7b-instruct", "qwen2-5-omni-7b", "qwen2-5-vl-72b-instruct", "qwen2-5-vl-7b-instruct", "qwen3-14b", "qwen3-235b-a22b", "qwen3-32b", "qwen3-8b", "qwen3-asr-flash", "qwen3-coder-30b-a3b-instruct", "qwen3-coder-480b-a35b-instruct", "qwen3-coder-flash", "qwen3-coder-plus", "qwen3-livetranslate-flash-realtime", "qwen3-max", "qwen3-next-80b-a3b-instruct", "qwen3-next-80b-a3b-thinking", "qwen3-omni-flash", "qwen3-omni-flash-realtime", "qwen3-vl-235b-a22b", "qwen3-vl-30b-a3b", "qwen3-vl-plus", "qwq-plus" ]; readonly "alibaba-cn": readonly [ "deepseek-r1", "deepseek-r1-0528", "deepseek-r1-distill-llama-70b", "deepseek-r1-distill-llama-8b", "deepseek-r1-distill-qwen-1-5b", "deepseek-r1-distill-qwen-14b", "deepseek-r1-distill-qwen-32b", "deepseek-r1-distill-qwen-7b", "deepseek-v3", "deepseek-v3-1", "deepseek-v3-2-exp", "moonshot-kimi-k2-instruct", "qvq-max", "qwen-deep-research", "qwen-doc-turbo", "qwen-flash", "qwen-long", "qwen-math-plus", "qwen-math-turbo", "qwen-max", "qwen-mt-plus", "qwen-mt-turbo", "qwen-omni-turbo", "qwen-omni-turbo-realtime", "qwen-plus", "qwen-plus-character", "qwen-turbo", "qwen-vl-max", "qwen-vl-ocr", "qwen-vl-plus", "qwen2-5-14b-instruct", "qwen2-5-32b-instruct", "qwen2-5-72b-instruct", "qwen2-5-7b-instruct", "qwen2-5-coder-32b-instruct", "qwen2-5-coder-7b-instruct", "qwen2-5-math-72b-instruct", "qwen2-5-math-7b-instruct", "qwen2-5-omni-7b", "qwen2-5-vl-72b-instruct", "qwen2-5-vl-7b-instruct", "qwen3-14b", "qwen3-235b-a22b", "qwen3-32b", "qwen3-8b", "qwen3-asr-flash", "qwen3-coder-30b-a3b-instruct", "qwen3-coder-480b-a35b-instruct", "qwen3-coder-flash", "qwen3-coder-plus", "qwen3-max", "qwen3-next-80b-a3b-instruct", "qwen3-next-80b-a3b-thinking", "qwen3-omni-flash", "qwen3-omni-flash-realtime", "qwen3-vl-235b-a22b", "qwen3-vl-30b-a3b", "qwen3-vl-plus", "qwq-32b", "qwq-plus", "tongyi-intent-detect-v3" ]; readonly "amazon-bedrock": readonly [ "ai21.jamba-1-5-large-v1:0", "ai21.jamba-1-5-mini-v1:0", "amazon.nova-2-lite-v1:0", "amazon.nova-lite-v1:0", "amazon.nova-micro-v1:0", "amazon.nova-premier-v1:0", "amazon.nova-pro-v1:0", "amazon.titan-text-express-v1", "amazon.titan-text-express-v1:0:8k", "anthropic.claude-3-5-haiku-20241022-v1:0", "anthropic.claude-3-5-sonnet-20240620-v1:0", "anthropic.claude-3-5-sonnet-20241022-v2:0", "anthropic.claude-3-7-sonnet-20250219-v1:0", "anthropic.claude-3-haiku-20240307-v1:0", "anthropic.claude-3-opus-20240229-v1:0", "anthropic.claude-3-sonnet-20240229-v1:0", "anthropic.claude-haiku-4-5-20251001-v1:0", "anthropic.claude-instant-v1", "anthropic.claude-opus-4-1-20250805-v1:0", "anthropic.claude-opus-4-20250514-v1:0", "anthropic.claude-opus-4-5-20251101-v1:0", "anthropic.claude-sonnet-4-20250514-v1:0", "anthropic.claude-sonnet-4-5-20250929-v1:0", "anthropic.claude-v2", "anthropic.claude-v2:1", "cohere.command-light-text-v14", "cohere.command-r-plus-v1:0", "cohere.command-r-v1:0", "cohere.command-text-v14", "deepseek.r1-v1:0", "deepseek.v3-v1:0", "global.anthropic.claude-opus-4-5-20251101-v1:0", "google.gemma-3-12b-it", "google.gemma-3-27b-it", "google.gemma-3-4b-it", "meta.llama3-1-70b-instruct-v1:0", "meta.llama3-1-8b-instruct-v1:0", "meta.llama3-2-11b-instruct-v1:0", "meta.llama3-2-1b-instruct-v1:0", "meta.llama3-2-3b-instruct-v1:0", "meta.llama3-2-90b-instruct-v1:0", "meta.llama3-3-70b-instruct-v1:0", "meta.llama3-70b-instruct-v1:0", "meta.llama3-8b-instruct-v1:0", "meta.llama4-maverick-17b-instruct-v1:0", "meta.llama4-scout-17b-instruct-v1:0", "minimax.minimax-m2", "mistral.ministral-3-14b-instruct", "mistral.ministral-3-8b-instruct", "mistral.mistral-7b-instruct-v0:2", "mistral.mistral-large-2402-v1:0", "mistral.mixtral-8x7b-instruct-v0:1", "mistral.voxtral-mini-3b-2507", "mistral.voxtral-small-24b-2507", "moonshot.kimi-k2-thinking", "nvidia.nemotron-nano-12b-v2", "nvidia.nemotron-nano-9b-v2", "openai.gpt-oss-120b-1:0", "openai.gpt-oss-20b-1:0", "openai.gpt-oss-safeguard-120b", "openai.gpt-oss-safeguard-20b", "qwen.qwen3-235b-a22b-2507-v1:0", "qwen.qwen3-32b-v1:0", "qwen.qwen3-coder-30b-a3b-v1:0", "qwen.qwen3-coder-480b-a35b-v1:0", "qwen.qwen3-next-80b-a3b", "qwen.qwen3-vl-235b-a22b" ]; readonly anthropic: readonly [ "claude-3-5-haiku-20241022", "claude-3-5-haiku-latest", "claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20241022", "claude-3-7-sonnet-20250219", "claude-3-7-sonnet-latest", "claude-3-haiku-20240307", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-haiku-4-5", "claude-haiku-4-5-20251001", "claude-opus-4-0", "claude-opus-4-1", "claude-opus-4-1-20250805", "claude-opus-4-20250514", "claude-opus-4-5", "claude-opus-4-5-20251101", "claude-sonnet-4-0", "claude-sonnet-4-20250514", "claude-sonnet-4-5", "claude-sonnet-4-5-20250929" ]; readonly azure: readonly [ "claude-haiku-4-5", "claude-opus-4-1", "claude-opus-4-5", "claude-sonnet-4-5", "codestral-2501", "codex-mini", "cohere-command-a", "cohere-command-r-08-2024", "cohere-command-r-plus-08-2024", "cohere-embed-v-4-0", "cohere-embed-v3-english", "cohere-embed-v3-multilingual", "deepseek-r1", "deepseek-r1-0528", "deepseek-v3-0324", "deepseek-v3.1", "deepseek-v3.2", "deepseek-v3.2-speciale", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-instruct", "gpt-4", "gpt-4-32k", "gpt-4-turbo", "gpt-4-turbo-vision", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-4o-mini", "gpt-5", "gpt-5-chat", "gpt-5-codex", "gpt-5-mini", "gpt-5-nano", "gpt-5-pro", "gpt-5.1", "gpt-5.1-chat", "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini", "gpt-5.2", "gpt-5.2-chat", "grok-3", "grok-3-mini", "grok-4", "grok-4-fast-non-reasoning", "grok-4-fast-reasoning", "grok-code-fast-1", "kimi-k2-thinking", "llama-3.2-11b-vision-instruct", "llama-3.2-90b-vision-instruct", "llama-3.3-70b-instruct", "llama-4-maverick-17b-128e-instruct-fp8", "llama-4-scout-17b-16e-instruct", "mai-ds-r1", "meta-llama-3-70b-instruct", "meta-llama-3-8b-instruct", "meta-llama-3.1-405b-instruct", "meta-llama-3.1-70b-instruct", "meta-llama-3.1-8b-instruct", "ministral-3b", "mistral-large-2411", "mistral-medium-2505", "mistral-nemo", "mistral-small-2503", "model-router", "o1", "o1-mini", "o1-preview", "o3", "o3-mini", "o4-mini", "phi-3-medium-128k-instruct", "phi-3-medium-4k-instruct", "phi-3-mini-128k-instruct", "phi-3-mini-4k-instruct", "phi-3-small-128k-instruct", "phi-3-small-8k-instruct", "phi-3.5-mini-instruct", "phi-3.5-moe-instruct", "phi-4", "phi-4-mini", "phi-4-mini-reasoning", "phi-4-multimodal", "phi-4-reasoning", "phi-4-reasoning-plus", "text-embedding-3-large", "text-embedding-3-small", "text-embedding-ada-002" ]; readonly "azure-cognitive-services": readonly [ "claude-haiku-4-5", "claude-opus-4-1", "claude-opus-4-5", "claude-sonnet-4-5", "codestral-2501", "codex-mini", "cohere-command-a", "cohere-command-r-08-2024", "cohere-command-r-plus-08-2024", "cohere-embed-v-4-0", "cohere-embed-v3-english", "cohere-embed-v3-multilingual", "deepseek-r1", "deepseek-r1-0528", "deepseek-v3-0324", "deepseek-v3.1", "deepseek-v3.2", "deepseek-v3.2-speciale", "gpt-3.5-turbo-0125", "gpt-3.5-turbo-0301", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-1106", "gpt-3.5-turbo-instruct", "gpt-4", "gpt-4-32k", "gpt-4-turbo", "gpt-4-turbo-vision", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-4o-mini", "gpt-5", "gpt-5-chat", "gpt-5-codex", "gpt-5-mini", "gpt-5-nano", "gpt-5-pro", "gpt-5.1", "gpt-5.1-chat", "gpt-5.1-codex", "gpt-5.1-codex-mini", "gpt-5.2-chat", "grok-3", "grok-3-mini", "grok-4", "grok-4-fast-non-reasoning", "grok-4-fast-reasoning", "grok-code-fast-1", "kimi-k2-thinking", "llama-3.2-11b-vision-instruct", "llama-3.2-90b-vision-instruct", "llama-3.3-70b-instruct", "llama-4-maverick-17b-128e-instruct-fp8", "llama-4-scout-17b-16e-instruct", "mai-ds-r1", "meta-llama-3-70b-instruct", "meta-llama-3-8b-instruct", "meta-llama-3.1-405b-instruct", "meta-llama-3.1-70b-instruct", "meta-llama-3.1-8b-instruct", "ministral-3b", "mistral-large-2411", "mistral-medium-2505", "mistral-nemo", "mistral-small-2503", "model-router", "o1", "o1-mini", "o1-preview", "o3", "o3-mini", "o4-mini", "phi-3-medium-128k-instruct", "phi-3-medium-4k-instruct", "phi-3-mini-128k-instruct", "phi-3-mini-4k-instruct", "phi-3-small-128k-instruct", "phi-3-small-8k-instruct", "phi-3.5-mini-instruct", "phi-3.5-moe-instruct", "phi-4", "phi-4-mini", "phi-4-mini-reasoning", "phi-4-multimodal", "phi-4-reasoning", "phi-4-reasoning-plus", "text-embedding-3-large", "text-embedding-3-small", "text-embedding-ada-002" ]; readonly bailing: readonly ["Ling-1T", "Ring-1T"]; readonly baseten: readonly [ "Qwen/Qwen3-Coder-480B-A35B-Instruct", "deepseek-ai/DeepSeek-V3.2", "moonshotai/Kimi-K2-Instruct-0905", "moonshotai/Kimi-K2-Thinking", "zai-org/GLM-4.6", "zai-org/GLM-4.7" ]; readonly cerebras: readonly [ "gpt-oss-120b", "qwen-3-235b-a22b-instruct-2507", "zai-glm-4.6", "zai-glm-4.7" ]; readonly chutes: readonly [ "MiniMaxAI/MiniMax-M2.1-TEE", "NousResearch/DeepHermes-3-Mistral-24B-Preview", "NousResearch/Hermes-4-14B", "NousResearch/Hermes-4-405B-FP8-TEE", "NousResearch/Hermes-4-70B", "NousResearch/Hermes-4.3-36B", "OpenGVLab/InternVL3-78B-TEE", "Qwen/Qwen2.5-72B-Instruct", "Qwen/Qwen2.5-Coder-32B-Instruct", "Qwen/Qwen2.5-VL-32B-Instruct", "Qwen/Qwen2.5-VL-72B-Instruct-TEE", "Qwen/Qwen3-14B", "Qwen/Qwen3-235B-A22B", "Qwen/Qwen3-235B-A22B-Instruct-2507-TEE", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-30B-A3B-Instruct-2507", "Qwen/Qwen3-32B", "Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8-TEE", "Qwen/Qwen3-Next-80B-A3B-Instruct", "Qwen/Qwen3-VL-235B-A22B-Instruct", "Qwen/Qwen3Guard-Gen-0.6B", "XiaomiMiMo/MiMo-V2-Flash", "chutesai/Mistral-Small-3.1-24B-Instruct-2503", "chutesai/Mistral-Small-3.2-24B-Instruct-2506", "deepseek-ai/DeepSeek-R1-0528-TEE", "deepseek-ai/DeepSeek-R1-Distill-Llama-70B", "deepseek-ai/DeepSeek-R1-TEE", "deepseek-ai/DeepSeek-V3", "deepseek-ai/DeepSeek-V3-0324-TEE", "deepseek-ai/DeepSeek-V3.1-TEE", "deepseek-ai/DeepSeek-V3.1-Terminus-TEE", "deepseek-ai/DeepSeek-V3.2-Speciale-TEE", "deepseek-ai/DeepSeek-V3.2-TEE", "miromind-ai/MiroThinker-v1.5-235B", "mistralai/Devstral-2-123B-Instruct-2512", "mistralai/Devstral-2-123B-Instruct-2512-TEE", "moonshotai/Kimi-K2-Instruct-0905", "moonshotai/Kimi-K2-Thinking-TEE", "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16", "openai/gpt-oss-120b-TEE", "openai/gpt-oss-20b", "rednote-hilab/dots.ocr", "tngtech/DeepSeek-R1T-Chimera", "tngtech/DeepSeek-TNG-R1T2-Chimera", "tngtech/TNG-R1T-Chimera-TEE", "unsloth/Mistral-Nemo-Instruct-2407", "unsloth/Mistral-Small-24B-Instruct-2501", "unsloth/gemma-3-12b-it", "unsloth/gemma-3-27b-it", "unsloth/gemma-3-4b-it", "zai-org/GLM-4.5-Air", "zai-org/GLM-4.5-TEE", "zai-org/GLM-4.6-TEE", "zai-org/GLM-4.6V", "zai-org/GLM-4.7-TEE" ]; readonly "cloudflare-ai-gateway": readonly [ "anthropic/claude-3-5-haiku", "anthropic/claude-3-haiku", "anthropic/claude-3-opus", "anthropic/claude-3-sonnet", "anthropic/claude-3.5-haiku", "anthropic/claude-3.5-sonnet", "anthropic/claude-haiku-4-5", "anthropic/claude-opus-4", "anthropic/claude-opus-4-1", "anthropic/claude-opus-4-5", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-4-5", "openai/gpt-3.5-turbo", "openai/gpt-4", "openai/gpt-4-turbo", "openai/gpt-4o", "openai/gpt-4o-mini", "openai/gpt-5.1", "openai/gpt-5.1-codex", "openai/gpt-5.2", "openai/o1", "openai/o3", "openai/o3-mini", "openai/o3-pro", "openai/o4-mini", "workers-ai/@cf/ai4bharat/indictrans2-en-indic-1B", "workers-ai/@cf/aisingapore/gemma-sea-lion-v4-27b-it", "workers-ai/@cf/baai/bge-base-en-v1.5", "workers-ai/@cf/baai/bge-large-en-v1.5", "workers-ai/@cf/baai/bge-m3", "workers-ai/@cf/baai/bge-reranker-base", "workers-ai/@cf/baai/bge-small-en-v1.5", "workers-ai/@cf/deepgram/aura-2-en", "workers-ai/@cf/deepgram/aura-2-es", "workers-ai/@cf/deepgram/nova-3", "workers-ai/@cf/deepseek-ai/deepseek-r1-distill-qwen-32b", "workers-ai/@cf/facebook/bart-large-cnn", "workers-ai/@cf/google/gemma-3-12b-it", "workers-ai/@cf/huggingface/distilbert-sst-2-int8", "workers-ai/@cf/ibm-granite/granite-4.0-h-micro", "workers-ai/@cf/meta/llama-2-7b-chat-fp16", "workers-ai/@cf/meta/llama-3-8b-instruct", "workers-ai/@cf/meta/llama-3-8b-instruct-awq", "workers-ai/@cf/meta/llama-3.1-8b-instruct", "workers-ai/@cf/meta/llama-3.1-8b-instruct-awq", "workers-ai/@cf/meta/llama-3.1-8b-instruct-fp8", "workers-ai/@cf/meta/llama-3.2-11b-vision-instruct", "workers-ai/@cf/meta/llama-3.2-1b-instruct", "workers-ai/@cf/meta/llama-3.2-3b-instruct", "workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast", "workers-ai/@cf/meta/llama-4-scout-17b-16e-instruct", "workers-ai/@cf/meta/llama-guard-3-8b", "workers-ai/@cf/meta/m2m100-1.2b", "workers-ai/@cf/mistral/mistral-7b-instruct-v0.1", "workers-ai/@cf/mistralai/mistral-small-3.1-24b-instruct", "workers-ai/@cf/myshell-ai/melotts", "workers-ai/@cf/openai/gpt-oss-120b", "workers-ai/@cf/openai/gpt-oss-20b", "workers-ai/@cf/pfnet/plamo-embedding-1b", "workers-ai/@cf/pipecat-ai/smart-turn-v2", "workers-ai/@cf/qwen/qwen2.5-coder-32b-instruct", "workers-ai/@cf/qwen/qwen3-30b-a3b-fp8", "workers-ai/@cf/qwen/qwen3-embedding-0.6b", "workers-ai/@cf/qwen/qwq-32b" ]; readonly "cloudflare-workers-ai": readonly [ "aura-1", "bart-large-cnn", "deepseek-r1-distill-qwen-32b", "dreamshaper-8-lcm", "flux-1-schnell", "gemma-2b-it-lora", "gemma-3-12b-it", "gemma-7b-it", "gemma-7b-it-lora", "gemma-sea-lion-v4-27b-it", "gpt-oss-120b", "gpt-oss-20b", "granite-4.0-h-micro", "hermes-2-pro-mistral-7b", "llama-2-7b-chat-fp16", "llama-2-7b-chat-hf-lora", "llama-2-7b-chat-int8", "llama-3-8b-instruct", "llama-3-8b-instruct-awq", "llama-3.1-70b-instruct", "llama-3.1-8b-instruct", "llama-3.1-8b-instruct-awq", "llama-3.1-8b-instruct-fast", "llama-3.1-8b-instruct-fp8", "llama-3.2-11b-vision-instruct", "llama-3.2-1b-instruct", "llama-3.2-3b-instruct", "llama-3.3-70b-instruct-fp8-fast", "llama-4-scout-17b-16e-instruct", "llama-guard-3-8b", "llava-1.5-7b-hf", "lucid-origin", "m2m100-1.2b", "melotts", "mistral-7b-instruct-v0.1", "mistral-7b-instruct-v0.2", "mistral-7b-instruct-v0.2-lora", "mistral-small-3.1-24b-instruct", "nova-3", "phi-2", "phoenix-1.0", "qwen2.5-coder-32b-instruct", "qwen3-30b-a3b-fp8", "qwq-32b", "resnet-50", "sqlcoder-7b-2", "stable-diffusion-v1-5-img2img", "stable-diffusion-v1-5-inpainting", "stable-diffusion-xl-base-1.0", "stable-diffusion-xl-lightning", "uform-gen2-qwen-500m", "whisper", "whisper-large-v3-turbo", "whisper-tiny-en" ]; readonly cohere: readonly [ "command-a-03-2025", "command-a-reasoning-08-2025", "command-a-translate-08-2025", "command-a-vision-07-2025", "command-r-08-2024", "command-r-plus-08-2024", "command-r7b-12-2024" ]; readonly cortecs: readonly [ "claude-4-5-sonnet", "claude-sonnet-4", "deepseek-v3-0324", "devstral-2512", "devstral-small-2512", "gemini-2.5-pro", "gpt-4.1", "gpt-oss-120b", "intellect-3", "kimi-k2-instruct", "kimi-k2-thinking", "llama-3.1-405b-instruct", "nova-pro-v1", "qwen3-32b", "qwen3-coder-480b-a35b-instruct", "qwen3-next-80b-a3b-thinking" ]; readonly deepinfra: readonly [ "MiniMaxAI/MiniMax-M2", "MiniMaxAI/MiniMax-M2.1", "Qwen/Qwen3-Coder-480B-A35B-Instruct", "Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo", "moonshotai/Kimi-K2-Instruct", "moonshotai/Kimi-K2-Thinking", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "zai-org/GLM-4.7" ]; readonly deepseek: readonly ["deepseek-chat", "deepseek-reasoner"]; readonly fastrouter: readonly [ "anthropic/claude-opus-4.1", "anthropic/claude-sonnet-4", "deepseek-ai/deepseek-r1-distill-llama-70b", "google/gemini-2.5-flash", "google/gemini-2.5-pro", "moonshotai/kimi-k2", "openai/gpt-4.1", "openai/gpt-5", "openai/gpt-5-mini", "openai/gpt-5-nano", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "qwen/qwen3-coder", "x-ai/grok-4" ]; readonly "fireworks-ai": readonly [ "accounts/fireworks/models/deepseek-r1-0528", "accounts/fireworks/models/deepseek-v3-0324", "accounts/fireworks/models/deepseek-v3p1", "accounts/fireworks/models/deepseek-v3p2", "accounts/fireworks/models/glm-4p5", "accounts/fireworks/models/glm-4p5-air", "accounts/fireworks/models/glm-4p6", "accounts/fireworks/models/glm-4p7", "accounts/fireworks/models/gpt-oss-120b", "accounts/fireworks/models/gpt-oss-20b", "accounts/fireworks/models/kimi-k2-instruct", "accounts/fireworks/models/kimi-k2-thinking", "accounts/fireworks/models/minimax-m2", "accounts/fireworks/models/minimax-m2p1", "accounts/fireworks/models/qwen3-235b-a22b", "accounts/fireworks/models/qwen3-coder-480b-a35b-instruct" ]; readonly firmware: readonly [ "claude-haiku-4-5-20251001", "claude-opus-4-5", "claude-sonnet-4-5-20250929", "deepseek-chat", "deepseek-coder", "deepseek-reasoner", "gemini-2.5-flash", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview", "gpt-4o", "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.2", "grok-4-fast-non-reasoning", "grok-4-fast-reasoning", "grok-code-fast-1" ]; readonly friendli: readonly [ "LGAI-EXAONE/EXAONE-4.0.1-32B", "LGAI-EXAONE/K-EXAONE-236B-A23B", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-32B", "meta-llama-3.1-8b-instruct", "meta-llama-3.3-70b-instruct", "meta-llama/Llama-4-Maverick-17B-128E-Instruct", "meta-llama/Llama-4-Scout-17B-16E-Instruct", "zai-org/GLM-4.6" ]; readonly "github-copilot": readonly [ "claude-haiku-4.5", "claude-opus-4.5", "claude-opus-41", "claude-sonnet-4", "claude-sonnet-4.5", "gemini-2.5-pro", "gemini-3-flash-preview", "gemini-3-pro-preview", "gpt-4.1", "gpt-4o", "gpt-5", "gpt-5-codex", "gpt-5-mini", "gpt-5.1", "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini", "gpt-5.2", "gpt-5.2-codex", "grok-code-fast-1" ]; readonly "github-models": readonly [ "ai21-labs/ai21-jamba-1.5-large", "ai21-labs/ai21-jamba-1.5-mini", "cohere/cohere-command-a", "cohere/cohere-command-r", "cohere/cohere-command-r-08-2024", "cohere/cohere-command-r-plus", "cohere/cohere-command-r-plus-08-2024", "core42/jais-30b-chat", "deepseek/deepseek-r1", "deepseek/deepseek-r1-0528", "deepseek/deepseek-v3-0324", "meta/llama-3.2-11b-vision-instruct", "meta/llama-3.2-90b-vision-instruct", "meta/llama-3.3-70b-instruct", "meta/llama-4-maverick-17b-128e-instruct-fp8", "meta/llama-4-scout-17b-16e-instruct", "meta/meta-llama-3-70b-instruct", "meta/meta-llama-3-8b-instruct", "meta/meta-llama-3.1-405b-instruct", "meta/meta-llama-3.1-70b-instruct", "meta/meta-llama-3.1-8b-instruct", "microsoft/mai-ds-r1", "microsoft/phi-3-medium-128k-instruct", "microsoft/phi-3-medium-4k-instruct", "microsoft/phi-3-mini-128k-instruct", "microsoft/phi-3-mini-4k-instruct", "microsoft/phi-3-small-128k-instruct", "microsoft/phi-3-small-8k-instruct", "microsoft/phi-3.5-mini-instruct", "microsoft/phi-3.5-moe-instruct", "microsoft/phi-3.5-vision-instruct", "microsoft/phi-4", "microsoft/phi-4-mini-instruct", "microsoft/phi-4-mini-reasoning", "microsoft/phi-4-multimodal-instruct", "microsoft/phi-4-reasoning", "mistral-ai/codestral-2501", "mistral-ai/ministral-3b", "mistral-ai/mistral-large-2411", "mistral-ai/mistral-medium-2505", "mistral-ai/mistral-nemo", "mistral-ai/mistral-small-2503", "openai/gpt-4.1", "openai/gpt-4.1-mini", "openai/gpt-4.1-nano", "openai/gpt-4o", "openai/gpt-4o-mini", "openai/o1", "openai/o1-mini", "openai/o1-preview", "openai/o3", "openai/o3-mini", "openai/o4-mini", "xai/grok-3", "xai/grok-3-mini" ]; readonly gitlab: readonly ["duo-chat-haiku-4-5", "duo-chat-opus-4-5", "duo-chat-sonnet-4-5"]; readonly google: readonly [ "gemini-1.5-flash", "gemini-1.5-flash-8b", "gemini-1.5-pro", "gemini-2.0-flash", "gemini-2.0-flash-lite", "gemini-2.5-flash", "gemini-2.5-flash-image", "gemini-2.5-flash-image-preview", "gemini-2.5-flash-lite", "gemini-2.5-flash-lite-preview-06-17", "gemini-2.5-flash-lite-preview-09-2025", "gemini-2.5-flash-preview-04-17", "gemini-2.5-flash-preview-05-20", "gemini-2.5-flash-preview-09-2025", "gemini-2.5-flash-preview-tts", "gemini-2.5-pro", "gemini-2.5-pro-preview-05-06", "gemini-2.5-pro-preview-06-05", "gemini-2.5-pro-preview-tts", "gemini-3-flash-preview", "gemini-3-pro-preview", "gemini-embedding-001", "gemini-flash-latest", "gemini-flash-lite-latest", "gemini-live-2.5-flash", "gemini-live-2.5-flash-preview-native-audio" ]; readonly "google-vertex": readonly [ "gemini-2.0-flash", "gemini-2.0-flash-lite", "gemini-2.5-flash", "gemini-2.5-flash-lite", "gemini-2.5-flash-lite-preview-06-17", "gemini-2.5-flash-lite-preview-09-2025", "gemini-2.5-flash-preview-04-17", "gemini-2.5-flash-preview-05-20", "gemini-2.5-flash-preview-09-2025", "gemini-2.5-pro", "gemini-2.5-pro-preview-05-06", "gemini-2.5-pro-preview-06-05", "gemini-3-flash-preview", "gemini-3-pro-preview", "gemini-embedding-001", "gemini-flash-latest", "gemini-flash-lite-latest", "openai/gpt-oss-120b-maas", "openai/gpt-oss-20b-maas" ]; readonly "google-vertex-anthropic": readonly [ "claude-3-5-haiku@20241022", "claude-3-5-sonnet@20241022", "claude-3-7-sonnet@20250219", "claude-haiku-4-5@20251001", "claude-opus-4-1@20250805", "claude-opus-4-5@20251101", "claude-opus-4@20250514", "claude-sonnet-4-5@20250929", "claude-sonnet-4@20250514" ]; readonly groq: readonly [ "llama-3.1-8b-instant", "llama-3.3-70b-versatile", "meta-llama/llama-4-maverick-17b-128e-instruct", "meta-llama/llama-4-scout-17b-16e-instruct", "meta-llama/llama-guard-4-12b", "moonshotai/kimi-k2-instruct-0905", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "qwen/qwen3-32b" ]; readonly helicone: readonly [ "chatgpt-4o-latest", "claude-3-haiku-20240307", "claude-3.5-haiku", "claude-3.5-sonnet-v2", "claude-3.7-sonnet", "claude-4.5-haiku", "claude-4.5-opus", "claude-4.5-sonnet", "claude-haiku-4-5-20251001", "claude-opus-4", "claude-opus-4-1", "claude-opus-4-1-20250805", "claude-sonnet-4", "claude-sonnet-4-5-20250929", "codex-mini-latest", "deepseek-r1-distill-llama-70b", "deepseek-reasoner", "deepseek-tng-r1t2-chimera", "deepseek-v3", "deepseek-v3.1-terminus", "deepseek-v3.2", "ernie-4.5-21b-a3b-thinking", "gemini-2.5-flash", "gemini-2.5-flash-lite", "gemini-2.5-pro", "gemini-3-pro-preview", "gemma-3-12b-it", "gemma2-9b-it", "glm-4.6", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-mini-2025-04-14", "gpt-4.1-nano", "gpt-4o", "gpt-4o-mini", "gpt-5", "gpt-5-chat-latest", "gpt-5-codex", "gpt-5-mini", "gpt-5-nano", "gpt-5-pro", "gpt-5.1", "gpt-5.1-chat-latest", "gpt-5.1-codex", "gpt-5.1-codex-mini", "gpt-oss-120b", "gpt-oss-20b", "grok-3", "grok-3-mini", "grok-4", "grok-4-1-fast-non-reasoning", "grok-4-1-fast-reasoning", "grok-4-fast-non-reasoning", "grok-4-fast-reasoning", "grok-code-fast-1", "hermes-2-pro-llama-3-8b", "kimi-k2-0711", "kimi-k2-0905", "kimi-k2-thinking", "llama-3.1-8b-instant", "llama-3.1-8b-instruct", "llama-3.1-8b-instruct-turbo", "llama-3.3-70b-instruct", "llama-3.3-70b-versatile", "llama-4-maverick", "llama-4-scout", "llama-guard-4", "llama-prompt-guard-2-22m", "llama-prompt-guard-2-86m", "mistral-large-2411", "mistral-nemo", "mistral-small", "o1", "o1-mini", "o3", "o3-mini", "o3-pro", "o4-mini", "qwen2.5-coder-7b-fast", "qwen3-235b-a22b-thinking", "qwen3-30b-a3b", "qwen3-32b", "qwen3-coder", "qwen3-coder-30b-a3b-instruct", "qwen3-next-80b-a3b-instruct", "qwen3-vl-235b-a22b-instruct", "sonar", "sonar-deep-research", "sonar-pro", "sonar-reasoning", "sonar-reasoning-pro" ]; readonly huggingface: readonly [ "MiniMaxAI/MiniMax-M2.1", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-Coder-480B-A35B-Instruct", "Qwen/Qwen3-Embedding-4B", "Qwen/Qwen3-Embedding-8B", "Qwen/Qwen3-Next-80B-A3B-Instruct", "Qwen/Qwen3-Next-80B-A3B-Thinking", "XiaomiMiMo/MiMo-V2-Flash", "deepseek-ai/DeepSeek-R1-0528", "deepseek-ai/DeepSeek-V3.2", "moonshotai/Kimi-K2-Instruct", "moonshotai/Kimi-K2-Instruct-0905", "moonshotai/Kimi-K2-Thinking", "zai-org/GLM-4.7" ]; readonly iflowcn: readonly [ "deepseek-r1", "deepseek-v3", "deepseek-v3.2", "glm-4.6", "kimi-k2", "kimi-k2-0905", "qwen3-235b", "qwen3-235b-a22b-instruct", "qwen3-235b-a22b-thinking-2507", "qwen3-32b", "qwen3-coder-plus", "qwen3-max", "qwen3-max-preview", "qwen3-vl-plus" ]; readonly inception: readonly ["mercury", "mercury-coder"]; readonly inference: readonly [ "google/gemma-3", "meta/llama-3.1-8b-instruct", "meta/llama-3.2-11b-vision-instruct", "meta/llama-3.2-1b-instruct", "meta/llama-3.2-3b-instruct", "mistral/mistral-nemo-12b-instruct", "osmosis/osmosis-structure-0.6b", "qwen/qwen-2.5-7b-vision-instruct", "qwen/qwen3-embedding-4b" ]; readonly "io-net": readonly [ "Intel/Qwen3-Coder-480B-A35B-Instruct-int4-mixed-ar", "Qwen/Qwen2.5-VL-32B-Instruct", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-Next-80B-A3B-Instruct", "deepseek-ai/DeepSeek-R1-0528", "meta-llama/Llama-3.2-90B-Vision-Instruct", "meta-llama/Llama-3.3-70B-Instruct", "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8", "mistralai/Devstral-Small-2505", "mistralai/Magistral-Small-2506", "mistralai/Mistral-Large-Instruct-2411", "mistralai/Mistral-Nemo-Instruct-2407", "moonshotai/Kimi-K2-Instruct-0905", "moonshotai/Kimi-K2-Thinking", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "zai-org/GLM-4.6" ]; readonly "kimi-for-coding": readonly ["kimi-k2-thinking"]; readonly llama: readonly [ "cerebras-llama-4-maverick-17b-128e-instruct", "cerebras-llama-4-scout-17b-16e-instruct", "groq-llama-4-maverick-17b-128e-instruct", "llama-3.3-70b-instruct", "llama-3.3-8b-instruct", "llama-4-maverick-17b-128e-instruct-fp8", "llama-4-scout-17b-16e-instruct-fp8" ]; readonly lmstudio: readonly [ "openai/gpt-oss-20b", "qwen/qwen3-30b-a3b-2507", "qwen/qwen3-coder-30b" ]; readonly lucidquery: readonly ["lucidnova-rf1-100b", "lucidquery-nexus-coder"]; readonly minimax: readonly ["MiniMax-M2", "MiniMax-M2.1"]; readonly "minimax-cn": readonly ["MiniMax-M2", "MiniMax-M2.1"]; readonly mistral: readonly [ "codestral-latest", "devstral-2512", "devstral-medium-2507", "devstral-medium-latest", "devstral-small-2505", "devstral-small-2507", "labs-devstral-small-2512", "magistral-medium-latest", "magistral-small", "ministral-3b-latest", "ministral-8b-latest", "mistral-embed", "mistral-large-2411", "mistral-large-2512", "mistral-large-latest", "mistral-medium-2505", "mistral-medium-2508", "mistral-medium-latest", "mistral-nemo", "mistral-small-2506", "mistral-small-latest", "open-mistral-7b", "open-mixtral-8x22b", "open-mixtral-8x7b", "pixtral-12b", "pixtral-large-latest" ]; readonly modelscope: readonly [ "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-30B-A3B-Instruct-2507", "Qwen/Qwen3-30B-A3B-Thinking-2507", "Qwen/Qwen3-Coder-30B-A3B-Instruct", "ZhipuAI/GLM-4.5", "ZhipuAI/GLM-4.6" ]; readonly moonshotai: readonly [ "kimi-k2-0711-preview", "kimi-k2-0905-preview", "kimi-k2-thinking", "kimi-k2-thinking-turbo", "kimi-k2-turbo-preview" ]; readonly "moonshotai-cn": readonly [ "kimi-k2-0711-preview", "kimi-k2-0905-preview", "kimi-k2-thinking", "kimi-k2-thinking-turbo", "kimi-k2-turbo-preview" ]; readonly morph: readonly ["auto", "morph-v3-fast", "morph-v3-large"]; readonly "nano-gpt": readonly [ "deepseek/deepseek-r1", "deepseek/deepseek-v3.2:thinking", "meta-llama/llama-3.3-70b-instruct", "meta-llama/llama-4-maverick", "minimax/minimax-m2.1", "mistralai/devstral-2-123b-instruct-2512", "mistralai/ministral-14b-instruct-2512", "mistralai/mistral-large-3-675b-instruct-2512", "moonshotai/kimi-k2-instruct", "moonshotai/kimi-k2-thinking", "nousresearch/hermes-4-405b:thinking", "nvidia/llama-3_3-nemotron-super-49b-v1_5", "openai/gpt-oss-120b", "qwen/qwen3-235b-a22b-thinking-2507", "qwen/qwen3-coder", "z-ai/glm-4.6", "z-ai/glm-4.6:thinking", "zai-org/glm-4.5-air", "zai-org/glm-4.5-air:thinking", "zai-org/glm-4.7", "zai-org/glm-4.7:thinking" ]; readonly nebius: readonly [ "NousResearch/hermes-4-405b", "NousResearch/hermes-4-70b", "deepseek-ai/deepseek-v3", "meta-llama/llama-3.3-70b-instruct-base", "meta-llama/llama-3.3-70b-instruct-fast", "meta-llama/llama-3_1-405b-instruct", "moonshotai/kimi-k2-instruct", "nvidia/llama-3_1-nemotron-ultra-253b-v1", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "qwen/qwen3-235b-a22b-instruct-2507", "qwen/qwen3-235b-a22b-thinking-2507", "qwen/qwen3-coder-480b-a35b-instruct", "zai-org/glm-4.5", "zai-org/glm-4.5-air" ]; readonly "novita-ai": readonly [ "baichuan/baichuan-m2-32b", "baidu/ernie-4.5-21B-a3b", "baidu/ernie-4.5-21B-a3b-thinking", "baidu/ernie-4.5-300b-a47b-paddle", "baidu/ernie-4.5-vl-28b-a3b", "baidu/ernie-4.5-vl-28b-a3b-thinking", "baidu/ernie-4.5-vl-424b-a47b", "deepseek/deepseek-ocr", "deepseek/deepseek-prover-v2-671b", "deepseek/deepseek-r1-0528", "deepseek/deepseek-r1-0528-qwen3-8b", "deepseek/deepseek-r1-distill-llama-70b", "deepseek/deepseek-r1-turbo", "deepseek/deepseek-v3-0324", "deepseek/deepseek-v3-turbo", "deepseek/deepseek-v3.1", "deepseek/deepseek-v3.1-terminus", "deepseek/deepseek-v3.2", "deepseek/deepseek-v3.2-exp", "google/gemma-3-27b-it", "gryphe/mythomax-l2-13b", "kwaipilot/kat-coder", "kwaipilot/kat-coder-pro", "meta-llama/llama-3-70b-instruct", "meta-llama/llama-3-8b-instruct", "meta-llama/llama-3.1-8b-instruct", "meta-llama/llama-3.3-70b-instruct", "meta-llama/llama-4-maverick-17b-128e-instruct-fp8", "meta-llama/llama-4-scout-17b-16e-instruct", "microsoft/wizardlm-2-8x22b", "minimax/minimax-m2", "minimax/minimax-m2.1", "minimaxai/minimax-m1-80k", "mistralai/mistral-nemo", "moonshotai/kimi-k2-0905", "moonshotai/kimi-k2-instruct", "moonshotai/kimi-k2-thinking", "nousresearch/hermes-2-pro-llama-3-8b", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "paddlepaddle/paddleocr-vl", "qwen/qwen-2.5-72b-instruct", "qwen/qwen-mt-plus", "qwen/qwen2.5-7b-instruct", "qwen/qwen2.5-vl-72b-instruct", "qwen/qwen3-235b-a22b-fp8", "qwen/qwen3-235b-a22b-instruct-2507", "qwen/qwen3-235b-a22b-thinking-2507", "qwen/qwen3-30b-a3b-fp8", "qwen/qwen3-32b-fp8", "qwen/qwen3-4b-fp8", "qwen/qwen3-8b-fp8", "qwen/qwen3-coder-30b-a3b-instruct", "qwen/qwen3-coder-480b-a35b-instruct", "qwen/qwen3-max", "qwen/qwen3-next-80b-a3b-instruct", "qwen/qwen3-next-80b-a3b-thinking", "qwen/qwen3-omni-30b-a3b-instruct", "qwen/qwen3-omni-30b-a3b-thinking", "qwen/qwen3-vl-235b-a22b-instruct", "qwen/qwen3-vl-235b-a22b-thinking", "qwen/qwen3-vl-30b-a3b-instruct", "qwen/qwen3-vl-30b-a3b-thinking", "qwen/qwen3-vl-8b-instruct", "sao10k/L3-8B-Stheno-v3.2", "sao10k/l3-70b-euryale-v2.1", "sao10k/l3-8b-lunaris", "sao10k/l31-70b-euryale-v2.2", "skywork/r1v4-lite", "xiaomimimo/mimo-v2-flash", "zai-org/autoglm-phone-9b-multilingual", "zai-org/glm-4.5", "zai-org/glm-4.5-air", "zai-org/glm-4.5v", "zai-org/glm-4.6", "zai-org/glm-4.6v", "zai-org/glm-4.7" ]; readonly nvidia: readonly [ "black-forest-labs/flux.1-dev", "deepseek-ai/deepseek-coder-6.7b-instruct", "deepseek-ai/deepseek-r1", "deepseek-ai/deepseek-r1-0528", "deepseek-ai/deepseek-v3.1", "deepseek-ai/deepseek-v3.1-terminus", "google/codegemma-1.1-7b", "google/codegemma-7b", "google/gemma-2-27b-it", "google/gemma-2-2b-it", "google/gemma-3-12b-it", "google/gemma-3-1b-it", "google/gemma-3-27b-it", "google/gemma-3n-e2b-it", "google/gemma-3n-e4b-it", "meta/codellama-70b", "meta/llama-3.1-405b-instruct", "meta/llama-3.1-70b-instruct", "meta/llama-3.2-11b-vision-instruct", "meta/llama-3.2-1b-instruct", "meta/llama-3.3-70b-instruct", "meta/llama-4-maverick-17b-128e-instruct", "meta/llama-4-scout-17b-16e-instruct", "meta/llama3-70b-instruct", "meta/llama3-8b-instruct", "microsoft/phi-3-medium-128k-instruct", "microsoft/phi-3-medium-4k-instruct", "microsoft/phi-3-small-128k-instruct", "microsoft/phi-3-small-8k-instruct", "microsoft/phi-3-vision-128k-instruct", "microsoft/phi-3.5-moe-instruct", "microsoft/phi-3.5-vision-instruct", "microsoft/phi-4-mini-instruct", "minimaxai/minimax-m2", "mistralai/codestral-22b-instruct-v0.1", "mistralai/devstral-2-123b-instruct-2512", "mistralai/mamba-codestral-7b-v0.1", "mistralai/ministral-14b-instruct-2512", "mistralai/mistral-large-2-instruct", "mistralai/mistral-large-3-675b-instruct-2512", "mistralai/mistral-small-3.1-24b-instruct-2503", "moonshotai/kimi-k2-instruct", "moonshotai/kimi-k2-instruct-0905", "moonshotai/kimi-k2-thinking", "nvidia/cosmos-nemotron-34b", "nvidia/llama-3.1-nemotron-51b-instruct", "nvidia/llama-3.1-nemotron-70b-instruct", "nvidia/llama-3.1-nemotron-ultra-253b-v1", "nvidia/llama-3.3-nemotron-super-49b-v1", "nvidia/llama-3.3-nemotron-super-49b-v1.5", "nvidia/llama-embed-nemotron-8b", "nvidia/llama3-chatqa-1.5-70b", "nvidia/nemoretriever-ocr-v1", "nvidia/nemotron-3-nano-30b-a3b", "nvidia/nemotron-4-340b-instruct", "nvidia/nvidia-nemotron-nano-9b-v2", "nvidia/parakeet-tdt-0.6b-v2", "openai/gpt-oss-120b", "openai/whisper-large-v3", "qwen/qwen2.5-coder-32b-instruct", "qwen/qwen2.5-coder-7b-instruct", "qwen/qwen3-235b-a22b", "qwen/qwen3-coder-480b-a35b-instruct", "qwen/qwen3-next-80b-a3b-instruct", "qwen/qwen3-next-80b-a3b-thinking", "qwen/qwq-32b" ]; readonly "ollama-cloud": readonly [ "cogito-2.1:671b-cloud", "deepseek-v3.1:671b-cloud", "gemini-3-pro-preview:latest", "glm-4.6:cloud", "gpt-oss:120b-cloud", "gpt-oss:20b-cloud", "kimi-k2-thinking:cloud", "kimi-k2:1t-cloud", "minimax-m2:cloud", "qwen3-coder:480b-cloud", "qwen3-vl-235b-cloud", "qwen3-vl-235b-instruct-cloud" ]; readonly openai: readonly [ "codex-mini-latest", "gpt-3.5-turbo", "gpt-4", "gpt-4-turbo", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o-2024-11-20", "gpt-4o-mini", "gpt-5", "gpt-5-chat-latest", "gpt-5-codex", "gpt-5-mini", "gpt-5-nano", "gpt-5-pro", "gpt-5.1", "gpt-5.1-chat-latest", "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini", "gpt-5.2", "gpt-5.2-chat-latest", "gpt-5.2-codex", "gpt-5.2-pro", "o1", "o1-mini", "o1-preview", "o1-pro", "o3", "o3-deep-research", "o3-mini", "o3-pro", "o4-mini", "o4-mini-deep-research", "text-embedding-3-large", "text-embedding-3-small", "text-embedding-ada-002" ]; readonly opencode: readonly [ "alpha-gd4", "alpha-glm-4.7", "big-pickle", "claude-3-5-haiku", "claude-haiku-4-5", "claude-opus-4-1", "claude-opus-4-5", "claude-sonnet-4", "claude-sonnet-4-5", "gemini-3-flash", "gemini-3-pro", "glm-4.6", "glm-4.7-free", "gpt-5", "gpt-5-codex", "gpt-5-nano", "gpt-5.1", "gpt-5.1-codex", "gpt-5.1-codex-max", "gpt-5.1-codex-mini", "gpt-5.2", "gpt-5.2-codex", "grok-code", "kimi-k2", "kimi-k2-thinking", "minimax-m2.1-free", "qwen3-coder" ]; readonly openrouter: readonly [ "anthropic/claude-3.5-haiku", "anthropic/claude-3.7-sonnet", "anthropic/claude-haiku-4.5", "anthropic/claude-opus-4", "anthropic/claude-opus-4.1", "anthropic/claude-opus-4.5", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-4.5", "cognitivecomputations/dolphin3.0-mistral-24b", "cognitivecomputations/dolphin3.0-r1-mistral-24b", "deepseek/deepseek-chat-v3-0324", "deepseek/deepseek-chat-v3.1", "deepseek/deepseek-r1-0528-qwen3-8b:free", "deepseek/deepseek-r1-0528:free", "deepseek/deepseek-r1-distill-llama-70b", "deepseek/deepseek-r1-distill-qwen-14b", "deepseek/deepseek-r1:free", "deepseek/deepseek-v3-base:free", "deepseek/deepseek-v3.1-terminus", "deepseek/deepseek-v3.1-terminus:exacto", "deepseek/deepseek-v3.2", "deepseek/deepseek-v3.2-speciale", "featherless/qwerky-72b", "google/gemini-2.0-flash-001", "google/gemini-2.0-flash-exp:free", "google/gemini-2.5-flash", "google/gemini-2.5-flash-lite", "google/gemini-2.5-flash-lite-preview-09-2025", "google/gemini-2.5-flash-preview-09-2025", "google/gemini-2.5-pro", "google/gemini-2.5-pro-preview-05-06", "google/gemini-2.5-pro-preview-06-05", "google/gemini-3-flash-preview", "google/gemini-3-pro-preview", "google/gemma-2-9b-it:free", "google/gemma-3-12b-it", "google/gemma-3-27b-it", "google/gemma-3n-e4b-it", "google/gemma-3n-e4b-it:free", "kwaipilot/kat-coder-pro:free", "meta-llama/llama-3.2-11b-vision-instruct", "meta-llama/llama-3.3-70b-instruct:free", "meta-llama/llama-4-scout:free", "microsoft/mai-ds-r1:free", "minimax/minimax-01", "minimax/minimax-m1", "minimax/minimax-m2", "minimax/minimax-m2.1", "mistralai/codestral-2508", "mistralai/devstral-2512", "mistralai/devstral-2512:free", "mistralai/devstral-medium-2507", "mistralai/devstral-small-2505", "mistralai/devstral-small-2505:free", "mistralai/devstral-small-2507", "mistralai/mistral-7b-instruct:free", "mistralai/mistral-medium-3", "mistralai/mistral-medium-3.1", "mistralai/mistral-nemo:free", "mistralai/mistral-small-3.1-24b-instruct", "mistralai/mistral-small-3.2-24b-instruct", "mistralai/mistral-small-3.2-24b-instruct:free", "moonshotai/kimi-dev-72b:free", "moonshotai/kimi-k2", "moonshotai/kimi-k2-0905", "moonshotai/kimi-k2-0905:exacto", "moonshotai/kimi-k2-thinking", "moonshotai/kimi-k2:free", "nousresearch/deephermes-3-llama-3-8b-preview", "nousresearch/hermes-4-405b", "nousresearch/hermes-4-70b", "nvidia/nemotron-nano-9b-v2", "openai/gpt-4.1", "openai/gpt-4.1-mini", "openai/gpt-4o-mini", "openai/gpt-5", "openai/gpt-5-chat", "openai/gpt-5-codex", "openai/gpt-5-image", "openai/gpt-5-mini", "openai/gpt-5-nano", "openai/gpt-5-pro", "openai/gpt-5.1", "openai/gpt-5.1-chat", "openai/gpt-5.1-codex", "openai/gpt-5.1-codex-mini", "openai/gpt-5.2", "openai/gpt-5.2-chat-latest", "openai/gpt-5.2-codex", "openai/gpt-5.2-pro", "openai/gpt-oss-120b", "openai/gpt-oss-120b:exacto", "openai/gpt-oss-20b", "openai/gpt-oss-safeguard-20b", "openai/o4-mini", "openrouter/sherlock-dash-alpha", "openrouter/sherlock-think-alpha", "qwen/qwen-2.5-coder-32b-instruct", "qwen/qwen2.5-vl-32b-instruct:free", "qwen/qwen2.5-vl-72b-instruct", "qwen/qwen2.5-vl-72b-instruct:free", "qwen/qwen3-14b:free", "qwen/qwen3-235b-a22b-07-25", "qwen/qwen3-235b-a22b-07-25:free", "qwen/qwen3-235b-a22b-thinking-2507", "qwen/qwen3-235b-a22b:free", "qwen/qwen3-30b-a3b-instruct-2507", "qwen/qwen3-30b-a3b-thinking-2507", "qwen/qwen3-30b-a3b:free", "qwen/qwen3-32b:free", "qwen/qwen3-8b:free", "qwen/qwen3-coder", "qwen/qwen3-coder-30b-a3b-instruct", "qwen/qwen3-coder-flash", "qwen/qwen3-coder:exacto", "qwen/qwen3-coder:free", "qwen/qwen3-max", "qwen/qwen3-next-80b-a3b-instruct", "qwen/qwen3-next-80b-a3b-thinking", "qwen/qwq-32b:free", "rekaai/reka-flash-3", "sarvamai/sarvam-m:free", "thudm/glm-z1-32b:free", "tngtech/deepseek-r1t2-chimera:free", "x-ai/grok-3", "x-ai/grok-3-beta", "x-ai/grok-3-mini", "x-ai/grok-3-mini-beta", "x-ai/grok-4", "x-ai/grok-4-fast", "x-ai/grok-4.1-fast", "x-ai/grok-code-fast-1", "z-ai/glm-4.5", "z-ai/glm-4.5-air", "z-ai/glm-4.5-air:free", "z-ai/glm-4.5v", "z-ai/glm-4.6", "z-ai/glm-4.6:exacto", "z-ai/glm-4.7" ]; readonly ovhcloud: readonly [ "deepseek-r1-distill-llama-70b", "gpt-oss-120b", "gpt-oss-20b", "llama-3.1-8b-instruct", "llava-next-mistral-7b", "meta-llama-3_1-70b-instruct", "meta-llama-3_3-70b-instruct", "mistral-7b-instruct-v0.3", "mistral-nemo-instruct-2407", "mistral-small-3.2-24b-instruct-2506", "mixtral-8x7b-instruct-v0.1", "qwen2.5-coder-32b-instruct", "qwen2.5-vl-72b-instruct", "qwen3-32b", "qwen3-coder-30b-a3b-instruct" ]; readonly perplexity: readonly ["sonar", "sonar-pro", "sonar-reasoning-pro"]; readonly poe: readonly [ "anthropic/claude-haiku-3", "anthropic/claude-haiku-3.5", "anthropic/claude-haiku-3.5-search", "anthropic/claude-haiku-4.5", "anthropic/claude-opus-3", "anthropic/claude-opus-4", "anthropic/claude-opus-4-reasoning", "anthropic/claude-opus-4-search", "anthropic/claude-opus-4.1", "anthropic/claude-opus-4.5", "anthropic/claude-sonnet-3.5", "anthropic/claude-sonnet-3.5-june", "anthropic/claude-sonnet-3.7", "anthropic/claude-sonnet-3.7-reasoning", "anthropic/claude-sonnet-3.7-search", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-4-reasoning", "anthropic/claude-sonnet-4-search", "anthropic/claude-sonnet-4.5", "cerebras/gpt-oss-120b-cs", "cerebras/zai-glm-4.6-cs", "elevenlabs/elevenlabs-music", "elevenlabs/elevenlabs-v2.5-turbo", "elevenlabs/elevenlabs-v3", "google/gemini-2.0-flash", "google/gemini-2.0-flash-lite", "google/gemini-2.5-flash", "google/gemini-2.5-flash-lite", "google/gemini-2.5-pro", "google/gemini-3-flash", "google/gemini-3-pro", "google/gemini-deep-research", "google/imagen-3", "google/imagen-3-fast", "google/imagen-4", "google/imagen-4-fast", "google/imagen-4-ultra", "google/lyria", "google/nano-banana", "google/nano-banana-pro", "google/veo-2", "google/veo-3", "google/veo-3-fast", "google/veo-3.1", "google/veo-3.1-fast", "ideogramai/ideogram", "ideogramai/ideogram-v2", "ideogramai/ideogram-v2a", "ideogramai/ideogram-v2a-turbo", "lumalabs/dream-machine", "lumalabs/ray2", "novita/glm-4.6", "novita/glm-4.6v", "novita/glm-4.7", "novita/kat-coder-pro", "novita/kimi-k2-thinking", "novita/minimax-m2.1", "openai/chatgpt-4o-latest", "openai/dall-e-3", "openai/gpt-3.5-turbo", "openai/gpt-3.5-turbo-instruct", "openai/gpt-3.5-turbo-raw", "openai/gpt-4-classic", "openai/gpt-4-classic-0314", "openai/gpt-4-turbo", "openai/gpt-4.1", "openai/gpt-4.1-mini", "openai/gpt-4.1-nano", "openai/gpt-4o", "openai/gpt-4o-aug", "openai/gpt-4o-mini", "openai/gpt-4o-mini-search", "openai/gpt-4o-search", "openai/gpt-5", "openai/gpt-5-chat", "openai/gpt-5-codex", "openai/gpt-5-mini", "openai/gpt-5-nano", "openai/gpt-5-pro", "openai/gpt-5.1", "openai/gpt-5.1-codex", "openai/gpt-5.1-codex-max", "openai/gpt-5.1-codex-mini", "openai/gpt-5.1-instant", "openai/gpt-5.2", "openai/gpt-5.2-instant", "openai/gpt-5.2-pro", "openai/gpt-image-1", "openai/gpt-image-1-mini", "openai/gpt-image-1.5", "openai/o1", "openai/o1-pro", "openai/o3", "openai/o3-deep-research", "openai/o3-mini", "openai/o3-mini-high", "openai/o3-pro", "openai/o4-mini", "openai/o4-mini-deep-research", "openai/sora-2", "openai/sora-2-pro", "poetools/claude-code", "runwayml/runway", "runwayml/runway-gen-4-turbo", "stabilityai/stablediffusionxl", "topazlabs-co/topazlabs", "trytako/tako", "xai/grok-3", "xai/grok-3-mini", "xai/grok-4", "xai/grok-4-fast-non-reasoning", "xai/grok-4-fast-reasoning", "xai/grok-4.1-fast-non-reasoning", "xai/grok-4.1-fast-reasoning", "xai/grok-code-fast-1" ]; readonly "privatemode-ai": readonly [ "gemma-3-27b", "gpt-oss-120b", "qwen3-coder-30b-a3b", "qwen3-embedding-4b", "whisper-large-v3" ]; readonly requesty: readonly [ "anthropic/claude-3-7-sonnet", "anthropic/claude-haiku-4-5", "anthropic/claude-opus-4", "anthropic/claude-opus-4-1", "anthropic/claude-opus-4-5", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-4-5", "google/gemini-2.5-flash", "google/gemini-2.5-pro", "google/gemini-3-flash-preview", "google/gemini-3-pro-preview", "openai/gpt-4.1", "openai/gpt-4.1-mini", "openai/gpt-4o-mini", "openai/gpt-5", "openai/gpt-5-mini", "openai/gpt-5-nano", "openai/o4-mini", "xai/grok-4", "xai/grok-4-fast" ]; readonly "sap-ai-core": readonly [ "anthropic--claude-3-haiku", "anthropic--claude-3-opus", "anthropic--claude-3-sonnet", "anthropic--claude-3.5-sonnet", "anthropic--claude-3.7-sonnet", "anthropic--claude-4-opus", "anthropic--claude-4-sonnet", "anthropic--claude-4.5-haiku", "anthropic--claude-4.5-sonnet", "gemini-2.5-flash", "gemini-2.5-pro", "gpt-5", "gpt-5-mini", "gpt-5-nano" ]; readonly scaleway: readonly [ "bge-multilingual-gemma2", "deepseek-r1-distill-llama-70b", "devstral-2-123b-instruct-2512", "gemma-3-27b-it", "gpt-oss-120b", "llama-3.1-8b-instruct", "llama-3.3-70b-instruct", "mistral-nemo-instruct-2407", "mistral-small-3.2-24b-instruct-2506", "pixtral-12b-2409", "qwen3-235b-a22b-instruct-2507", "qwen3-coder-30b-a3b-instruct", "voxtral-small-24b-2507", "whisper-large-v3" ]; readonly siliconflow: readonly [ "ByteDance-Seed/Seed-OSS-36B-Instruct", "MiniMaxAI/MiniMax-M1-80k", "MiniMaxAI/MiniMax-M2", "Qwen/QwQ-32B", "Qwen/Qwen2.5-14B-Instruct", "Qwen/Qwen2.5-32B-Instruct", "Qwen/Qwen2.5-72B-Instruct", "Qwen/Qwen2.5-72B-Instruct-128K", "Qwen/Qwen2.5-7B-Instruct", "Qwen/Qwen2.5-Coder-32B-Instruct", "Qwen/Qwen2.5-VL-32B-Instruct", "Qwen/Qwen2.5-VL-72B-Instruct", "Qwen/Qwen2.5-VL-7B-Instruct", "Qwen/Qwen3-14B", "Qwen/Qwen3-235B-A22B", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-30B-A3B-Instruct-2507", "Qwen/Qwen3-30B-A3B-Thinking-2507", "Qwen/Qwen3-32B", "Qwen/Qwen3-8B", "Qwen/Qwen3-Coder-30B-A3B-Instruct", "Qwen/Qwen3-Coder-480B-A35B-Instruct", "Qwen/Qwen3-Next-80B-A3B-Instruct", "Qwen/Qwen3-Next-80B-A3B-Thinking", "Qwen/Qwen3-Omni-30B-A3B-Captioner", "Qwen/Qwen3-Omni-30B-A3B-Instruct", "Qwen/Qwen3-Omni-30B-A3B-Thinking", "Qwen/Qwen3-VL-235B-A22B-Instruct", "Qwen/Qwen3-VL-235B-A22B-Thinking", "Qwen/Qwen3-VL-30B-A3B-Instruct", "Qwen/Qwen3-VL-30B-A3B-Thinking", "Qwen/Qwen3-VL-32B-Instruct", "Qwen/Qwen3-VL-32B-Thinking", "Qwen/Qwen3-VL-8B-Instruct", "Qwen/Qwen3-VL-8B-Thinking", "THUDM/GLM-4-32B-0414", "THUDM/GLM-4-9B-0414", "THUDM/GLM-4.1V-9B-Thinking", "THUDM/GLM-Z1-32B-0414", "THUDM/GLM-Z1-9B-0414", "baidu/ERNIE-4.5-300B-A47B", "deepseek-ai/DeepSeek-R1", "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B", "deepseek-ai/DeepSeek-V3", "deepseek-ai/DeepSeek-V3.1", "deepseek-ai/DeepSeek-V3.1-Terminus", "deepseek-ai/DeepSeek-V3.2", "deepseek-ai/DeepSeek-V3.2-Exp", "deepseek-ai/deepseek-vl2", "inclusionAI/Ling-flash-2.0", "inclusionAI/Ling-mini-2.0", "inclusionAI/Ring-flash-2.0", "meta-llama/Meta-Llama-3.1-8B-Instruct", "moonshotai/Kimi-Dev-72B", "moonshotai/Kimi-K2-Instruct", "moonshotai/Kimi-K2-Instruct-0905", "moonshotai/Kimi-K2-Thinking", "nex-agi/DeepSeek-V3.1-Nex-N1", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "stepfun-ai/step3", "tencent/Hunyuan-A13B-Instruct", "tencent/Hunyuan-MT-7B", "z-ai/GLM-4.5", "z-ai/GLM-4.5-Air", "zai-org/GLM-4.5", "zai-org/GLM-4.5-Air", "zai-org/GLM-4.5V", "zai-org/GLM-4.6", "zai-org/GLM-4.6V", "zai-org/GLM-4.7" ]; readonly "siliconflow-cn": readonly [ "ByteDance-Seed/Seed-OSS-36B-Instruct", "MiniMaxAI/MiniMax-M1-80k", "MiniMaxAI/MiniMax-M2", "Qwen/QwQ-32B", "Qwen/Qwen2.5-14B-Instruct", "Qwen/Qwen2.5-32B-Instruct", "Qwen/Qwen2.5-72B-Instruct", "Qwen/Qwen2.5-72B-Instruct-128K", "Qwen/Qwen2.5-7B-Instruct", "Qwen/Qwen2.5-Coder-32B-Instruct", "Qwen/Qwen2.5-VL-32B-Instruct", "Qwen/Qwen2.5-VL-72B-Instruct", "Qwen/Qwen2.5-VL-7B-Instruct", "Qwen/Qwen3-14B", "Qwen/Qwen3-235B-A22B", "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-30B-A3B", "Qwen/Qwen3-30B-A3B-Instruct-2507", "Qwen/Qwen3-30B-A3B-Thinking-2507", "Qwen/Qwen3-32B", "Qwen/Qwen3-8B", "Qwen/Qwen3-Coder-30B-A3B-Instruct", "Qwen/Qwen3-Coder-480B-A35B-Instruct", "Qwen/Qwen3-Next-80B-A3B-Instruct", "Qwen/Qwen3-Next-80B-A3B-Thinking", "Qwen/Qwen3-Omni-30B-A3B-Captioner", "Qwen/Qwen3-Omni-30B-A3B-Instruct", "Qwen/Qwen3-Omni-30B-A3B-Thinking", "Qwen/Qwen3-VL-235B-A22B-Instruct", "Qwen/Qwen3-VL-235B-A22B-Thinking", "Qwen/Qwen3-VL-30B-A3B-Instruct", "Qwen/Qwen3-VL-30B-A3B-Thinking", "Qwen/Qwen3-VL-32B-Instruct", "Qwen/Qwen3-VL-32B-Thinking", "Qwen/Qwen3-VL-8B-Instruct", "Qwen/Qwen3-VL-8B-Thinking", "THUDM/GLM-4-32B-0414", "THUDM/GLM-4-9B-0414", "THUDM/GLM-4.1V-9B-Thinking", "THUDM/GLM-Z1-32B-0414", "THUDM/GLM-Z1-9B-0414", "baidu/ERNIE-4.5-300B-A47B", "deepseek-ai/DeepSeek-R1", "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B", "deepseek-ai/DeepSeek-V3", "deepseek-ai/DeepSeek-V3.1", "deepseek-ai/DeepSeek-V3.1-Terminus", "deepseek-ai/DeepSeek-V3.2-Exp", "deepseek-ai/deepseek-vl2", "inclusionAI/Ling-flash-2.0", "inclusionAI/Ling-mini-2.0", "inclusionAI/Ring-flash-2.0", "meta-llama/Meta-Llama-3.1-8B-Instruct", "moonshotai/Kimi-Dev-72B", "moonshotai/Kimi-K2-Instruct", "moonshotai/Kimi-K2-Instruct-0905", "moonshotai/Kimi-K2-Thinking", "nex-agi/DeepSeek-V3.1-Nex-N1", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "stepfun-ai/step3", "tencent/Hunyuan-A13B-Instruct", "tencent/Hunyuan-MT-7B", "z-ai/GLM-4.5", "z-ai/GLM-4.5-Air", "zai-org/GLM-4.5", "zai-org/GLM-4.5-Air", "zai-org/GLM-4.5V", "zai-org/GLM-4.6" ]; readonly submodel: readonly [ "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8", "deepseek-ai/DeepSeek-R1-0528", "deepseek-ai/DeepSeek-V3-0324", "deepseek-ai/DeepSeek-V3.1", "openai/gpt-oss-120b", "zai-org/GLM-4.5-Air", "zai-org/GLM-4.5-FP8" ]; readonly synthetic: readonly [ "hf:MiniMaxAI/MiniMax-M2", "hf:MiniMaxAI/MiniMax-M2.1", "hf:Qwen/Qwen2.5-Coder-32B-Instruct", "hf:Qwen/Qwen3-235B-A22B-Instruct-2507", "hf:Qwen/Qwen3-235B-A22B-Thinking-2507", "hf:Qwen/Qwen3-Coder-480B-A35B-Instruct", "hf:deepseek-ai/DeepSeek-R1", "hf:deepseek-ai/DeepSeek-R1-0528", "hf:deepseek-ai/DeepSeek-V3", "hf:deepseek-ai/DeepSeek-V3-0324", "hf:deepseek-ai/DeepSeek-V3.1", "hf:deepseek-ai/DeepSeek-V3.1-Terminus", "hf:deepseek-ai/DeepSeek-V3.2", "hf:meta-llama/Llama-3.1-405B-Instruct", "hf:meta-llama/Llama-3.1-70B-Instruct", "hf:meta-llama/Llama-3.1-8B-Instruct", "hf:meta-llama/Llama-3.3-70B-Instruct", "hf:meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8", "hf:meta-llama/Llama-4-Scout-17B-16E-Instruct", "hf:moonshotai/Kimi-K2-Instruct-0905", "hf:moonshotai/Kimi-K2-Thinking", "hf:openai/gpt-oss-120b", "hf:zai-org/GLM-4.5", "hf:zai-org/GLM-4.6", "hf:zai-org/GLM-4.7" ]; readonly togetherai: readonly [ "Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8", "deepseek-ai/DeepSeek-R1", "deepseek-ai/DeepSeek-V3", "deepseek-ai/DeepSeek-V3-1", "essentialai/Rnj-1-Instruct", "meta-llama/Llama-3.3-70B-Instruct-Turbo", "moonshotai/Kimi-K2-Instruct", "moonshotai/Kimi-K2-Thinking", "openai/gpt-oss-120b", "zai-org/GLM-4.6" ]; readonly upstage: readonly ["solar-mini", "solar-pro2", "solar-pro3"]; readonly v0: readonly ["v0-1.0-md", "v0-1.5-lg", "v0-1.5-md"]; readonly venice: readonly [ "claude-opus-45", "claude-sonnet-45", "deepseek-v3.2", "gemini-3-flash-preview", "gemini-3-pro-preview", "google-gemma-3-27b-it", "grok-41-fast", "grok-code-fast-1", "hermes-3-llama-3.1-405b", "kimi-k2-thinking", "llama-3.2-3b", "llama-3.3-70b", "minimax-m21", "mistral-31-24b", "openai-gpt-52", "openai-gpt-52-codex", "openai-gpt-oss-120b", "qwen3-235b-a22b-instruct-2507", "qwen3-235b-a22b-thinking-2507", "qwen3-4b", "qwen3-coder-480b-a35b-instruct", "qwen3-next-80b", "venice-uncensored", "zai-org-glm-4.6v", "zai-org-glm-4.7" ]; readonly vercel: readonly [ "alibaba/qwen-3-14b", "alibaba/qwen-3-235b", "alibaba/qwen-3-30b", "alibaba/qwen-3-32b", "alibaba/qwen3-235b-a22b-thinking", "alibaba/qwen3-coder", "alibaba/qwen3-coder-30b-a3b", "alibaba/qwen3-coder-plus", "alibaba/qwen3-embedding-0.6b", "alibaba/qwen3-embedding-4b", "alibaba/qwen3-embedding-8b", "alibaba/qwen3-max", "alibaba/qwen3-max-preview", "alibaba/qwen3-next-80b-a3b-instruct", "alibaba/qwen3-next-80b-a3b-thinking", "alibaba/qwen3-vl-instruct", "alibaba/qwen3-vl-thinking", "amazon/nova-2-lite", "amazon/nova-lite", "amazon/nova-micro", "amazon/nova-pro", "amazon/titan-embed-text-v2", "anthropic/claude-3-haiku", "anthropic/claude-3-opus", "anthropic/claude-3.5-haiku", "anthropic/claude-3.5-sonnet", "anthropic/claude-3.5-sonnet-20240620", "anthropic/claude-3.7-sonnet", "anthropic/claude-haiku-4.5", "anthropic/claude-opus-4", "anthropic/claude-opus-4.1", "anthropic/claude-opus-4.5", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-4.5", "arcee-ai/trinity-mini", "bfl/flux-kontext-max", "bfl/flux-kontext-pro", "bfl/flux-pro-1.0-fill", "bfl/flux-pro-1.1", "bfl/flux-pro-1.1-ultra", "bytedance/seed-1.6", "cohere/command-a", "cohere/embed-v4.0", "deepseek/deepseek-r1", "deepseek/deepseek-v3", "deepseek/deepseek-v3.1", "deepseek/deepseek-v3.1-terminus", "deepseek/deepseek-v3.2", "deepseek/deepseek-v3.2-exp", "deepseek/deepseek-v3.2-thinking", "google/gemini-2.0-flash", "google/gemini-2.0-flash-lite", "google/gemini-2.5-flash", "google/gemini-2.5-flash-image", "google/gemini-2.5-flash-image-preview", "google/gemini-2.5-flash-lite", "google/gemini-2.5-flash-lite-preview-09-2025", "google/gemini-2.5-flash-preview-09-2025", "google/gemini-2.5-pro", "google/gemini-3-flash", "google/gemini-3-pro-image", "google/gemini-3-pro-preview", "google/gemini-embedding-001", "google/imagen-4.0-fast-generate-001", "google/imagen-4.0-generate-001", "google/imagen-4.0-ultra-generate-001", "google/text-embedding-005", "google/text-multilingual-embedding-002", "inception/mercury-coder-small", "kwaipilot/kat-coder-pro-v1", "meituan/longcat-flash-chat", "meituan/longcat-flash-thinking", "meta/llama-3.1-70b", "meta/llama-3.1-8b", "meta/llama-3.2-11b", "meta/llama-3.2-1b", "meta/llama-3.2-3b", "meta/llama-3.2-90b", "meta/llama-3.3-70b", "meta/llama-4-maverick", "meta/llama-4-scout", "minimax/minimax-m2", "minimax/minimax-m2.1", "minimax/minimax-m2.1-lightning", "mistral/codestral", "mistral/codestral-embed", "mistral/devstral-2", "mistral/devstral-small", "mistral/devstral-small-2", "mistral/magistral-medium", "mistral/magistral-small", "mistral/ministral-14b", "mistral/ministral-3b", "mistral/ministral-8b", "mistral/mistral-embed", "mistral/mistral-large-3", "mistral/mistral-medium", "mistral/mistral-nemo", "mistral/mistral-small", "mistral/mixtral-8x22b-instruct", "mistral/pixtral-12b", "mistral/pixtral-large", "moonshotai/kimi-k2-0905", "moonshotai/kimi-k2-thinking", "moonshotai/kimi-k2-thinking-turbo", "moonshotai/kimi-k2-turbo", "morph/morph-v3-fast", "morph/morph-v3-large", "nvidia/nemotron-3-nano-30b-a3b", "nvidia/nemotron-nano-12b-v2-vl", "nvidia/nemotron-nano-9b-v2", "openai/codex-mini", "openai/gpt-3.5-turbo", "openai/gpt-3.5-turbo-instruct", "openai/gpt-4-turbo", "openai/gpt-4.1", "openai/gpt-4.1-mini", "openai/gpt-4.1-nano", "openai/gpt-4o", "openai/gpt-4o-mini", "openai/gpt-5", "openai/gpt-5-chat", "openai/gpt-5-codex", "openai/gpt-5-mini", "openai/gpt-5-nano", "openai/gpt-5-pro", "openai/gpt-5.1-codex", "openai/gpt-5.1-codex-max", "openai/gpt-5.1-codex-mini", "openai/gpt-5.1-instant", "openai/gpt-5.1-thinking", "openai/gpt-5.2", "openai/gpt-5.2-chat", "openai/gpt-5.2-pro", "openai/gpt-oss-120b", "openai/gpt-oss-20b", "openai/gpt-oss-safeguard-20b", "openai/o1", "openai/o3", "openai/o3-deep-research", "openai/o3-mini", "openai/o3-pro", "openai/o4-mini", "openai/text-embedding-3-large", "openai/text-embedding-3-small", "openai/text-embedding-ada-002", "perplexity/sonar", "perplexity/sonar-pro", "perplexity/sonar-reasoning", "perplexity/sonar-reasoning-pro", "prime-intellect/intellect-3", "vercel/v0-1.0-md", "vercel/v0-1.5-md", "voyage/voyage-3-large", "voyage/voyage-3.5", "voyage/voyage-3.5-lite", "voyage/voyage-code-2", "voyage/voyage-code-3", "voyage/voyage-finance-2", "voyage/voyage-law-2", "xai/grok-2-vision", "xai/grok-3", "xai/grok-3-fast", "xai/grok-3-mini", "xai/grok-3-mini-fast", "xai/grok-4", "xai/grok-4-fast-non-reasoning", "xai/grok-4-fast-reasoning", "xai/grok-4.1-fast-non-reasoning", "xai/grok-4.1-fast-reasoning", "xai/grok-code-fast-1", "xiaomi/mimo-v2-flash", "zai/glm-4.5", "zai/glm-4.5-air", "zai/glm-4.5v", "zai/glm-4.6", "zai/glm-4.6v", "zai/glm-4.6v-flash", "zai/glm-4.7" ]; readonly vivgrid: readonly ["gpt-5.1-codex"]; readonly vultr: readonly [ "deepseek-r1-distill-llama-70b", "deepseek-r1-distill-qwen-32b", "gpt-oss-120b", "kimi-k2-instruct", "qwen2.5-coder-32b-instruct" ]; readonly wandb: readonly [ "Qwen/Qwen3-235B-A22B-Instruct-2507", "Qwen/Qwen3-235B-A22B-Thinking-2507", "Qwen/Qwen3-Coder-480B-A35B-Instruct", "deepseek-ai/DeepSeek-R1-0528", "deepseek-ai/DeepSeek-V3-0324", "meta-llama/Llama-3.1-8B-Instruct", "meta-llama/Llama-3.3-70B-Instruct", "meta-llama/Llama-4-Scout-17B-16E-Instruct", "microsoft/Phi-4-mini-instruct", "moonshotai/Kimi-K2-Instruct" ]; readonly xai: readonly [ "grok-2", "grok-2-1212", "grok-2-latest", "grok-2-vision", "grok-2-vision-1212", "grok-2-vision-latest", "grok-3", "grok-3-fast", "grok-3-fast-latest", "grok-3-latest", "grok-3-mini", "grok-3-mini-fast", "grok-3-mini-fast-latest", "grok-3-mini-latest", "grok-4", "grok-4-1-fast", "grok-4-1-fast-non-reasoning", "grok-4-fast", "grok-4-fast-non-reasoning", "grok-beta", "grok-code-fast-1", "grok-vision-beta" ]; readonly xiaomi: readonly ["mimo-v2-flash"]; readonly zai: readonly [ "glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6", "glm-4.6v", "glm-4.7" ]; readonly "zai-coding-plan": readonly [ "glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6", "glm-4.6v", "glm-4.7" ]; readonly zenmux: readonly [ "anthropic/claude-haiku-4.5", "anthropic/claude-opus-4", "anthropic/claude-opus-4.1", "anthropic/claude-opus-4.5", "anthropic/claude-sonnet-4", "anthropic/claude-sonnet-4.5", "baidu/ernie-5.0-thinking-preview", "deepseek/deepseek-chat", "deepseek/deepseek-reasoner", "deepseek/deepseek-v3.2", "deepseek/deepseek-v3.2-exp", "google/gemini-2.5-flash", "google/gemini-2.5-flash-lite", "google/gemini-2.5-pro", "google/gemini-3-flash-preview", "google/gemini-3-flash-preview-free", "google/gemini-3-pro-preview", "inclusionai/ling-1t", "inclusionai/ring-1t", "kuaishou/kat-coder-pro-v1", "kuaishou/kat-coder-pro-v1-free", "minimax/minimax-m2", "minimax/minimax-m2.1", "moonshotai/kimi-k2-0905", "moonshotai/kimi-k2-thinking", "moonshotai/kimi-k2-thinking-turbo", "openai/gpt-5", "openai/gpt-5-codex", "openai/gpt-5.1", "openai/gpt-5.1-chat", "openai/gpt-5.1-codex", "openai/gpt-5.1-codex-mini", "openai/gpt-5.2", "qwen/qwen3-coder-plus", "stepfun/step-3", "volcengine/doubao-seed-1.8", "volcengine/doubao-seed-code", "x-ai/grok-4", "x-ai/grok-4-fast", "x-ai/grok-4.1-fast", "x-ai/grok-4.1-fast-non-reasoning", "x-ai/grok-code-fast-1", "xiaomi/mimo-v2-flash", "xiaomi/mimo-v2-flash-free", "z-ai/glm-4.5", "z-ai/glm-4.5-air", "z-ai/glm-4.6", "z-ai/glm-4.6v", "z-ai/glm-4.6v-flash", "z-ai/glm-4.6v-flash-free", "z-ai/glm-4.7" ]; readonly zhipuai: readonly [ "glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6", "glm-4.6v", "glm-4.6v-flash", "glm-4.7" ]; readonly "zhipuai-coding-plan": readonly [ "glm-4.5", "glm-4.5-air", "glm-4.5-flash", "glm-4.5v", "glm-4.6", "glm-4.6v", "glm-4.6v-flash", "glm-4.7" ]; }; type ProviderId = keyof ProviderModelsMap; type ModelRouterModelId = { [P in ProviderId]: `${P}/${ProviderModelsMap[P][number]}`; }[ProviderId] | (string & {}); type ModelForProvider

= ProviderModelsMap[P][number]; type WorkspaceToolPolicy = { enabled?: boolean; needsApproval?: boolean | ToolNeedsApprovalFunction; }; type WorkspaceToolPolicyGroup = { defaults?: TPolicy; tools?: Partial>; }; type WorkspaceToolPolicies = Partial> | WorkspaceToolPolicyGroup; type WorkspaceFilesystemToolPolicy = WorkspaceToolPolicy & { requireReadBeforeWrite?: boolean; }; type WorkspaceToolConfig = { filesystem?: WorkspaceToolPolicies; sandbox?: WorkspaceToolPolicies; search?: WorkspaceToolPolicies; skills?: WorkspaceToolPolicies; }; type WorkspaceSandboxExecuteOptions = { command: string; args?: string[]; cwd?: string; env?: Record; timeoutMs?: number; maxOutputBytes?: number; stdin?: string; signal?: AbortSignal; onStdout?: (chunk: string) => void; onStderr?: (chunk: string) => void; operationContext?: OperationContext; }; type WorkspaceSandboxStatus = "idle" | "ready" | "destroyed" | "error"; type WorkspaceSandboxResult = { stdout: string; stderr: string; exitCode: number | null; signal?: string; durationMs: number; timedOut: boolean; aborted: boolean; stdoutTruncated: boolean; stderrTruncated: boolean; }; interface WorkspaceSandbox { name: string; status?: WorkspaceSandboxStatus; start?: () => Promise | void; stop?: () => Promise | void; destroy?: () => Promise | void; getInfo?: () => Record; getInstructions?: () => string | null; execute(options: WorkspaceSandboxExecuteOptions): Promise; } type LocalSandboxOptions = { rootDir?: string; cleanupOnDestroy?: boolean; defaultTimeoutMs?: number; maxOutputBytes?: number; env?: Record; inheritProcessEnv?: boolean; allowedCommands?: string[]; blockedCommands?: string[]; isolation?: LocalSandboxIsolationOptions; }; type LocalSandboxIsolationProvider = "none" | "sandbox-exec" | "bwrap"; type LocalSandboxIsolationOptions = { provider?: LocalSandboxIsolationProvider; allowNetwork?: boolean; allowSystemBinaries?: boolean; readWritePaths?: string[]; readOnlyPaths?: string[]; seatbeltProfilePath?: string; bwrapArgs?: string[]; profile?: string; }; declare const detectLocalSandboxIsolation: () => Promise; declare class LocalSandbox implements WorkspaceSandbox { name: string; status: WorkspaceSandboxStatus; private readonly rootDir?; private readonly autoRootDir; private readonly cleanupOnDestroy; private readonly defaultTimeoutMs; private readonly maxOutputBytes; private readonly env; private readonly inheritProcessEnv; private readonly allowedCommands?; private readonly blockedCommands?; private readonly isolation?; constructor(options?: LocalSandboxOptions); private rootDirReady?; private ensureRootDir; static detectIsolation(): Promise; start(): void; stop(): void; destroy(): void; getInfo(): Record; getInstructions(): string | null; execute(options: WorkspaceSandboxExecuteOptions): Promise; } type WorkspaceSandboxToolkitOptions = { systemPrompt?: string | null; operationTimeoutMs?: number; customToolDescription?: string | null; outputEvictionBytes?: number; outputEvictionPath?: string; toolPolicies?: WorkspaceToolPolicies | null; }; type WorkspaceSandboxToolkitContext = { sandbox?: WorkspaceSandbox; workspace?: WorkspaceIdentity; pathContext?: WorkspacePathContext; agent?: Agent; filesystem?: WorkspaceFilesystem; }; type WorkspaceSandboxToolName = "execute_command"; declare const createWorkspaceSandboxToolkit: (context: WorkspaceSandboxToolkitContext, options?: WorkspaceSandboxToolkitOptions) => Toolkit; type NormalizedCommand = { command: string; args?: string[]; }; declare const normalizeCommandAndArgs: (command: string, args?: string[]) => NormalizedCommand; type WorkspaceSearchMode = "bm25" | "vector" | "hybrid"; type WorkspaceSearchIndexPath = { path: string; glob?: string; }; type WorkspaceSearchHybridWeights = { lexicalWeight?: number; vectorWeight?: number; }; type WorkspaceSearchConfig = { bm25?: { k1?: number; b?: number; }; embedding?: EmbeddingAdapterInput; vector?: VectorAdapter; autoIndexPaths?: Array; maxFileBytes?: number; snippetLength?: number; defaultMode?: WorkspaceSearchMode; hybrid?: WorkspaceSearchHybridWeights; allowDirectAccess?: boolean; }; type WorkspaceSearchOptions = { mode?: WorkspaceSearchMode; topK?: number; minScore?: number; path?: string; glob?: string; snippetLength?: number; lexicalWeight?: number; vectorWeight?: number; context?: WorkspaceFilesystemCallContext; }; type WorkspaceSearchResult = { id: string; path: string; score: number; content: string; lineRange?: { start: number; end: number; }; scoreDetails?: { bm25?: number; vector?: number; }; bm25Score?: number; vectorScore?: number; snippet?: string; metadata?: Record; }; type WorkspaceSearchIndexSummary = { indexed: number; vectorIndexed?: number; skipped: number; errors: string[]; }; type WorkspaceSkillSearchMode = "bm25" | "vector" | "hybrid"; type WorkspaceSkillSearchHybridWeights = { lexicalWeight?: number; vectorWeight?: number; }; type WorkspaceSkillsRootResolverContext = { workspace: WorkspaceIdentity; filesystem: WorkspaceFilesystem; operationContext?: OperationContext; }; type WorkspaceSkillsRootResolver = (context?: WorkspaceSkillsRootResolverContext) => string[] | undefined | null | Promise; type WorkspaceSkillsConfig = { rootPaths?: string[] | WorkspaceSkillsRootResolver; glob?: string; maxFileBytes?: number; autoDiscover?: boolean; autoIndex?: boolean; bm25?: { k1?: number; b?: number; }; embedding?: EmbeddingAdapterInput; vector?: VectorAdapter; defaultMode?: WorkspaceSkillSearchMode; hybrid?: WorkspaceSkillSearchHybridWeights; }; type WorkspaceSkillMetadata = { id: string; name: string; description?: string; version?: string; tags?: string[]; path: string; root: string; references?: string[]; scripts?: string[]; assets?: string[]; }; type WorkspaceSkill = WorkspaceSkillMetadata & { instructions: string; }; type WorkspaceSkillSearchOptions = { mode?: WorkspaceSkillSearchMode; topK?: number; snippetLength?: number; lexicalWeight?: number; vectorWeight?: number; context?: WorkspaceFilesystemCallContext; }; type WorkspaceSkillSearchResult = { id: string; name: string; score: number; bm25Score?: number; vectorScore?: number; snippet?: string; metadata?: Record; }; type WorkspaceSkillIndexSummary = { indexed: number; skipped: number; errors: string[]; }; type WorkspaceSkillsPromptOptions = { includeAvailable?: boolean; includeActivated?: boolean; maxAvailable?: number; maxActivated?: number; maxInstructionChars?: number; maxPromptChars?: number; }; type WorkspaceScope = "agent" | "conversation"; type WorkspaceStatus = "idle" | "initializing" | "ready" | "destroyed" | "error"; type WorkspaceComponentStatus = "idle" | "ready" | "destroyed" | "error"; type WorkspaceIdentity = { id: string; name?: string; scope?: WorkspaceScope; }; type WorkspaceFilesystemConfig = { backend?: FilesystemBackend | FilesystemBackendFactory; files?: Record; directories?: string[]; readOnly?: boolean; }; type WorkspaceComponentInfo = { status?: WorkspaceComponentStatus; details?: Record; }; type WorkspaceInfo = { id: string; name?: string; scope: WorkspaceScope; status: WorkspaceStatus; operationTimeoutMs?: number; filesystem?: WorkspaceComponentInfo; sandbox?: WorkspaceComponentInfo; search?: WorkspaceComponentInfo; skills?: WorkspaceComponentInfo; }; type WorkspacePathContext = { filesystem?: { status?: WorkspaceComponentStatus; instructions?: string | null; info?: Record; }; sandbox?: { status?: WorkspaceComponentStatus; instructions?: string | null; info?: Record; }; }; type WorkspaceConfig = { id?: string; name?: string; scope?: WorkspaceScope; operationTimeoutMs?: number; filesystem?: WorkspaceFilesystemConfig; sandbox?: WorkspaceSandbox; search?: WorkspaceSearchConfig; skills?: WorkspaceSkillsConfig; toolConfig?: WorkspaceToolConfig; }; type MaybePromise = T | Promise; interface FileInfo { path: string; is_dir?: boolean; size?: number; modified_at?: string; created_at?: string; } interface GrepMatch { path: string; line: number; text: string; } interface FileData { content: string[]; created_at: string; modified_at: string; } interface WriteResult { error?: string; path?: string; filesUpdate?: Record | null; metadata?: Record; } interface WriteOptions { overwrite?: boolean; } interface EditResult { error?: string; path?: string; filesUpdate?: Record | null; occurrences?: number; metadata?: Record; } interface DeleteResult { error?: string; path?: string; filesUpdate?: Record | null; metadata?: Record; } interface DeleteOptions { recursive?: boolean; } interface MkdirResult { error?: string; path?: string; metadata?: Record; } interface RmdirResult { error?: string; path?: string; filesUpdate?: Record | null; metadata?: Record; } interface FilesystemBackend { lsInfo(path: string): MaybePromise; read(filePath: string, offset?: number, limit?: number): MaybePromise; readRaw(filePath: string): MaybePromise; stat?(filePath: string): MaybePromise; exists?(filePath: string): MaybePromise; grepRaw(pattern: string, path?: string | null, glob?: string | null): MaybePromise; globInfo(pattern: string, path?: string): MaybePromise; write(filePath: string, content: string, options?: WriteOptions): MaybePromise; edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): MaybePromise; delete?(filePath: string, options?: DeleteOptions): MaybePromise; mkdir?(path: string, recursive?: boolean): MaybePromise; rmdir?(path: string, recursive?: boolean): MaybePromise; } type FilesystemBackendContext = { agent?: Agent; operationContext?: OperationContext; state: { files?: Record; directories?: Set; }; }; type FilesystemBackendFactory = (context: FilesystemBackendContext) => FilesystemBackend; declare class CompositeFilesystemBackend implements FilesystemBackend { private defaultBackend; private routes; private sortedRoutes; constructor(defaultBackend: FilesystemBackend, routes: Record); private getBackendAndKey; private getMountPrefix; private remapFilesUpdate; private remapFilesUpdateResult; lsInfo(path: string): Promise; read(filePath: string, offset?: number, limit?: number): Promise; readRaw(filePath: string): Promise; stat(filePath: string): Promise; exists(filePath: string): Promise; grepRaw(pattern: string, path?: string, glob?: string | null): Promise; globInfo(pattern: string, path?: string): Promise; write(filePath: string, content: string, options?: WriteOptions): Promise; edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): Promise; delete(filePath: string, options?: DeleteOptions): Promise; mkdir(path: string, recursive?: boolean): Promise; rmdir(path: string, recursive?: boolean): Promise; } declare class NodeFilesystemBackend implements FilesystemBackend { private cwd; private virtualMode; private readonly contained; private maxFileSizeBytes; constructor(options?: { rootDir?: string; virtualMode?: boolean; contained?: boolean; maxFileSizeMb?: number; }); private resolvePath; private isEnoentError; private assertPathContained; private toVirtualPath; lsInfo(dirPath: string): Promise; read(filePath: string, offset?: number, limit?: number): Promise; readRaw(filePath: string): Promise; stat(filePath: string): Promise; exists(filePath: string): Promise; write(filePath: string, content: string, options?: WriteOptions): Promise; mkdir(dirPath: string, recursive?: boolean): Promise; edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): Promise; delete(filePath: string, options?: DeleteOptions): Promise; rmdir(dirPath: string, recursive?: boolean): Promise; grepRaw(pattern: string, dirPath?: string, glob?: string | null): Promise; private ripgrepSearch; private fallbackSearch; globInfo(pattern: string, searchPath?: string): Promise; } declare class InMemoryFilesystemBackend implements FilesystemBackend { private files; private directories; constructor(files?: Record, directories?: Set); private getFiles; private getDirectories; private normalizeDirPath; private hasDirectory; lsInfo(path: string): FileInfo[]; read(filePath: string, offset?: number, limit?: number): string; readRaw(filePath: string): FileData; stat(filePath: string): FileInfo | null; exists(filePath: string): boolean; write(filePath: string, content: string, options?: WriteOptions): WriteResult; edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): EditResult; delete(filePath: string, options?: DeleteOptions): DeleteResult; grepRaw(pattern: string, path?: string, glob?: string | null): GrepMatch[] | string; globInfo(pattern: string, path?: string): FileInfo[]; mkdir(path: string, recursive?: boolean): MkdirResult; rmdir(path: string, recursive?: boolean): RmdirResult; } type WorkspaceFilesystemToolName = "ls" | "read_file" | "write_file" | "edit_file" | "delete_file" | "stat" | "mkdir" | "rmdir" | "list_tree" | "list_files" | "glob" | "grep"; type WorkspaceFilesystemToolkitOptions = { systemPrompt?: string | null; operationTimeoutMs?: number; customToolDescriptions?: Partial> | null; toolPolicies?: WorkspaceToolPolicies | null; }; type WorkspaceFilesystemOptions = { backend?: FilesystemBackend | FilesystemBackendFactory; files?: Record; directories?: string[]; readOnly?: boolean; }; type WorkspaceFilesystemCallContext = { agent?: Agent; operationContext?: OperationContext; }; type WorkspaceFilesystemReadOptions = { offset?: number; limit?: number; context?: WorkspaceFilesystemCallContext; }; type WorkspaceFilesystemWriteOptions = { overwrite?: boolean; ensureDirs?: boolean; context?: WorkspaceFilesystemCallContext; }; type WorkspaceFilesystemSearchOptions = { path?: string; glob?: string | null; context?: WorkspaceFilesystemCallContext; }; type WorkspaceFilesystemOperationOptions = { context?: WorkspaceFilesystemCallContext; }; type WorkspaceFilesystemDeleteOptions = { recursive?: boolean; context?: WorkspaceFilesystemCallContext; }; type WorkspaceFilesystemRmdirOptions = { recursive?: boolean; context?: WorkspaceFilesystemCallContext; }; type WorkspaceFilesystemToolkitContext = { filesystem: WorkspaceFilesystem; workspace?: WorkspaceIdentity; agent?: Agent; }; declare class WorkspaceFilesystem { private backend; private files; private directories; readonly readOnly: boolean; status: WorkspaceComponentStatus; constructor(options?: WorkspaceFilesystemOptions); private normalizeDirectoryPath; private buildBackendContext; private updateFiles; init(): void; destroy(): void; getInfo(): Record; getInstructions(): string; lsInfo(path?: string, options?: WorkspaceFilesystemOperationOptions): Promise; read(filePath: string, options?: WorkspaceFilesystemReadOptions): Promise; readRaw(filePath: string, options?: WorkspaceFilesystemOperationOptions): Promise; write(filePath: string, content: string, options?: WorkspaceFilesystemWriteOptions): Promise; edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean, options?: WorkspaceFilesystemOperationOptions): Promise; delete(filePath: string, options?: WorkspaceFilesystemDeleteOptions): Promise; globInfo(pattern: string, path?: string, options?: WorkspaceFilesystemOperationOptions): Promise; stat(filePath: string, options?: WorkspaceFilesystemOperationOptions): Promise; exists(filePath: string, options?: WorkspaceFilesystemOperationOptions): Promise; mkdir(path: string, recursive?: boolean, options?: WorkspaceFilesystemOperationOptions): Promise; rmdir(path: string, recursive?: boolean, options?: WorkspaceFilesystemRmdirOptions): Promise; grepRaw(pattern: string, options?: WorkspaceFilesystemSearchOptions): Promise; } declare const createWorkspaceFilesystemToolkit: (context: WorkspaceFilesystemToolkitContext, options?: WorkspaceFilesystemToolkitOptions) => Toolkit; type WorkspaceSearchToolkitOptions = { systemPrompt?: string | null; operationTimeoutMs?: number; customIndexDescription?: string | null; customIndexContentDescription?: string | null; customSearchDescription?: string | null; toolPolicies?: WorkspaceToolPolicies | null; }; type WorkspaceSearchToolkitContext = { search?: WorkspaceSearch; workspace?: WorkspaceIdentity; agent?: Agent; filesystem?: WorkspaceFilesystem; }; type WorkspaceSearchToolName = "workspace_index" | "workspace_index_content" | "workspace_search"; type WorkspaceSearchDocument = { id: string; path: string; content: string; metadata?: Record; }; declare class WorkspaceSearch { private readonly filesystem; private readonly bm25; private readonly documents; private readonly embedding?; private readonly vector?; private readonly autoIndexPaths?; private readonly maxFileBytes; private readonly snippetLength; private readonly defaultMode; private readonly defaultWeights; private autoIndexPromise?; status: WorkspaceComponentStatus; constructor(options: WorkspaceSearchConfig & { filesystem: WorkspaceFilesystem; }); init(): Promise; destroy(): void; getInfo(): Record; getInstructions(): string; private ensureAutoIndex; indexPaths(paths?: Array, options?: { maxFileBytes?: number; context?: WorkspaceFilesystemCallContext; }): Promise; indexDocuments(docs: WorkspaceSearchDocument[]): Promise; indexContent(path: string, content: string, metadata?: Record, _options?: { context?: WorkspaceFilesystemCallContext; }): Promise; search(query: string, options?: WorkspaceSearchOptions): Promise; private resolveMode; private searchVector; private formatResults; } declare const createWorkspaceSearchToolkit: (context: WorkspaceSearchToolkitContext, options?: WorkspaceSearchToolkitOptions) => Toolkit; interface OnStartHookArgs { agent: Agent; context: OperationContext; } interface OnEndHookArgs { /** The conversation ID. */ conversationId: string; /** The agent that generated the output. */ agent: Agent; /** The standardized successful output object. Undefined on error. */ output: AgentOperationOutput | undefined; /** The error object if the operation failed. */ error: VoltAgentError | CancellationError | undefined; /** The operation context. */ context: OperationContext; } interface OnHandoffHookArgs { agent: Agent; sourceAgent: Agent; } interface OnHandoffCompleteHookArgs { /** The target agent (subagent) that completed the task. */ agent: Agent; /** The source agent (supervisor) that delegated the task. */ sourceAgent: Agent; /** The result produced by the subagent. */ result: string; /** The full conversation messages including the task and response. */ messages: UIMessage[]; /** Token usage information from the subagent execution. */ usage?: UsageInfo; /** The operation context containing metadata about the operation. */ context: OperationContext; /** * Call this function to bail (skip supervisor processing) and return result directly. * Optionally provide a transformed result to use instead of the original. * @param transformedResult - Optional transformed result to return instead of original */ bail: (transformedResult?: string) => void; } interface OnToolStartHookArgs { agent: Agent; tool: AgentTool; context: OperationContext; args: any; options?: ToolExecuteOptions; } interface OnToolEndHookArgs { agent: Agent; tool: AgentTool; /** The successful output from the tool. Undefined on error. */ output: unknown | undefined; /** The error if the tool execution failed. */ error: VoltAgentError | AbortError | undefined; context: OperationContext; options?: ToolExecuteOptions; } interface OnToolEndHookResult { output?: unknown; } interface OnToolErrorHookArgs { agent: Agent; tool: AgentTool; args: any; /** Structured VoltAgentError for this failure. */ error: VoltAgentError | AbortError; /** Original thrown value normalized to an Error instance. */ originalError: Error; context: OperationContext; options?: ToolExecuteOptions; } interface OnToolErrorHookResult { /** * Optional replacement payload returned to the model for this tool error. * When omitted, VoltAgent returns its default serialized error payload. */ output?: unknown; } interface OnPrepareMessagesHookArgs { /** The messages that will be sent to the LLM (AI SDK UIMessage). */ messages: UIMessage[]; /** The raw messages before sanitization (for advanced transformations). */ rawMessages?: UIMessage[]; /** The agent instance making the LLM call. */ agent: Agent; /** The operation context containing metadata about the current operation. */ context: OperationContext; } interface OnPrepareMessagesHookResult { /** The transformed messages to send to the LLM. */ messages?: UIMessage[]; } interface OnPrepareModelMessagesHookArgs { /** The finalized model messages that will be sent to the provider. */ modelMessages: ModelMessage[]; /** The sanitized UI messages that produced the model messages. */ uiMessages: UIMessage[]; /** The agent instance making the LLM call. */ agent: Agent; /** The operation context containing metadata about the current operation. */ context: OperationContext; } interface OnPrepareModelMessagesHookResult { /** The transformed model messages to send to the provider. */ modelMessages?: ModelMessage[]; } interface OnErrorHookArgs { agent: Agent; error: VoltAgentError | AbortError | Error; context: OperationContext; } interface OnStepFinishHookArgs { agent: Agent; step: any; context: OperationContext; } type RetrySource = "llm" | "middleware"; interface OnRetryHookArgsBase { agent: Agent; context: OperationContext; operation: AgentEvalOperationType; source: RetrySource; } interface OnRetryLLMHookArgs extends OnRetryHookArgsBase { source: "llm"; modelName: string; modelIndex: number; attempt: number; nextAttempt: number; maxRetries: number; error: unknown; isRetryable?: boolean; statusCode?: number; } interface OnRetryMiddlewareHookArgs extends OnRetryHookArgsBase { source: "middleware"; middlewareId?: string | null; retryCount: number; maxRetries: number; reason?: string; metadata?: unknown; } type OnRetryHookArgs = OnRetryLLMHookArgs | OnRetryMiddlewareHookArgs; type FallbackStage = "resolve" | "execute"; interface OnFallbackHookArgs { agent: Agent; context: OperationContext; operation: AgentEvalOperationType; stage: FallbackStage; fromModel: string; fromModelIndex: number; maxRetries: number; attempt?: number; error: unknown; nextModel?: string | null; nextModelIndex?: number; } type AgentHookOnStart = (args: OnStartHookArgs) => Promise | void; type AgentHookOnEnd = (args: OnEndHookArgs) => Promise | void; type AgentHookOnHandoff = (args: OnHandoffHookArgs) => Promise | void; type AgentHookOnHandoffComplete = (args: OnHandoffCompleteHookArgs) => Promise | void; type AgentHookOnToolStart = (args: OnToolStartHookArgs) => Promise | void; type AgentHookOnToolEnd = (args: OnToolEndHookArgs) => Promise | Promise | OnToolEndHookResult | undefined; type AgentHookOnToolError = (args: OnToolErrorHookArgs) => Promise | Promise | OnToolErrorHookResult | undefined; type AgentHookOnPrepareMessages = (args: OnPrepareMessagesHookArgs) => Promise | OnPrepareMessagesHookResult; type AgentHookOnPrepareModelMessages = (args: OnPrepareModelMessagesHookArgs) => Promise | OnPrepareModelMessagesHookResult; type AgentHookOnError = (args: OnErrorHookArgs) => Promise | void; type AgentHookOnStepFinish = (args: OnStepFinishHookArgs) => Promise | void; type AgentHookOnRetry = (args: OnRetryHookArgs) => Promise | void; type AgentHookOnFallback = (args: OnFallbackHookArgs) => Promise | void; /** * Type definition for agent hooks using single argument objects. */ type AgentHooks = { onStart?: AgentHookOnStart; onEnd?: AgentHookOnEnd; onHandoff?: AgentHookOnHandoff; onHandoffComplete?: AgentHookOnHandoffComplete; onToolStart?: AgentHookOnToolStart; onToolEnd?: AgentHookOnToolEnd; onToolError?: AgentHookOnToolError; onPrepareMessages?: AgentHookOnPrepareMessages; onPrepareModelMessages?: AgentHookOnPrepareModelMessages; onError?: AgentHookOnError; onStepFinish?: AgentHookOnStepFinish; onRetry?: AgentHookOnRetry; onFallback?: AgentHookOnFallback; }; /** * Create hooks from an object literal. */ declare function createHooks(hooks?: Partial): AgentHooks; type WorkspaceSkillsToolkitOptions = { systemPrompt?: string | null; operationTimeoutMs?: number; customToolDescriptions?: Partial<{ list: string; search: string; read: string; activate: string; deactivate: string; readReference: string; readScript: string; readAsset: string; }> | null; toolPolicies?: WorkspaceToolPolicies | null; }; type WorkspaceSkillsToolkitContext = { skills?: WorkspaceSkills; workspace?: WorkspaceIdentity; agent?: Agent; }; type WorkspaceSkillsToolName = "workspace_list_skills" | "workspace_search_skills" | "workspace_read_skill" | "workspace_activate_skill" | "workspace_deactivate_skill" | "workspace_read_skill_reference" | "workspace_read_skill_script" | "workspace_read_skill_asset"; type WorkspaceSkillsPromptHookContext = { skills?: WorkspaceSkills; }; type WorkspaceSkillsOperationOptions = { context?: WorkspaceFilesystemCallContext; }; declare class WorkspaceSkills { private readonly filesystem; private readonly workspaceIdentity; private rootPaths; private readonly rootResolver?; private rootResolved; private rootResolvePromise?; private readonly glob; private readonly maxFileBytes; private readonly bm25Options?; private bm25; private readonly embedding?; private readonly vector?; private readonly defaultMode; private readonly defaultWeights; private readonly skillsById; private readonly skillNameMap; private readonly skillCache; private readonly activeSkills; private readonly documents; private readonly indexedSkillIds; private discovered; private indexed; private autoDiscoverPromise?; private autoIndexPromise?; status: WorkspaceComponentStatus; constructor(options: WorkspaceSkillsConfig & { filesystem: WorkspaceFilesystem; workspace: WorkspaceSkillsRootResolverContext["workspace"]; }); init(): Promise; destroy(): void; getInfo(): Record; getInstructions(): string; private ensureDiscovered; private ensureRootPaths; private ensureIndexed; discoverSkills(options?: { refresh?: boolean; context?: WorkspaceFilesystemCallContext; }): Promise; loadSkill(identifier: string, options?: WorkspaceSkillsOperationOptions): Promise; activateSkill(identifier: string, options?: WorkspaceSkillsOperationOptions): Promise; deactivateSkill(identifier: string, options?: WorkspaceSkillsOperationOptions): Promise; getActiveSkills(): WorkspaceSkillMetadata[]; indexSkills(options?: WorkspaceSkillsOperationOptions): Promise; search(query: string, options?: WorkspaceSkillSearchOptions): Promise; buildPrompt(options?: WorkspaceSkillsPromptOptions & { context?: WorkspaceFilesystemCallContext; }): Promise; private resolveMode; private searchVector; private formatResults; private resolveSkillId; resolveSkillFilePath(skill: WorkspaceSkillMetadata, relativePath: string, allowed: string[] | undefined): string | null; readFileContent(filePath: string, options?: WorkspaceSkillsOperationOptions): Promise; } declare const createWorkspaceSkillsPromptHook: (hookContext: WorkspaceSkillsPromptHookContext, options?: WorkspaceSkillsPromptOptions) => AgentHooks; declare const createWorkspaceSkillsToolkit: (context: WorkspaceSkillsToolkitContext, options?: WorkspaceSkillsToolkitOptions) => Toolkit; declare class Workspace { readonly id: string; readonly name?: string; readonly scope: WorkspaceScope; readonly filesystem: WorkspaceFilesystem; readonly sandbox?: WorkspaceSandbox; private readonly searchService?; private readonly allowDirectSearchAccess; private readonly operationTimeoutMs?; readonly skills?: WorkspaceSkills; private readonly toolConfig?; status: WorkspaceStatus; private initPromise?; constructor(options?: WorkspaceConfig); init(): Promise; destroy(): Promise; private isDestroyed; getInfo(): WorkspaceInfo; getPathContext(): WorkspacePathContext; getToolsConfig(): WorkspaceToolConfig | undefined; getObservabilityAttributes(): Record; private applyOperationTimeout; private resolveSearchToolPolicy; private assertDirectSearchAllowed; index(path: string, content: string, metadata?: Record): Promise; search(query: string, options?: WorkspaceSearchOptions): Promise; createFilesystemToolkit(options?: WorkspaceFilesystemToolkitOptions): Toolkit; createSandboxToolkit(options?: WorkspaceSandboxToolkitOptions): Toolkit; createSearchToolkit(options?: WorkspaceSearchToolkitOptions): Toolkit; createSkillsToolkit(options?: WorkspaceSkillsToolkitOptions): Toolkit; createSkillsPromptHook(options?: WorkspaceSkillsPromptOptions): AgentHooks; } /** * AgentTraceContext - Manages trace hierarchy and common attributes * * This class solves the following problems: * 1. Common attributes (userId, conversationId, etc.) are set once and inherited by all child spans * 2. Parent-child span relationships are properly maintained * 3. Context propagation works correctly across async operations * 4. Clean integration with VoltAgentObservability for WebSocket and storage */ interface TraceContextOptions { agentId: string; agentName?: string; userId?: string; conversationId?: string; operationId: string; parentSpan?: Span; inheritParentSpan?: boolean; parentAgentId?: string; input?: string | UIMessage[] | BaseMessage[]; } declare class AgentTraceContext { private rootSpan; private tracer; private commonAttributes; private activeContext; constructor(observability: VoltAgentObservability, operationName: string, options: TraceContextOptions); /** * Create a child span with automatic parent context and attribute inheritance */ createChildSpan(name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: { label?: string; attributes?: Record; kind?: SpanKind$1; }): Span; /** * Create a child span with a specific parent span */ createChildSpanWithParent(parentSpan: Span, name: string, type: "tool" | "memory" | "retriever" | "embedding" | "vector" | "agent" | "guardrail" | "middleware" | "llm" | "summary", options?: { label?: string; attributes?: Record; kind?: SpanKind$1; }): Span; /** * Execute a function within a span's context */ withSpan(span: Span, fn: () => T | Promise): Promise; /** * Get the root span */ getRootSpan(): Span; /** * Set input on the root span */ setInput(input: any): void; /** * Set output on the root span */ setOutput(output: any): void; /** * Set instructions (system prompt) on the root span */ setInstructions(instructions: any): void; /** * Set model attributes on the root span */ setModelAttributes(modelName: string, temperature?: number, maxTokens?: number, topP?: number, frequencyPenalty?: number, presencePenalty?: number, maxSteps?: number): void; /** * Set usage information on the root span */ setUsage(usage: { promptTokens?: number; completionTokens?: number; totalTokens?: number; cachedTokens?: number; reasoningTokens?: number; }): void; /** * Set finish reason on the root span */ setFinishReason(finishReason: string | null | undefined): void; /** * Set stop condition metadata when maxSteps is reached */ setStopConditionMet(stepCount: number, maxSteps: number): void; /** * End the root span with a status */ end(status: "completed" | "error", error?: Error | any): void; /** * End a child span with proper status */ endChildSpan(span: Span, status: "completed" | "error", options?: { output?: any; error?: Error | any; attributes?: Record; }): void; private resolveParentSpan; private resolveLinkedSpan; /** * Get the active context for manual context propagation */ getActiveContext(): Context; /** * Update active context with a new span */ updateActiveContext(span: Span): void; } /** * Tool representation for API responses */ interface ApiToolInfo { name: string; description: string; parameters?: any; } interface AgentToolRoutingState { search?: ApiToolInfo; call?: ApiToolInfo; expose?: ApiToolInfo[]; pool?: ApiToolInfo[]; enforceSearchBeforeCall?: boolean; topK?: number; } type AgentFeedbackOptions = { key?: string; feedbackConfig?: VoltOpsFeedbackConfig | null; expiresAt?: Date | string; expiresIn?: VoltOpsFeedbackExpiresIn; }; type AgentFeedbackMetadata = { traceId: string; key: string; url: string; tokenId?: string; expiresAt?: string; feedbackConfig?: VoltOpsFeedbackConfig | null; provided?: boolean; providedAt?: string; feedbackId?: string; }; type AgentFeedbackMarkProvidedInput = { userId?: string; conversationId?: string; messageId?: string; providedAt?: Date | string; feedbackId?: string; }; type AgentFeedbackHandle = AgentFeedbackMetadata & { isProvided: () => boolean; markFeedbackProvided: (input?: AgentFeedbackMarkProvidedInput) => Promise; }; type AgentMarkFeedbackProvidedInput = { userId: string; conversationId: string; messageId: string; providedAt?: Date | string; feedbackId?: string; }; /** * Tool with node_id for agent state */ type ToolWithNodeId = (BaseTool | ProviderTool) & { node_id: string; }; type WorkspaceToolkitOptions = { filesystem?: WorkspaceFilesystemToolkitOptions | false; sandbox?: WorkspaceSandboxToolkitOptions | false; search?: WorkspaceSearchToolkitOptions | false; skills?: WorkspaceSkillsToolkitOptions | false; }; interface AgentScorerState { key: string; id: string; name: string; node_id: string; sampling?: SamplingPolicy; metadata?: Record | null; params?: Record | null; } /** * SubAgent data structure for agent state */ interface SubAgentStateData { id: string; name: string; instructions?: string; status: string; model: string; tools: ApiToolInfo[]; memory?: AgentMemoryState; node_id: string; subAgents?: SubAgentStateData[]; scorers?: AgentScorerState[]; guardrails?: AgentGuardrailStateGroup; methodConfig?: { method: string; schema?: string; options?: string[]; }; [key: string]: unknown; } /** * Memory block representation shared across agent and sub-agent state */ interface AgentMemoryState extends Record { node_id: string; type?: string; resourceId?: string; options?: MemoryOptions; available?: boolean; status?: string; storage?: MemoryStorageMetadata; workingMemory?: WorkingMemorySummary | null; vectorDB?: { enabled: boolean; adapter?: string; dimension?: number; status?: string; node_id?: string; } | null; embeddingModel?: { enabled: boolean; model?: string; dimension?: number; status?: string; node_id?: string; } | null; } /** * Full state of an agent including all properties */ interface AgentFullState { id: string; name: string; instructions?: string; status: string; model: string; node_id: string; tools: ToolWithNodeId[]; toolRouting?: AgentToolRoutingState; subAgents: SubAgentStateData[]; memory: AgentMemoryState; scorers?: AgentScorerState[]; retriever?: { name: string; description?: string; status?: string; node_id: string; } | null; guardrails?: AgentGuardrailStateGroup; } /** * Enhanced dynamic value for instructions that supports prompt management */ type InstructionsDynamicValue = string | DynamicValue; /** * Enhanced dynamic value for models that supports static or dynamic values */ type ModelDynamicValue = T | DynamicValue; /** * Supported model references for agents (AI SDK models or provider/model strings) */ type AgentModelReference = LanguageModel | ModelRouterModelId; /** * Model fallback configuration for agents. */ type AgentModelConfig = { /** * Optional stable identifier for the model entry (useful for logging). */ id?: string; /** * Model reference (static or dynamic). */ model: ModelDynamicValue; /** * Maximum number of retries for this model before falling back. * Defaults to the agent's maxRetries. */ maxRetries?: number; /** * Whether this model is enabled for fallback selection. * @default true */ enabled?: boolean; }; /** * Agent model value that can be static, dynamic, or a fallback list. */ type AgentModelValue = ModelDynamicValue | AgentModelConfig[]; /** * Provider options type for LLM configurations */ type LegacyProviderCallOptions = { temperature?: number; maxTokens?: number; topP?: number; frequencyPenalty?: number; presencePenalty?: number; seed?: number; stopSequences?: string[]; extraOptions?: Record; onStepFinish?: (step: StepWithContent) => Promise; onFinish?: (result: unknown) => Promise; onError?: (error: unknown) => Promise; }; type ProviderOptions = LegacyProviderCallOptions & { anthropic?: AnthropicProviderOptions & Record; google?: GoogleGenerativeAIProviderOptions & Record; openai?: OpenAIResponsesProviderOptions & Record; xai?: (XaiProviderOptions | XaiResponsesProviderOptions) & Record; [key: string]: unknown; }; /** * Configuration for supervisor agents that have subagents */ /** * StreamEventType derived from VoltAgent's extended AI SDK stream parts. */ type StreamEventType = VoltAgentTextStreamPart["type"]; /** * Configuration for forwarding events from subagents to the parent agent's stream */ type FullStreamEventForwardingConfig = { /** * Array of event types to forward from subagents * Uses VoltAgent's extended AI SDK stream part types: * - Text: 'text-start', 'text-end', 'text-delta' * - Reasoning: 'reasoning-start', 'reasoning-end', 'reasoning-delta' * - Tool: 'tool-input-start', 'tool-input-end', 'tool-input-delta', * 'tool-call', 'tool-result', 'tool-error' * - Guardrails: 'input-guardrail-blocked' * - Other: 'source', 'file', 'start-step', 'finish-step', * 'start', 'finish', 'abort', 'error', 'raw' * @default ['tool-call', 'tool-result', 'input-guardrail-blocked'] * @example ['tool-call', 'tool-result', 'text-delta'] */ types?: StreamEventType[]; }; type SupervisorConfig = { /** * Complete custom system message for the supervisor agent * If provided, this completely replaces the default template * Only agents memory section will be appended if includeAgentsMemory is true */ systemMessage?: string; /** * Whether to include agents memory in the supervisor system message * @default true */ includeAgentsMemory?: boolean; /** * Additional custom guidelines for the supervisor agent */ customGuidelines?: string[]; /** * Configuration for forwarding events from subagents to the parent agent's full stream * Controls which event types are forwarded * @default { types: ['tool-call', 'tool-result', 'input-guardrail-blocked'] } */ fullStreamEventForwarding?: FullStreamEventForwardingConfig; /** * Whether to throw an exception when a subagent stream encounters an error * If true, stream errors will cause the handoff to throw an exception * If false, errors will be captured and returned in the result * @default false */ throwOnStreamError?: boolean; /** * Whether to include error message in the result when no text content was produced * Only applies when throwOnStreamError is false * If true, the error message will be included in the result field * If false, the result will be empty but status will still be 'error' * @default true */ includeErrorInEmptyResponse?: boolean; }; type GuardrailSeverity = "info" | "warning" | "critical"; type GuardrailAction = "allow" | "modify" | "block"; type InputGuardrailExecution = "blocking" | "parallel"; type InputGuardrailStreamPolicy = "holdUntilPass"; interface GuardrailBaseResult { pass: boolean; action?: GuardrailAction; message?: string; metadata?: Record; } interface OutputGuardrailStreamArgs extends GuardrailContext { part: VoltAgentTextStreamPart; streamParts: VoltAgentTextStreamPart[]; state: Record; abort: (reason?: string) => never; } type OutputGuardrailStreamResult = VoltAgentTextStreamPart | null | undefined | Promise; type OutputGuardrailStreamHandler = (args: OutputGuardrailStreamArgs) => OutputGuardrailStreamResult; type GuardrailFunctionMetadata = { guardrailId?: string; guardrailName?: string; guardrailDescription?: string; guardrailTags?: string[]; guardrailSeverity?: GuardrailSeverity; }; type GuardrailFunction = ((args: TArgs) => TResult | Promise) & GuardrailFunctionMetadata; interface GuardrailDefinition { id?: string; name?: string; description?: string; tags?: string[]; severity?: GuardrailSeverity; metadata?: Record; handler: GuardrailFunction; } interface AgentGuardrailState { id?: string; name: string; direction: "input" | "output"; description?: string; severity?: GuardrailSeverity; tags?: string[]; metadata?: Record | null; node_id: string; } interface AgentGuardrailStateGroup { input: AgentGuardrailState[]; output: AgentGuardrailState[]; } interface GuardrailContext { agent: Agent; context: OperationContext; operation: AgentEvalOperationType; } interface InputGuardrailArgs extends GuardrailContext { /** * The latest value after any previous guardrail modifications. */ input: string | UIMessage[] | BaseMessage[]; /** * Plain text representation of the latest input value. */ inputText: string; /** * The original user provided value before any guardrail modifications. */ originalInput: string | UIMessage[] | BaseMessage[]; /** * Plain text representation of the original input value. */ originalInputText: string; } interface InputGuardrailResult extends GuardrailBaseResult { modifiedInput?: string | UIMessage[] | BaseMessage[]; } interface InputGuardrailDefinition extends GuardrailDefinition { /** * Controls when the input guardrail runs. * * - `blocking` runs before the agent starts, preserving support for modified input. * - `parallel` starts with the agent stream and may only allow or block. */ execution?: InputGuardrailExecution; /** * Streaming policy for parallel input guardrails. * * `holdUntilPass` buffers model stream chunks until all parallel input guardrails pass. */ streamPolicy?: InputGuardrailStreamPolicy; } interface OutputGuardrailArgs extends GuardrailContext { /** * The latest value after any previous guardrail modifications. */ output: TOutput; /** * Optional plain text representation of the latest output value. */ outputText?: string; /** * The original value produced by the model before guardrail modifications. */ originalOutput: TOutput; /** * Optional plain text representation of the original output value. */ originalOutputText?: string; /** * Optional usage metrics for the generation. */ usage?: UsageInfo; /** * Optional finish reason from the model/provider. */ finishReason?: string | null; /** * Optional warnings or diagnostics returned by the provider. */ warnings?: unknown[] | null; } interface OutputGuardrailResult extends GuardrailBaseResult { modifiedOutput?: TOutput; } type InputGuardrail = GuardrailFunction | InputGuardrailDefinition; type OutputGuardrailFunction = GuardrailFunction, OutputGuardrailResult> & { guardrailStreamHandler?: OutputGuardrailStreamHandler; }; interface OutputGuardrailDefinition extends GuardrailDefinition, OutputGuardrailResult> { streamHandler?: OutputGuardrailStreamHandler; } type OutputGuardrail = OutputGuardrailFunction | OutputGuardrailDefinition; type MiddlewareDirection = "input" | "output"; type MiddlewareFunctionMetadata = { middlewareId?: string; middlewareName?: string; middlewareDescription?: string; middlewareTags?: string[]; }; type MiddlewareFunction = ((args: TArgs) => TResult | Promise) & MiddlewareFunctionMetadata; interface MiddlewareDefinition { id?: string; name?: string; description?: string; tags?: string[]; metadata?: Record; handler: MiddlewareFunction; } interface MiddlewareContext { agent: Agent; context: OperationContext; operation: AgentEvalOperationType; retryCount: number; } interface InputMiddlewareArgs extends MiddlewareContext { input: string | UIMessage[] | BaseMessage[]; originalInput: string | UIMessage[] | BaseMessage[]; abort: (reason?: string, options?: MiddlewareAbortOptions) => never; } type InputMiddlewareResult = string | UIMessage[] | BaseMessage[] | undefined; interface OutputMiddlewareArgs extends MiddlewareContext { output: TOutput; originalOutput: TOutput; usage?: UsageInfo; finishReason?: string | null; warnings?: unknown[] | null; abort: (reason?: string, options?: MiddlewareAbortOptions) => never; } type OutputMiddlewareResult = TOutput | undefined; type InputMiddleware = MiddlewareDefinition | MiddlewareFunction; type OutputMiddleware = MiddlewareDefinition, OutputMiddlewareResult> | MiddlewareFunction, OutputMiddlewareResult>; type AgentSummarizationOptions = { enabled?: boolean; triggerTokens?: number; keepMessages?: number; maxOutputTokens?: number; systemPrompt?: string | null; model?: AgentModelValue; }; type AgentConversationPersistenceMode = "finish" | "step"; type AgentConversationPersistenceOptions = { /** * `finish` persists only at operation completion. * `step` checkpoints after each step (debounced) and flushes on tool completion by default. * @default "step" */ mode?: AgentConversationPersistenceMode; /** * Debounce duration (ms) for step-level persistence scheduling. * @default 200 */ debounceMs?: number; /** * When true in `step` mode, tool-result/tool-error steps trigger an immediate flush. * @default true */ flushOnToolResult?: boolean; }; type AgentMessageMetadataPersistenceOptions = { /** * Persist resolved usage info under `message.metadata.usage`. */ usage?: boolean; /** * Persist the final finish reason under `message.metadata.finishReason`. */ finishReason?: boolean; }; type AgentMessageMetadataPersistenceConfig = boolean | AgentMessageMetadataPersistenceOptions; /** * Agent configuration options */ type AgentOptions = { id?: string; name: string; purpose?: string; model: AgentModelValue; instructions: InstructionsDynamicValue; tools?: (Tool | Toolkit | Tool$1)[] | DynamicValue<(Tool | Toolkit)[]>; toolkits?: Toolkit[]; toolRouting?: ToolRoutingConfig | false; workspace?: Workspace | WorkspaceConfig | false; workspaceToolkits?: WorkspaceToolkitOptions | false; /** * Controls automatic workspace skills prompt injection. * * - `undefined` (default): auto-inject when workspace skills are configured and no custom * `hooks.onPrepareMessages` is provided. * - `true`: force auto-injection with default prompt options. * - `false`: disable auto-injection. * - object: force auto-injection with custom prompt options. */ workspaceSkillsPrompt?: WorkspaceSkillsPromptOptions | boolean; memory?: Memory | false; summarization?: AgentSummarizationOptions | false; conversationPersistence?: AgentConversationPersistenceOptions; messageMetadataPersistence?: AgentMessageMetadataPersistenceConfig; retriever?: BaseRetriever; subAgents?: SubAgentConfig[]; supervisorConfig?: SupervisorConfig; maxHistoryEntries?: number; hooks?: AgentHooks; inputGuardrails?: InputGuardrail[]; outputGuardrails?: OutputGuardrail[]; inputMiddlewares?: InputMiddleware[]; outputMiddlewares?: OutputMiddleware[]; /** * Default retry count for middleware-triggered retries. * Per-call maxMiddlewareRetries overrides this value. */ maxMiddlewareRetries?: number; temperature?: number; maxOutputTokens?: number; maxSteps?: number; /** * Default retry count for model calls before falling back. * Overridden by per-model maxRetries or per-call maxRetries. */ maxRetries?: number; feedback?: AgentFeedbackOptions | boolean; /** * Default stop condition for step execution (ai-sdk `stopWhen`). * Per-call `stopWhen` in method options overrides this. */ stopWhen?: StopWhen; /** * Default step preparation callback (ai-sdk `prepareStep`). * Called before each step to control tool availability, tool choice, etc. * Per-call `prepareStep` in method options overrides this. * * @example * ```ts * prepareStep: ({ steps }) => (steps.length > 0 ? { toolChoice: 'none' } : {}), * ``` */ prepareStep?: PrepareStep; markdown?: boolean; /** * When true, use the active VoltAgent span as the parent if parentSpan is not provided. * Defaults to true. */ inheritParentSpan?: boolean; voice?: Voice; logger?: Logger; voltOpsClient?: VoltOpsClient; observability?: VoltAgentObservability; context?: ContextInput; eval?: AgentEvalConfig; }; type AgentEvalOperationType = "generateText" | "generateTitle" | "streamText" | "generateObject" | "streamObject" | "workflow"; interface AgentEvalToolCall extends Record { toolCallId?: string; toolName?: string; arguments?: Record | null; content?: string; stepIndex?: number; usage?: UsageInfo | null; subAgentId?: string; subAgentName?: string; } interface AgentEvalToolResult extends Record { toolCallId?: string; toolName?: string; result?: unknown; content?: string; stepIndex?: number; usage?: UsageInfo | null; subAgentId?: string; subAgentName?: string; isError?: boolean; error?: unknown; } interface AgentEvalPayload { operationId: string; operationType: AgentEvalOperationType; input?: string | null; output?: string | null; rawInput?: string | UIMessage[] | BaseMessage[]; rawOutput?: unknown; /** * Full message/step chain available to scorers. * Includes normalized input messages (when available) plus execution steps * such as `text`, `tool_call`, and `tool_result`. */ messages?: StepWithContent[]; /** * Tool-call events captured during execution. * If provider-native tool call payloads are available they are preserved. */ toolCalls?: AgentEvalToolCall[]; /** * Tool-result events captured during execution. * If provider-native tool result payloads are available they are preserved. */ toolResults?: AgentEvalToolResult[]; userId?: string; conversationId?: string; traceId: string; spanId: string; metadata?: Record; } type AgentEvalContext = AgentEvalPayload & Record & { agentId: string; agentName: string; timestamp: string; rawPayload: AgentEvalPayload; }; type AgentEvalParams = Record; type AgentEvalSamplingPolicy = SamplingPolicy; type AgentEvalScorerFactory = () => LocalScorerDefinition> | Promise>>; type AgentEvalScorerReference = LocalScorerDefinition> | AgentEvalScorerFactory; interface AgentEvalResult { scorerId: string; scorerName?: string; status: "success" | "error" | "skipped"; score?: number | null; metadata?: Record | null; error?: unknown; durationMs?: number; payload: AgentEvalPayload; rawPayload: AgentEvalPayload; } type AgentEvalFeedbackSaveInput = Omit & { traceId?: string; }; type AgentEvalFeedbackHelper = { save: (input: AgentEvalFeedbackSaveInput) => Promise; }; type AgentEvalResultCallbackArgs = AgentEvalResult & { result: AgentEvalResult; feedback: AgentEvalFeedbackHelper; }; interface AgentEvalScorerConfig { scorer: AgentEvalScorerReference; params?: AgentEvalParams | ((context: AgentEvalContext) => AgentEvalParams | undefined | Promise); sampling?: AgentEvalSamplingPolicy; id?: string; onResult?: (result: AgentEvalResultCallbackArgs) => void | Promise; buildPayload?: (context: AgentEvalContext) => Record | Promise>; buildParams?: (context: AgentEvalContext) => AgentEvalParams | undefined | Promise; } interface AgentEvalConfig { scorers: Record; triggerSource?: string; environment?: string; sampling?: AgentEvalSamplingPolicy; redact?: (payload: AgentEvalPayload) => AgentEvalPayload; } /** * Common generate options - internal version that includes historyEntryId * Not exposed directly to users */ interface CommonSemanticMemoryOptions { enabled?: boolean; semanticLimit?: number; semanticThreshold?: number; mergeStrategy?: "prepend" | "append" | "interleave"; } interface CommonRuntimeMemoryBehaviorOptions { contextLimit?: number; semanticMemory?: CommonSemanticMemoryOptions; conversationPersistence?: AgentConversationPersistenceOptions; messageMetadataPersistence?: AgentMessageMetadataPersistenceConfig; /** * When true, memory is read-only for the current call. * Existing memory context can be loaded, but no writes are persisted. */ readOnly?: boolean; } interface CommonRuntimeMemoryEnvelope { conversationId?: string; userId?: string; options?: CommonRuntimeMemoryBehaviorOptions; } type SemanticMemoryOptions = CommonSemanticMemoryOptions; type RuntimeMemoryEnvelope = CommonRuntimeMemoryEnvelope; interface CommonResolvedRuntimeMemoryOptions { userId?: string; conversationId?: string; contextLimit?: number; semanticMemory?: CommonSemanticMemoryOptions; conversationPersistence?: AgentConversationPersistenceOptions; messageMetadataPersistence?: AgentMessageMetadataPersistenceOptions; readOnly?: boolean; } /** * Agent status information */ type AgentStatus = "idle" | "working" | "error" | "completed" | "cancelled"; /** * Tool call definition */ type ToolCall$1 = { id: string; type: "function"; function: { name: string; arguments: string; }; }; /** * Model tool call format */ type ModelToolCall = { type: "tool-call"; toolCallId: string; toolName: string; args: Record; }; /** * Represents the payload used when sending a tool's result back to the chat runtime * via useChat().addToolResult in the Vercel AI SDK. */ type ClientSideToolResult = { tool: string; toolCallId: string; output: unknown; } | { tool: string; toolCallId: string; state: "output-error"; errorText: string; }; /** * Agent response format */ type AgentResponse = { /** * Response content */ content: string; /** * Tool calls made by the model (if any) */ toolCalls?: ToolCall$1[]; /** * Additional metadata */ metadata: { agentId: string; agentName: string; [key: string]: unknown; }; }; /** * Context for a specific agent operation (e.g., one generateText call) */ type OperationContext = { /** Unique identifier for the operation */ readonly operationId: string; /** Optional user identifier associated with this operation */ userId?: string; /** Optional conversation identifier associated with this operation */ conversationId?: string; /** Resolved runtime memory options (memory envelope preferred, legacy as fallback) */ resolvedMemory?: CommonResolvedRuntimeMemoryOptions; /** Workspace configured on the executing agent (if any). */ workspace?: Workspace; /** User-managed context map for this operation */ readonly context: Map; /** HTTP request headers associated with this operation, when available */ readonly requestHeaders?: Record; /** System-managed context map for internal operation tracking */ readonly systemContext: Map; /** Whether this operation is still active */ isActive: boolean; /** Parent agent ID if part of a delegation chain */ parentAgentId?: string; /** Optional elicitation bridge for requesting user input */ elicitation?: (request: unknown) => Promise; /** Trace context for managing span hierarchy and common attributes */ traceContext: AgentTraceContext; /** Execution-scoped logger with full context (userId, conversationId, executionId) */ logger: Logger; /** Conversation steps for building full message history including tool calls/results */ conversationSteps?: StepWithContent[]; /** AbortController for cancelling the operation and accessing the signal */ abortController: AbortController; /** Start time of the operation (Date object) */ startTime: Date; /** Cancellation error to be thrown when operation is aborted */ cancellationError?: CancellationError; /** Input provided to the agent operation (string, UIMessages, or BaseMessages) */ input?: string | UIMessage[] | BaseMessage[]; /** Output generated by the agent operation (text or object) */ output?: string | object; }; /** * Specific information related to a tool execution error. */ interface ToolErrorInfo { /** The unique identifier of the tool call. */ toolCallId: string; /** The name of the tool that was executed. */ toolName: string; /** The original error thrown directly by the tool during execution (if available). */ toolExecutionError?: unknown; /** The arguments passed to the tool when the error occurred (for debugging). */ toolArguments?: unknown; } /** * Type for onError callbacks in streaming operations. * Providers must pass an error conforming to the VoltAgentError structure. */ type StreamOnErrorCallback = (error: VoltAgentError) => Promise | void; type UserContext = Map; /** * Standardized object structure passed to the onFinish callback * when streamText completes successfully. */ interface StreamTextFinishResult { /** The final, consolidated text output from the stream. */ text: string; /** Token usage information (if available). */ usage?: UsageInfo; /** Feedback metadata for the trace, if enabled. */ feedback?: AgentFeedbackMetadata | null; /** The reason the stream finished (if available, e.g., 'stop', 'length', 'tool-calls'). */ finishReason?: string; /** The original completion response object from the provider (if available). */ providerResponse?: unknown; /** Any warnings generated during the completion (if available). */ warnings?: unknown[]; /** User context containing any custom metadata from the operation. */ context?: UserContext; } /** * Type for the onFinish callback function for streamText. */ type StreamTextOnFinishCallback = (result: StreamTextFinishResult) => Promise | void; /** * Standardized object structure passed to the onFinish callback * when streamObject completes successfully. * @template TObject The expected type of the fully formed object. */ interface StreamObjectFinishResult { /** The final, fully formed object from the stream. */ object: TObject; /** Token usage information (if available). */ usage?: UsageInfo; /** The original completion response object from the provider (if available). */ providerResponse?: unknown; /** Any warnings generated during the completion (if available). */ warnings?: unknown[]; /** The reason the stream finished (if available). Although less common for object streams. */ finishReason?: string; /** User context containing any custom metadata from the operation. */ context?: UserContext; } /** * Type for the onFinish callback function for streamObject. * @template TObject The expected type of the fully formed object. */ type StreamObjectOnFinishCallback = (result: StreamObjectFinishResult) => Promise | void; /** * Standardized success result structure for generateText. */ interface StandardizedTextResult { /** The generated text. */ text: string; /** Token usage information (if available). */ usage?: UsageInfo; /** Feedback metadata for the trace, if enabled. */ feedback?: AgentFeedbackMetadata | null; /** Original provider response (if needed). */ providerResponse?: unknown; /** Finish reason (if available from provider). */ finishReason?: string; /** Warnings (if available from provider). */ warnings?: unknown[]; /** User context containing any custom metadata from the operation. */ context?: UserContext; } /** * Standardized success result structure for generateObject. * @template TObject The expected type of the generated object. */ interface StandardizedObjectResult { /** The generated object. */ object: TObject; /** Token usage information (if available). */ usage?: UsageInfo; /** Original provider response (if needed). */ providerResponse?: unknown; /** Finish reason (if available from provider). */ finishReason?: string; /** Warnings (if available from provider). */ warnings?: unknown[]; /** User context containing any custom metadata from the operation. */ context?: UserContext; } /** * Unified output type for the onEnd hook, representing the successful result * of any core agent operation. Use 'type guarding' or check specific fields * within the hook implementation to determine the concrete type. * Object types are generalized to 'unknown' here for the union. */ type AgentOperationOutput = StandardizedTextResult | StreamTextFinishResult | StandardizedObjectResult | StreamObjectFinishResult; /** * Custom error classes for Memory V2 */ /** * Base error class for Memory V2 */ declare class MemoryV2Error extends Error { readonly code: string; readonly details?: Record | undefined; constructor(message: string, code: string, details?: Record | undefined); } /** * Error thrown when a storage operation fails */ declare class StorageError extends MemoryV2Error { constructor(message: string, details?: Record); } /** * Error thrown when an embedding operation fails */ declare class EmbeddingError extends MemoryV2Error { constructor(message: string, details?: Record); } /** * Error thrown when a vector operation fails */ declare class VectorError extends MemoryV2Error { constructor(message: string, details?: Record); } /** * Error thrown when a conversation is not found */ declare class ConversationNotFoundError extends MemoryV2Error { constructor(conversationId: string); } /** * Error thrown when trying to create a conversation that already exists */ declare class ConversationAlreadyExistsError extends MemoryV2Error { constructor(conversationId: string); } /** * Error thrown when vector adapter is required but not configured */ declare class VectorAdapterNotConfiguredError extends MemoryV2Error { constructor(operation: string); } /** * Error thrown when embedding adapter is required but not configured */ declare class EmbeddingAdapterNotConfiguredError extends MemoryV2Error { constructor(operation: string); } /** * Vector math utilities for similarity calculations */ /** * Calculate cosine similarity between two vectors * Returns a value between -1 and 1, where 1 means identical direction, * 0 means perpendicular, and -1 means opposite direction */ declare function cosineSimilarity(a: number[], b: number[]): number; /** * Memory - Clean architecture for conversation memory and state management */ /** * Memory Class * Handles conversation memory with optional vector search capabilities */ declare class Memory { private readonly storage; private readonly embedding?; private readonly vector?; private embeddingCache?; private readonly workingMemoryConfig?; private readonly titleGenerationConfig?; private resourceId?; private logger?; constructor(options: MemoryConfig); /** * Get messages from a conversation */ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, context?: OperationContext): Promise[]>; /** * Save a single message */ saveMessage(message: UIMessage, userId: string, conversationId: string): Promise; saveConversationSteps(steps: ConversationStepRecord[]): Promise; /** * Add a single message (alias for consistency with existing API) */ addMessage(message: UIMessage, userId: string, conversationId: string, context?: OperationContext): Promise; /** * Add multiple messages in batch */ addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise; /** * Clear messages for a user */ clearMessages(userId: string, conversationId?: string, context?: OperationContext): Promise; /** * Delete specific messages by ID for a conversation * Adapters should delete atomically when possible; otherwise a best-effort delete may be used. */ deleteMessages(messageIds: string[], userId: string, conversationId: string, context?: OperationContext): Promise; getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise; /** * Get a conversation by ID */ getConversation(id: string): Promise; /** * Get conversations for a resource */ getConversations(resourceId: string): Promise; /** * Get conversations by user ID with query options */ getConversationsByUserId(userId: string, options?: Omit): Promise; /** * Query conversations with advanced options */ queryConversations(options: ConversationQueryOptions): Promise; /** * Count conversations with the same filtering as queryConversations (ignores limit/offset) */ countConversations(options: ConversationQueryOptions): Promise; /** * Create a new conversation */ createConversation(input: CreateConversationInput): Promise; /** * Update a conversation */ updateConversation(id: string, updates: Partial>): Promise; /** * Delete a conversation */ deleteConversation(id: string): Promise; /** * Get messages with semantic search * Combines recent messages with semantically similar messages */ getMessagesWithSemanticSearch(userId: string, conversationId: string, currentQuery?: string, options?: { limit?: number; semanticLimit?: number; semanticThreshold?: number; mergeStrategy?: "prepend" | "append" | "interleave"; }): Promise[]>; /** * Get messages by their IDs */ private getMessagesByIds; private getMessageVectorIdsForClear; /** * Merge two arrays of messages, removing duplicates */ private mergeMessages; /** * Check if vector support is configured */ hasVectorSupport(): boolean; /** * Search for similar content */ searchSimilar(query: string, options?: SearchOptions): Promise; /** * Add a document for RAG */ addDocument(document: Document): Promise; /** * Remove a document */ removeDocument(id: string): Promise; /** * Get embedding with caching */ private getEmbedding; /** * Embed and store a message */ private embedAndStoreMessage; /** * Embed and store multiple messages */ private embedAndStoreMessages; /** * Get working memory for a conversation or user */ getWorkingMemory(params: { conversationId?: string; userId?: string; }): Promise; /** * Update working memory (simplified) */ updateWorkingMemory(params: { conversationId?: string; userId?: string; content: string | Record; options?: WorkingMemoryUpdateOptions; }): Promise; /** * Process content to string format */ private processContent; /** * Simple deep merge for JSON objects */ private simpleDeepMerge; /** * Clear working memory */ clearWorkingMemory(params: { conversationId?: string; userId?: string; }): Promise; /** * Get working memory template */ getWorkingMemoryTemplate(): string | null; /** * Get working memory schema */ getWorkingMemorySchema(): z.ZodObject | null; /** * Get working memory format */ getWorkingMemoryFormat(): "markdown" | "json" | null; /** * Check if working memory is supported */ hasWorkingMemorySupport(): boolean; /** * Generate system instructions for working memory usage */ getWorkingMemoryInstructions(params: { conversationId?: string; userId?: string; }): Promise; /** * Get configured adapters info */ getAdaptersInfo(): { storage: boolean; embedding: { configured: boolean; model?: string; dimensions?: number; }; vector: boolean; cache: boolean; }; /** * Save a message to memory * Simple version without event publishing (handled by MemoryManagerV2) */ saveMessageWithContext(message: UIMessage, userId: string, conversationId: string, context?: { logger?: Logger; }, operationContext?: OperationContext): Promise; /** * Get messages with semantic search support * Simple version without event publishing (handled by MemoryManagerV2) */ getMessagesWithContext(userId: string, conversationId: string, options?: { limit?: number; useSemanticSearch?: boolean; currentQuery?: string; traceId?: string; logger?: Logger; semanticLimit?: number; semanticThreshold?: number; mergeStrategy?: "prepend" | "append" | "interleave"; }, operationContext?: OperationContext): Promise[]>; /** * Internal: Set resource ID (agent ID) */ _setResourceId(id: string): void; /** * Internal: Set logger */ _setLogger(logger: Logger): void; /** * Get vector adapter if configured */ getVectorAdapter(): VectorAdapter | undefined; /** * Get embedding adapter if configured */ getEmbeddingAdapter(): EmbeddingAdapter | undefined; /** * Get metadata about the configured storage adapter */ getStorageMetadata(): MemoryStorageMetadata; /** * Get conversation title generation configuration */ getTitleGenerationConfig(): MemoryConfig["generateTitle"] | undefined; /** * Get a UI-friendly summary of working memory configuration */ getWorkingMemorySummary(): WorkingMemorySummary | null; /** * Get workflow state by execution ID */ getWorkflowState(executionId: string): Promise; /** * Query workflow states with filters */ queryWorkflowRuns(query: WorkflowRunQuery): Promise; /** * Set workflow state */ setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise; /** * Update workflow state */ updateWorkflowState(executionId: string, updates: Partial): Promise; /** * Get suspended workflow states for a workflow */ getSuspendedWorkflowStates(workflowId: string): Promise; } /** * MemoryManager - Unified manager for Memory and OpenTelemetry observability * Preserves all existing logging and business logic */ /** * MemoryManager - Simplified version for conversation management only * Uses Memory for conversations */ declare class MemoryManager { /** * Memory instance for conversations */ private conversationMemory; /** * The ID of the resource (agent) that owns this memory manager */ private resourceId; /** * Memory configuration options */ private options; /** * Logger instance */ private logger; /** * Background queue for memory operations */ private backgroundQueue; /** * Optional title generator for new conversations */ private titleGenerator?; /** * Creates a new MemoryManager V2 with same signature as original */ constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions, logger?: Logger, titleGenerator?: ConversationTitleGenerator); /** * Save a message to memory * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION */ saveMessage(context: OperationContext, message: UIMessage, userId?: string, conversationId?: string): Promise; private applyOperationMetadata; saveConversationSteps(context: OperationContext, steps: ConversationStepRecord[], userId?: string, conversationId?: string): Promise; /** * Get messages from memory with proper logging * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION */ getMessages(context: OperationContext, userId?: string, conversationId?: string, limit?: number, options?: { useSemanticSearch?: boolean; currentQuery?: string; semanticLimit?: number; semanticThreshold?: number; mergeStrategy?: "prepend" | "append" | "interleave"; traceContext?: AgentTraceContext; parentMemorySpan?: Span; }): Promise[]>; /** * Search messages semantically * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION */ searchMessages(context: OperationContext, _query: string, userId?: string, conversationId?: string, limit?: number): Promise[]>; /** * Clear messages from memory * PRESERVED FROM ORIGINAL WITH MEMORY V2 INTEGRATION */ clearMessages(context: OperationContext, userId?: string, conversationId?: string): Promise; /** * Prepare conversation context for message generation (CONTEXT-FIRST OPTIMIZED) * Ensures context is always loaded, optimizes non-critical operations in background * PRESERVED FROM ORIGINAL */ prepareConversationContext(context: OperationContext, input: string | UIMessage[], userId?: string, conversationIdParam?: string, contextLimit?: number, options?: { persistInput?: boolean; }): Promise<{ messages: UIMessage<{ createdAt: Date; }>[]; conversationId: string; }>; /** * Handle sequential background operations using the queue * Setup conversation and save input in a single atomic operation * PRESERVED FROM ORIGINAL */ private handleSequentialBackgroundOperations; /** * Public: Enqueue saving current input in the background. * Ensures conversation exists and then saves input without blocking. */ queueSaveInput(context: OperationContext, input: string | UIMessage[], userId: string, conversationId: string): void; /** * Resolve conversation title using optional generator */ private resolveConversationTitle; /** * Ensure conversation exists (background task) * PRESERVED FROM ORIGINAL */ private isConversationAlreadyExistsError; private ensureConversationExists; /** * Save current input (background task) * PRESERVED FROM ORIGINAL */ private saveCurrentInput; /** * Check if conversation memory is enabled */ hasConversationMemory(): boolean; /** * Get options */ getOptions(): MemoryOptions; /** * Get memory state for display in UI */ getMemoryState(): Record; /** * Get the Memory V2 instance (for direct access if needed) */ getMemory(): Memory | undefined; /** * Replace the Memory instance used for this manager. */ setMemory(memory: Memory | false, titleGenerator?: ConversationTitleGenerator): void; /** * Get working memory content */ getWorkingMemory(params: { conversationId?: string; userId?: string; }): Promise; /** * Update working memory content */ updateWorkingMemory(params: { conversationId?: string; userId?: string; content: string | Record; }): Promise; /** * Clear working memory */ clearWorkingMemory(params: { conversationId?: string; userId?: string; }): Promise; /** * Check if working memory is supported */ hasWorkingMemorySupport(): boolean; /** * Get working memory configuration */ getWorkingMemoryConfig(): { template?: string | null; schema?: any | null; format?: "markdown" | "json" | null; }; /** * Get working memory instructions */ getWorkingMemoryInstructions(params: { conversationId?: string; userId?: string; }): Promise; /** * Perform semantic search with proper span hierarchy * Extracted from getMessages for clarity */ private performSemanticSearch; /** * Shutdown the memory manager */ shutdown(): Promise; } type OutputSpec$1 = Output.Output; type OutputValue = InferGenerateOutput; /** * Context input type that accepts both Map and plain object */ type ContextInput = Map | Record; /** * Agent context with comprehensive tracking */ /** * Extended StreamTextResult that includes context */ type StreamTextResultWithContext, OUTPUT = unknown> = { readonly text: StreamTextResult["text"]; readonly textStream: StreamTextResult["textStream"]; readonly fullStream: AsyncIterable>; readonly usage: StreamTextResult["usage"]; readonly finishReason: StreamTextResult["finishReason"]; readonly partialOutputStream?: StreamTextResult["partialOutputStream"]; toUIMessageStream: StreamTextResult["toUIMessageStream"]; toUIMessageStreamResponse: StreamTextResult["toUIMessageStreamResponse"]; pipeUIMessageStreamToResponse: StreamTextResult["pipeUIMessageStreamToResponse"]; pipeTextStreamToResponse: StreamTextResult["pipeTextStreamToResponse"]; toTextStreamResponse: StreamTextResult["toTextStreamResponse"]; context: Map; feedback?: AgentFeedbackHandle | null; } & Record; /** * Extended StreamObjectResult that includes context */ interface StreamObjectResultWithContext { readonly object: Promise; readonly partialObjectStream: ReadableStream>; readonly textStream: AsyncIterableStream$1; readonly warnings: Promise; readonly usage: Promise; readonly finishReason: Promise; pipeTextStreamToResponse(response: any, init?: ResponseInit): void; toTextStreamResponse(init?: ResponseInit): Response; context: Map; } /** * Extended GenerateTextResult that includes context */ type BaseGenerateTextResult> = Omit, "experimental_output" | "output"> & { experimental_output: unknown; output: unknown; }; interface GenerateTextResultWithContext, OUTPUT extends OutputSpec$1 = OutputSpec$1> extends BaseGenerateTextResult { context: Map; experimental_output: OutputValue; output: OutputValue; feedback?: AgentFeedbackHandle | null; } /** * Extended GenerateObjectResult that includes context */ interface GenerateObjectResultWithContext extends GenerateObjectResult { context: Map; } /** * Base options for all generation methods * Extends AI SDK's CallSettings for full compatibility */ interface BaseGenerationOptions extends Partial { /** * Runtime memory envelope for per-call memory identity and behavior overrides. */ memory?: RuntimeMemoryEnvelope; /** * @deprecated Use `memory.userId` instead. */ userId?: string; /** * @deprecated Use `memory.conversationId` instead. */ conversationId?: string; context?: ContextInput; /** * HTTP request headers associated with this call. * * Server adapters populate this from the incoming request and expose it to * dynamic `model`, `instructions`, and `tools` callbacks as `headers`. * This is separate from AI SDK/provider `headers`. */ requestHeaders?: Record; elicitation?: (request: unknown) => Promise; parentAgentId?: string; parentOperationContext?: OperationContext; parentSpan?: Span; inheritParentSpan?: boolean; /** * @deprecated Use `memory.options.contextLimit` instead. */ contextLimit?: number; /** * @deprecated Use `memory.options.semanticMemory` instead. */ semanticMemory?: SemanticMemoryOptions; /** * @deprecated Use `memory.options.conversationPersistence` instead. */ conversationPersistence?: AgentConversationPersistenceOptions; /** * @deprecated Use `memory.options.messageMetadataPersistence` instead. */ messageMetadataPersistence?: AgentMessageMetadataPersistenceConfig; maxSteps?: number; feedback?: boolean | AgentFeedbackOptions; /** * Custom stop condition for ai-sdk step execution. * When provided, this overrides VoltAgent's default `stepCountIs(maxSteps)`. * Use with care: incorrect predicates can cause early termination or * unbounded loops depending on provider behavior and tool usage. */ stopWhen?: StopWhen; tools?: (Tool | Toolkit)[]; /** * Optional per-call tool routing override. */ toolRouting?: ToolRoutingConfig | false; hooks?: AgentHooks; inputGuardrails?: InputGuardrail[]; outputGuardrails?: OutputGuardrail[]; inputMiddlewares?: InputMiddleware[]; outputMiddlewares?: OutputMiddleware[]; maxMiddlewareRetries?: number; providerOptions?: TProviderOptions; output?: OutputSpec$1; /** * Optional explicit stop sequences to pass through to the underlying provider. * Mirrors the `stop` option supported by ai-sdk `generateText/streamText`. */ stop?: string | string[]; /** * Tool choice strategy for AI SDK calls. */ toolChoice?: ToolChoice>; /** * Step preparation callback (ai-sdk `prepareStep`). * Called before each step to control tool availability, tool choice, etc. * Overrides the agent-level `prepareStep` if provided. */ prepareStep?: PrepareStep; } type GenerateTextOptions = Omit, "output"> & { output?: OUTPUT; }; type StreamTextOptions = BaseGenerationOptions & { onFinish?: (result: any) => void | Promise; /** * When true, avoids wiring the HTTP abort signal into the stream so clients can resume later. * Use with a resumable stream store to prevent orphaned streams. */ resumableStream?: boolean; }; type GenerateObjectOptions = BaseGenerationOptions; type StreamObjectOptions = BaseGenerationOptions & { onFinish?: (result: any) => void | Promise; }; declare class Agent { readonly id: string; readonly name: string; readonly purpose?: string; readonly instructions: InstructionsDynamicValue; readonly model: AgentModelValue; readonly dynamicTools?: DynamicValue<(Tool | Toolkit)[]>; hooks: AgentHooks; readonly temperature?: number; readonly maxOutputTokens?: number; maxSteps: number; readonly maxRetries: number; readonly stopWhen?: StopWhen; readonly prepareStep?: PrepareStep; readonly markdown: boolean; readonly inheritParentSpan: boolean; readonly voice?: Voice; readonly retriever?: BaseRetriever; readonly supervisorConfig?: SupervisorConfig; private readonly context?; private readonly logger; private readonly memoryManager; private readonly memory?; private readonly memoryConfigured; private readonly summarization?; private conversationPersistence; private readonly messageMetadataPersistence; private conversationPersistenceConfigured; private workspace?; private readonly workspaceConfigured; private readonly workspaceToolkitOptions; private readonly workspaceSkillsPromptOption; private readonly configuredHooks?; private readonly maxStepsConfigured; private defaultObservability?; private readonly toolManager; private readonly toolPoolManager; private readonly subAgentManager; private readonly voltOpsClient?; private readonly prompts?; private readonly evalConfig?; private readonly feedbackOptions?; private readonly inputGuardrails; private readonly outputGuardrails; private readonly inputMiddlewares; private readonly outputMiddlewares; private readonly maxMiddlewareRetries; private readonly observabilityAuthWarningState; private toolRouting?; private toolRoutingConfigured; private toolRoutingExposedNames; private toolRoutingPoolExplicit; private toolRoutingSearchStrategy?; constructor(options: AgentOptions); /** * Generate text response */ generateText(input: string | UIMessage[] | BaseMessage[], options?: GenerateTextOptions): Promise>; /** * Stream text response */ streamText(input: string | UIMessage[] | BaseMessage[], options?: StreamTextOptions): Promise; /** * Generate structured object * @deprecated — Use generateText with an output setting instead. */ generateObject(input: string | UIMessage[] | BaseMessage[], schema: T, options?: GenerateObjectOptions): Promise>>; /** * Stream structured object * @deprecated — Use streamText with an output setting instead. */ streamObject(input: string | UIMessage[] | BaseMessage[], schema: T, options?: StreamObjectOptions): Promise>>; private resolveGuardrailSets; private resolveMiddlewareSets; private resolveMiddlewareRetries; private storeMiddlewareRetryFeedback; private consumeMiddlewareRetryFeedback; private shouldRetryMiddleware; /** * Common preparation for all execution methods */ private prepareExecution; private collectToolDataFromResult; private ensureStructuredOutputGenerated; /** * Create execution context */ private normalizeConversationPersistenceOptions; private normalizeMessageMetadataPersistenceOptions; private resolveConversationPersistenceOptions; private resolveMemoryRuntimeOptions; private getConversationPersistenceOptionsForContext; private getMessageMetadataPersistenceOptionsForContext; private buildPersistedAssistantMessageMetadata; private applyMetadataToLastAssistantMessage; private applyMetadataToMessage; /** * Create only the OperationContext (sync) * Transitional helper to gradually adopt OperationContext across methods */ private createOperationContext; private resetOperationAttemptState; private getConversationBuffer; private getMemoryPersistQueue; private isReadOnlyMemoryForContext; private shouldPersistMemoryForContext; private ensureStreamingResponseMessageId; private getOrCreateStepResponseMessageId; private getStepResponseMessageFingerprints; private normalizeStepResponseMessages; private flushPendingMessagesOnError; /** * Get contextual logger with parent tracking */ private getContextualLogger; /** * Calculate delegation depth */ private calculateDelegationDepth; private enqueueEvalScoring; private createLLMSpan; private createLLMSpanFinalizer; private buildLLMSpanAttributes; private recordLLMUsage; private recordProviderCost; private createEvalHost; /** * Get observability instance (lazy initialization) */ /** * Get observability instance - checks global registry on every call * This ensures agents can use global observability when available * but still work standalone with their own instance */ private getObservability; private resolveFeedbackOptions; private getFeedbackTraceId; private getFeedbackClient; private createFeedbackMetadata; /** * Check if semantic search is supported */ private hasSemanticSearchSupport; /** * Extract user query from input for semantic search */ private extractUserQuery; private createConversationTitleGenerator; /** * Prepare messages with system prompt and memory */ private prepareMessages; private validateIncomingUIMessages; private queueSaveInputWhenSpeculativeInputGuardrailPasses; /** * Get system message with dynamic instructions and retriever context */ private getSystemMessage; /** * Add toolkit instructions */ private addToolkitInstructions; /** * Enrich instructions with additional context and modifiers */ private enrichInstructions; private extractToolkits; /** * Prepare agents memory for supervisor */ private prepareAgentsMemory; /** * Get retriever context */ private getRetrieverContext; private getRetrieverObservabilityAttributes; /** * Resolve dynamic value */ private resolveValue; private getModelCandidates; private resolveModelReference; /** * Resolve agent model value (LanguageModel or provider/model string) */ private resolveModel; private resolveCallMaxRetries; private shouldFallbackOnError; private isRetryableError; private executeWithModelFallback; private probeStreamStart; private cloneResultWithFullStream; private withProbedFullStream; private usesGetterBasedTeeingFullStream; private findPropertyDescriptor; private toAsyncIterableStream; private discardStream; /** * Prepare tools with execution context */ private prepareTools; /** * Validate tool output against optional output schema. */ private validateToolOutput; private createToolExecutionFactory; private getToolRoutingSupportToolNames; private isToolRoutingSupportTool; private isToolExecutableForRouting; private getToolRoutingFromContext; private getToolSearchStrategy; private buildToolSearchCandidates; private rankToolSearchCandidates; private selectToolSearchCandidates; private toToolSearchResultItem; private recordSearchedTools; private getSearchedTools; private createToolRoutingSearchTool; private createToolRoutingCallTool; private executeProviderToolViaCallTool; private ensureToolApproval; private runInternalGenerateText; private getSpeculativeInputGuardrail; private waitForSpeculativeInputGuardrail; /** * Create step handler for memory and hooks */ private createStepHandler; private processStepContent; private resolveBailedResultFromToolOutput; private recordStepResults; /** * Add step to history - now only tracks in conversation steps */ private addStepToHistory; /** * Merge agent hooks with options hooks */ private getMergedHooks; /** * Setup abort signal listener */ private setupAbortSignalListener; /** * Handle errors */ private handleError; /** * Calculate max steps based on SubAgents */ private calculateMaxSteps; /** * Get the model name. * Pass a resolved model to return its modelId (useful for dynamic models). */ getModelName(model?: LanguageModel | string): string; /** * Get full agent state */ getFullState(): AgentFullState; /** * Add tools or toolkits to the agent */ addTools(tools: (Tool | Toolkit | Tool$1)[]): { added: (Tool | Toolkit | Tool$1)[]; }; /** * Remove one or more tools by name * @param toolNames - Array of tool names to remove * @returns Object containing successfully removed tool names */ removeTools(toolNames: string[]): { removed: string[]; }; /** * Remove a toolkit by name * @param toolkitName - Name of the toolkit to remove * @returns true if the toolkit was removed, false if it wasn't found */ removeToolkit(toolkitName: string): boolean; /** * Add a sub-agent */ addSubAgent(agentConfig: SubAgentConfig): void; /** * Remove a sub-agent */ removeSubAgent(agentId: string): void; /** * Get all tools */ getTools(): BaseTool[]; /** * Get tools for API */ getToolsForApi(): ApiToolInfo[]; /** * Get all sub-agents */ getSubAgents(): SubAgentConfig[]; /** * Unregister this agent */ unregister(): void; /** * Check if telemetry is configured * Returns true if VoltOpsClient with observability is configured */ isTelemetryConfigured(): boolean; /** * Check whether feedback has already been provided for a feedback metadata object. */ static isFeedbackProvided(feedback?: AgentFeedbackMetadata | null): boolean; /** * Check whether a message already has feedback marked as provided. */ static isMessageFeedbackProvided(message?: UIMessage | null): boolean; /** * Persist a "feedback provided" marker into assistant message metadata. */ markFeedbackProvided(input: AgentMarkFeedbackProvidedInput): Promise; /** * Get memory manager */ getMemoryManager(): MemoryManager; /** * Get tool manager */ getToolManager(): ToolManager; /** * Get Workspace instance if configured */ getWorkspace(): Workspace | undefined; /** * Get Memory instance if available */ getMemory(): Memory | false | undefined; /** * Internal: apply a default Memory instance when none was configured explicitly. */ __setDefaultMemory(memory: Memory): void; /** * Internal: apply default conversation persistence when none was configured explicitly. */ __setDefaultConversationPersistence(conversationPersistence: AgentConversationPersistenceOptions): void; /** * Internal: apply a default Workspace instance when none was configured explicitly. */ __setDefaultWorkspace(workspace: Workspace): void; /** * Internal: apply a default tool routing config when none was configured explicitly. */ __setDefaultToolRouting(toolRouting?: ToolRoutingConfig): void; private applyToolRoutingConfig; private removeToolRoutingSupportTools; private upsertToolRoutingSupportTool; private assertNoToolRoutingNameConflicts; private resolveToolRouting; private getToolRoutingExposedNames; /** * Convert this agent into a tool that can be used by other agents. * This enables supervisor/coordinator patterns where one agent can delegate * work to other specialized agents. * * @param options - Optional configuration for the tool * @param options.name - Custom name for the tool (defaults to `${agent.id}_tool`) * @param options.description - Custom description (defaults to agent's purpose or auto-generated) * @param options.parametersSchema - Custom input schema (defaults to { prompt: string }) * * @returns A Tool instance that executes this agent * * @example * ```typescript * const writerAgent = new Agent({ * id: "writer", * purpose: "Writes blog posts", * // ... other config * }); * * const editorAgent = new Agent({ * id: "editor", * purpose: "Edits content", * // ... other config * }); * * // Supervisor agent that uses both as tools * const supervisorAgent = new Agent({ * id: "supervisor", * instructions: "First call writer, then editor", * tools: [ * writerAgent.toTool(), * editorAgent.toTool() * ] * }); * ``` */ toTool(options?: { name?: string; description?: string; parametersSchema?: z.ZodObject; }): Tool; /** * Check if working memory is supported */ private hasWorkingMemorySupport; /** * Set usage information on trace context * Maps AI SDK's LanguageModelUsage to trace context format */ private setTraceContextUsage; private recordRootSpanUsageAndProviderCost; /** * Create working memory tools if configured */ private createWorkingMemoryTools; } /** * WorkflowTraceContext - Manages trace hierarchy and common attributes for workflows * * Similar to AgentTraceContext but tailored for workflow execution: * 1. Common attributes (workflowId, executionId, userId, etc.) are set once and inherited * 2. Parent-child span relationships for workflow steps * 3. Support for parallel step execution * 4. Suspend/resume state tracking * 5. Clean integration with VoltAgentObservability */ interface WorkflowTraceContextOptions { workflowId: string; workflowName: string; executionId: string; userId?: string; conversationId?: string; parentSpan?: Span; input?: any; context?: Map; resumedFrom?: { traceId: string; spanId: string; }; replayedFrom?: { traceId: string; spanId: string; executionId: string; stepId: string; }; } declare class WorkflowTraceContext { private rootSpan; private tracer; private commonAttributes; private activeContext; private stepSpans; constructor(observability: VoltAgentObservability, operationName: string, options: WorkflowTraceContextOptions); /** * Create a child span for a workflow step */ createStepSpan(stepIndex: number, stepType: string, stepName: string, options?: { stepId?: string; parentStepId?: string; parallelIndex?: number; input?: any; attributes?: Record; }): Span; /** * Create spans for parallel steps */ createParallelStepSpans(parentStepIndex: number, parentStepType: string, parentStepName: string, parallelSteps: Array<{ index: number; type: string; name: string; id?: string; }>): { parentSpan: Span; childSpans: Span[]; }; /** * Create a generic child span under the workflow root or an optional parent span */ createChildSpan(name: string, type: string, options?: { label?: string; attributes?: Record; kind?: SpanKind$1; parentSpan?: Span; }): Span; /** * Record a suspension event on the workflow */ recordSuspension(stepIndex: number, reason: string, suspendData?: any, checkpoint?: any): void; /** * Record a cancellation event on the workflow */ recordCancellation(reason?: string): void; /** * Record a resume event on the workflow */ recordResume(stepIndex: number, resumeData?: any): void; /** * Execute a function within a span's context */ withSpan(span: Span, fn: () => T | Promise): Promise; /** * Get the root span */ getRootSpan(): Span; /** * Set input on the root span */ setInput(input: any): void; /** * Set output on the root span */ setOutput(output: any): void; /** * Set usage information on the root span */ setUsage(usage: any): void; /** * End the root span with a status */ end(status: "completed" | "suspended" | "cancelled" | "error", error?: Error | any): void; /** * End a step span with proper status */ endStepSpan(span: Span, status: "completed" | "skipped" | "suspended" | "cancelled" | "error", options?: { output?: any; error?: Error | any; attributes?: Record; skippedReason?: string; suspensionReason?: string; cancellationReason?: string; }): void; /** * Get the active context for manual context propagation */ getActiveContext(): Context; /** * Update active context with a new span */ updateActiveContext(span: Span): void; /** * Capture the current active span as a link target when we intentionally create a new root trace. */ private resolveLinkedSpan; /** * Clear step spans (useful for cleanup after parallel execution) */ clearStepSpans(): void; } /** * Context information for a workflow execution * Contains all the runtime information about a workflow execution */ interface WorkflowExecutionContext { /** * Unique identifier for the workflow definition */ workflowId: string; /** * Unique identifier for this specific execution */ executionId: string; /** * Human-readable name of the workflow */ workflowName: string; /** * User-defined context passed around during execution */ context: Map; /** * Shared workflow state available to all steps */ workflowState: WorkflowStateStore; /** * Whether the workflow is still actively running */ isActive: boolean; /** * When the workflow execution started */ startTime: Date; /** * Current step index being executed */ currentStepIndex: number; /** * Array of completed steps (for tracking) */ steps: any[]; /** * AbortSignal for cancelling the workflow */ signal?: AbortSignal; /** * Memory storage instance for this workflow execution * Can be workflow-specific or global */ memory?: Memory; /** * Map of executed step data (input and output) by step ID * Used for accessing previous step results */ stepData: Map; /** * Current event sequence number for this workflow execution * Used to maintain event ordering even after server restarts */ eventSequence: number; /** * Logger instance for this workflow execution * Provides execution-scoped logging with full context (userId, conversationId, executionId) */ logger: Logger; /** * Stream writer for emitting events during streaming execution * Always available - uses NoOpWorkflowStreamWriter when not streaming */ streamWriter: WorkflowStreamWriter; /** * OpenTelemetry trace context for observability * Manages span hierarchy and attributes for the workflow execution */ traceContext?: WorkflowTraceContext; /** * Optional agent instance supplied to workflow guardrails */ guardrailAgent?: Agent; /** * Current step span for passing to agents called within workflow steps * This enables agent spans to appear as children of workflow step spans */ currentStepSpan?: Span; } /** * Workflow step context for individual step tracking */ interface WorkflowStepContext { stepId: string; stepIndex: number; stepType: "agent" | "func" | "conditional-when" | "parallel-all" | "parallel-race" | "tap" | "workflow" | "guardrail" | "sleep" | "sleep-until" | "foreach" | "loop" | "branch" | "map"; stepName: string; workflowId: string; executionId: string; parentStepId?: string; parallelIndex?: number; startTime: Date; } type WorkflowStateStatus = "pending" | "running" | "completed" | "failed" | "suspended" | "cancelled"; type WorkflowState = { executionId: string; conversationId?: string; userId?: string; context?: UserContext; active: number; startAt: Date; endAt: Date | null; status: WorkflowStateStatus; /** the initial input data to the workflow */ input: InternalExtractWorkflowInputData; /** current data being processed */ data: DangerouslyAllowAny; /** shared workflow state across steps */ workflowState: WorkflowStateStore; /** the result of workflow execution, null until execution is complete */ result: RESULT | null; error: Error | null; /** suspension metadata when workflow is suspended */ suspension?: WorkflowSuspensionMetadata; /** cancellation metadata when workflow is cancelled */ cancellation?: WorkflowCancellationMetadata; /** accumulated usage from andAgent calls */ usage: UsageInfo; }; interface WorkflowSuspensionMetadata { /** Timestamp when the workflow was suspended */ suspendedAt: Date; /** Reason for suspension (user-requested, system, error, etc.) */ reason?: string; /** The step index where suspension occurred */ suspendedStepIndex: number; /** Last event sequence number before suspension */ lastEventSequence?: number; /** Validated data passed when suspending (if suspendSchema was provided) */ suspendData?: SUSPEND_DATA; /** Checkpoint data for resumption */ checkpoint?: { /** Current step's partial execution state */ stepExecutionState?: DangerouslyAllowAny; /** Results from completed steps that need to be preserved */ completedStepsData?: DangerouslyAllowAny[]; /** Shared workflow state snapshot */ workflowState?: WorkflowStateStore; /** Step data snapshots required by getStepData() after resume */ stepData?: Record; /** Accumulated usage up to suspension point */ usage?: UsageInfo; }; } interface WorkflowCancellationMetadata { /** Timestamp when the workflow was cancelled */ cancelledAt: Date; /** Reason for cancellation */ reason?: string; } /** * Custom abort controller for workflow suspension with reason tracking */ interface WorkflowSuspendController { /** * The abort signal to pass to the workflow */ signal: AbortSignal; /** * Suspend the workflow with a reason */ suspend: (reason?: string) => void; /** * Cancel the workflow with a reason */ cancel: (reason?: string) => void; /** * Check if the workflow has been suspended */ isSuspended: () => boolean; /** * Check if the workflow has been cancelled */ isCancelled: () => boolean; /** * Get the suspension or cancellation reason */ getReason: () => string | undefined; /** * Get the cancellation reason if cancellation was requested */ getCancelReason: () => string | undefined; } /** * Base result interface shared by all workflow execution results */ interface WorkflowExecutionResultBase { /** * Unique execution ID for this workflow run */ executionId: string; /** * The workflow ID */ workflowId: string; /** * When the workflow execution started */ startAt: Date; /** * When the workflow execution ended (completed, suspended, or errored) */ endAt: Date | Promise; /** * Current status of the workflow execution */ status: "completed" | "suspended" | "cancelled" | "error" | Promise<"completed" | "suspended" | "cancelled" | "error">; /** * The result data if workflow completed successfully */ result: z.infer | null | Promise | null>; /** * Suspension metadata if workflow was suspended */ suspension?: WorkflowSuspensionMetadata | Promise; /** * Cancellation metadata if workflow was cancelled */ cancellation?: WorkflowCancellationMetadata | Promise; /** * Error information if workflow failed */ error?: unknown | Promise; /** * Total token usage from all andAgent steps in the workflow */ usage: UsageInfo | Promise; } /** * Result returned from workflow execution with suspend/resume capabilities */ interface WorkflowExecutionResult extends WorkflowExecutionResultBase { endAt: Date; status: "completed" | "suspended" | "cancelled" | "error"; result: z.infer | null; suspension?: WorkflowSuspensionMetadata; cancellation?: WorkflowCancellationMetadata; error?: unknown; usage: UsageInfo; /** * Resume a suspended workflow execution * @param input - Optional new input data for resuming (validated against resumeSchema if provided) * @param options - Optional options for resuming, including stepId to resume from a specific step * @returns A new execution result that can also be resumed if suspended again */ resume: (input: z.infer, options?: { stepId?: string; }) => Promise>; } /** * Result returned from workflow stream execution * Extends base with streaming capabilities and promise-based fields */ interface WorkflowStreamResult extends WorkflowExecutionResultBase, AsyncIterable { endAt: Promise; status: Promise<"completed" | "suspended" | "cancelled" | "error">; result: Promise | null>; suspension: Promise; cancellation: Promise; error: Promise; usage: Promise; toUIMessageStreamResponse: StreamTextResult["toUIMessageStreamResponse"]; /** * Resume a suspended workflow execution * @param input - Optional new input data for resuming (validated against resumeSchema if provided) * @param options - Optional options for resuming, including stepId to resume from a specific step * @returns A new stream result that can also be resumed if suspended again */ resume: (input: z.infer, options?: { stepId?: string; }) => Promise>; /** * Request workflow suspension */ suspend: (reason?: string) => void; /** * Cancel the workflow execution */ cancel: (reason?: string) => void; /** * Abort the workflow execution */ abort: () => void; /** * Subscribe to run-level stream events without consuming the main async iterator. * Returns an unsubscribe function. */ watch: (cb: (event: WorkflowStreamEvent) => void | Promise) => () => void; /** * Async variant of watch() for compatibility with observer-based integrations. */ watchAsync: (cb: (event: WorkflowStreamEvent) => void | Promise) => Promise<() => void>; /** * Create a ReadableStream view over workflow events. */ observeStream: () => ReadableStream; /** * Compatibility surface for legacy stream consumers. */ streamLegacy: () => { stream: ReadableStream; getWorkflowState: () => ReturnType; }; } /** * Result returned when a workflow execution is started asynchronously */ interface WorkflowStartAsyncResult { /** * Unique execution ID for this workflow run */ executionId: string; /** * The workflow ID */ workflowId: string; /** * When the async execution was started */ startAt: Date; } interface WorkflowTimeTravelOptions { /** * Source execution ID to replay from */ executionId: string; /** * Step ID to restart execution from */ stepId: string; /** * Optional override for the selected step input/state data */ inputData?: DangerouslyAllowAny; /** * Optional resume payload passed as `resumeData` to the selected step */ resumeData?: DangerouslyAllowAny; /** * Optional override for shared workflow state during replay */ workflowStateOverride?: WorkflowStateStore; /** * Optional memory adapter to read source execution and persist replay execution state. * Falls back to workflow default memory when omitted. */ memory?: Memory; } interface WorkflowRetryConfig { /** * Number of retry attempts for a step when it throws an error * @default 0 */ attempts?: number; /** * Delay in milliseconds between retry attempts * @default 0 */ delayMs?: number; } type WorkflowStateStore = Record; type WorkflowStateUpdater = WorkflowStateStore | ((previous: WorkflowStateStore) => WorkflowStateStore); interface WorkflowRunOptions { /** * The active step, this can be used to track the current step in a workflow * @default 0 */ active?: number; /** * The execution ID, this can be used to track the current execution in a workflow * @default uuidv4 */ executionId?: string; /** * The conversation ID, this can be used to track the current conversation in a workflow */ conversationId?: string; /** * The user ID, this can be used to track the current user in a workflow */ userId?: string; /** * Additional execution metadata persisted with workflow state */ metadata?: Record; /** * The user context, this can be used to track the current user context in a workflow */ context?: UserContext; /** * Shared workflow state available to all steps */ workflowState?: WorkflowStateStore; /** * Override Memory V2 for this specific execution * Takes priority over workflow config memory and global memory */ memory?: Memory; /** * Suspension controller for managing workflow suspension */ suspendController?: WorkflowSuspendController; /** * Options for resuming a suspended workflow */ resumeFrom?: WorkflowResumeOptions; /** * Internal replay lineage context for deterministic time-travel executions * @internal */ replayFrom?: WorkflowReplayOptions; /** * Suspension mode: * - 'graceful': Wait for current step to complete before suspending (default) * - 'immediate': Suspend immediately, even during step execution * @default 'graceful' */ suspensionMode?: "immediate" | "graceful"; /** * Logger instance to use for this workflow execution * If not provided, will use the workflow's logger or global logger */ logger?: Logger; /** * Override retry settings for this workflow execution */ retryConfig?: WorkflowRetryConfig; /** * Persist running checkpoints every N completed steps. * @default 1 */ checkpointInterval?: number; /** * Disable running checkpoint persistence for this execution. * @default false */ disableCheckpointing?: boolean; /** * Input guardrails to run before workflow execution */ inputGuardrails?: InputGuardrail[]; /** * Output guardrails to run after workflow execution */ outputGuardrails?: OutputGuardrail[]; /** * Optional agent instance to supply to workflow guardrails */ guardrailAgent?: Agent; /** * Internal flag to skip initial state creation when it is already persisted * @internal */ skipStateInit?: boolean; } interface WorkflowResumeOptions { /** * The execution ID of the suspended workflow to resume */ executionId: string; /** * The checkpoint data from the suspension */ checkpoint?: { stepExecutionState?: DangerouslyAllowAny; completedStepsData?: DangerouslyAllowAny[]; workflowState?: WorkflowStateStore; stepData?: Record; usage?: UsageInfo; }; /** * The step index to resume from */ resumeStepIndex: number; /** * The last event sequence number before suspension */ lastEventSequence?: number; /** * Data to pass to the resumed step (validated against resumeSchema) */ resumeData?: DangerouslyAllowAny; } interface WorkflowReplayOptions { /** * Source execution ID used for replay lineage */ executionId: string; /** * Source step ID where replay starts */ stepId: string; } interface WorkflowRestartCheckpoint { /** * Zero-based step index where execution should continue */ resumeStepIndex: number; /** * Last completed step index at checkpoint time */ lastCompletedStepIndex: number; /** * Current workflow data snapshot */ stepExecutionState?: DangerouslyAllowAny; /** * Completed step snapshots used by downstream lookups */ completedStepsData?: DangerouslyAllowAny[]; /** * Shared workflow state snapshot */ workflowState?: WorkflowStateStore; /** * Step data snapshots required by getStepData() after restart */ stepData?: Record; /** * Usage accumulated up to checkpoint */ usage?: UsageInfo; /** * Event sequence at checkpoint time */ eventSequence?: number; /** * Timestamp when the checkpoint was persisted */ checkpointedAt: Date; } interface WorkflowRestartAllResult { restarted: string[]; failed: Array<{ executionId?: string; workflowId?: string; error: string; isWorkflowFailure?: boolean; }>; } /** * Hooks for the workflow * @param DATA - The type of the data * @param RESULT - The type of the result */ type WorkflowHookStatus = "completed" | "suspended" | "cancelled" | "error"; type WorkflowStepStatus = "running" | "success" | "error" | "suspended" | "cancelled" | "skipped"; type WorkflowStepData = { input: DangerouslyAllowAny; output?: DangerouslyAllowAny; status: WorkflowStepStatus; error?: Error | null; }; type WorkflowSerializedStepError = { message: string; stack?: string; name?: string; }; type WorkflowCheckpointStepData = { input: DangerouslyAllowAny; output?: DangerouslyAllowAny; status: WorkflowStepStatus; error?: WorkflowSerializedStepError | null; }; type WorkflowHookContext = { /** * Terminal status for the workflow execution */ status: WorkflowHookStatus; /** * The current workflow state */ state: WorkflowState; /** * Result of the workflow execution, if available */ result: RESULT | null; /** * Error from the workflow execution, if any */ error: unknown | null; /** * Suspension metadata when status is suspended */ suspension?: WorkflowSuspensionMetadata; /** * Cancellation metadata when status is cancelled */ cancellation?: WorkflowCancellationMetadata; /** * Step input/output snapshots keyed by step ID */ steps: Record; }; type WorkflowHooks = { /** * Called when the workflow starts * @param state - The current state of the workflow * @returns void */ onStart?: (state: WorkflowState) => Promise; /** * Called when a step starts * @param state - The current state of the workflow * @returns void */ onStepStart?: (state: WorkflowState) => Promise; /** * Called when a step ends * @param state - The current state of the workflow * @returns void */ onStepEnd?: (state: WorkflowState) => Promise; /** * Called when the workflow is suspended * @param context - The terminal hook context * @returns void */ onSuspend?: (context: WorkflowHookContext) => Promise; /** * Called when the workflow ends with an error * @param context - The terminal hook context * @returns void */ onError?: (context: WorkflowHookContext) => Promise; /** * Called when the workflow reaches a terminal state * @param context - The terminal hook context * @returns void */ onFinish?: (context: WorkflowHookContext) => Promise; /** * Called when the workflow ends (completed, cancelled, or error) * @param state - The current state of the workflow * @param context - The terminal hook context * @returns void */ onEnd?: (state: WorkflowState, context?: WorkflowHookContext) => Promise; }; type WorkflowInput = TF.IsUnknown extends true ? BaseMessage | BaseMessage[] | UIMessage | UIMessage[] | string : INPUT_SCHEMA extends z.ZodTypeAny ? z.infer : undefined; type WorkflowResult = RESULT_SCHEMA extends z.ZodTypeAny ? z.infer : RESULT_SCHEMA; type WorkflowConfig = { /** * Unique identifier for the workflow */ id: string; /** * Human-readable name for the workflow */ name: string; /** * Description of what the workflow does */ purpose?: string; /** * Schema for the input data */ input?: INPUT_SCHEMA; /** * Schema for the result data */ result: RESULT_SCHEMA; /** * Schema for data passed when suspending (optional) */ suspendSchema?: SUSPEND_SCHEMA; /** * Schema for data passed when resuming (optional) */ resumeSchema?: RESUME_SCHEMA; /** * Hooks for the workflow */ hooks?: WorkflowHooks, WorkflowResult>; /** * Memory V2 for workflow state persistence * Stores suspension/checkpoint data */ memory?: Memory; /** * Logger instance to use for this workflow * If not provided, will use the global logger or create a default one */ logger?: Logger; /** * Observability instance for OpenTelemetry integration * If not provided, will use global observability or create a default one */ observability?: VoltAgentObservability; /** * Input guardrails to run before workflow execution */ inputGuardrails?: InputGuardrail[]; /** * Output guardrails to run after workflow execution */ outputGuardrails?: OutputGuardrail[]; /** * Optional agent instance to supply to workflow guardrails */ guardrailAgent?: Agent; /** * Default retry configuration for steps in this workflow */ retryConfig?: WorkflowRetryConfig; /** * Default running checkpoint persistence interval in completed-step count. * @default 1 */ checkpointInterval?: number; /** * Disable running checkpoint persistence for this workflow by default. * @default false */ disableCheckpointing?: boolean; }; /** * A workflow instance that can be executed */ type Workflow = { /** * Unique identifier for the workflow */ id: string; /** * Human-readable name for the workflow */ name: string; /** * Description of what the workflow does * @default "No purpose provided" */ purpose: string; /** * Array of steps to execute in order */ steps: WorkflowStep, DangerouslyAllowAny, DangerouslyAllowAny>[]; /** * Input schema for the workflow (for API access) */ inputSchema?: INPUT_SCHEMA; /** * Result schema for the workflow (for API access) */ resultSchema?: RESULT_SCHEMA; /** * Suspend schema for the workflow (for API access) */ suspendSchema?: SUSPEND_SCHEMA; /** * Resume schema for the workflow (for API access) */ resumeSchema?: RESUME_SCHEMA; /** * Memory V2 for this workflow (always created with default if not provided) */ memory: Memory; /** * Observability instance for OpenTelemetry integration */ observability?: VoltAgentObservability; /** * Input guardrails configured for this workflow */ inputGuardrails?: InputGuardrail[]; /** * Output guardrails configured for this workflow */ outputGuardrails?: OutputGuardrail[]; /** * Optional agent instance supplied to workflow guardrails */ guardrailAgent?: Agent; /** * Default retry configuration for steps in this workflow */ retryConfig?: WorkflowRetryConfig; /** * Get the full state of the workflow including all steps * @returns The serialized workflow state */ getFullState: () => { id: string; name: string; purpose: string; stepsCount: number; steps: DangerouslyAllowAny[]; inputSchema?: DangerouslyAllowAny; resultSchema?: DangerouslyAllowAny; suspendSchema?: DangerouslyAllowAny; resumeSchema?: DangerouslyAllowAny; retryConfig?: WorkflowRetryConfig; guardrails?: { inputCount: number; outputCount: number; }; }; /** * Execute the workflow with the given input * @param input - The input to the workflow * @param options - Options for the workflow execution * @returns Execution result with final result */ run: (input: WorkflowInput, options?: WorkflowRunOptions) => Promise>; /** * Execute the workflow with streaming support * @param input - The input to the workflow * @param options - Options for the workflow execution * @returns Stream result with real-time events and promise-based fields */ stream: (input: WorkflowInput, options?: WorkflowRunOptions) => WorkflowStreamResult; /** * Start the workflow in the background without waiting for completion * @param input - The input to the workflow * @param options - Options for the workflow execution * @returns Async start metadata with execution ID */ startAsync: (input: WorkflowInput, options?: WorkflowRunOptions) => Promise; /** * Replay an existing execution from a selected historical step. * A new execution ID is created and linked to the source run for audit safety. */ timeTravel: (options: WorkflowTimeTravelOptions) => Promise>; /** * Stream replay execution from a selected historical step. * A new execution ID is created and linked to the source run for audit safety. */ timeTravelStream: (options: WorkflowTimeTravelOptions) => WorkflowStreamResult; /** * Restart an interrupted execution from persisted checkpoint state * @param executionId - Execution ID to restart * @param options - Optional execution overrides * @returns Execution result of the restarted run */ restart: (executionId: string, options?: WorkflowRunOptions) => Promise>; /** * Restart all active (running) executions for this workflow * This method only operates on this workflow instance. * Use `WorkflowRegistry.restartAllActiveWorkflowRuns({ workflowId })` for cross-workflow filtering. * @returns Lists of restarted and failed execution IDs */ restartAllActive: () => Promise; /** * Create a WorkflowSuspendController that can be used to suspend the workflow * @returns A WorkflowSuspendController instance */ createSuspendController?: () => WorkflowSuspendController; }; /** * Workflow timeline event - represents events during workflow execution */ interface WorkflowTimelineEvent { id: string; workflowHistoryId: string; eventId: string; name: string; type: "workflow" | "workflow-step"; startTime: string; endTime?: string; status: string; level?: string; input?: unknown; output?: unknown; statusMessage?: unknown; metadata?: Record; traceId?: string; parentEventId?: string; eventSequence?: number; createdAt: Date; } /** * Workflow statistics for reporting */ interface WorkflowStats { totalExecutions: number; successfulExecutions: number; failedExecutions: number; averageExecutionTime: number; lastExecutionTime?: Date; } /** * Event emitted during workflow streaming */ type WorkflowStreamEventType = "workflow-start" | "workflow-suspended" | "workflow-complete" | "workflow-cancelled" | "workflow-error" | "step-start" | "step-complete" | (string & {}); interface WorkflowStreamEvent { /** * Type of the event (e.g., "step-start", "step-complete", "custom", "agent-stream") */ type: WorkflowStreamEventType; /** * Unique execution ID for this workflow run */ executionId: string; /** * Source of the event (step ID or name) */ from: string; /** * Input data for the step/event */ input?: DangerouslyAllowAny; /** * Output data from the step/event */ output?: DangerouslyAllowAny; /** * Current status of the step/event */ status: "pending" | "running" | "success" | "skipped" | "error" | "suspended" | "cancelled"; /** * User context passed through the workflow */ context?: UserContext; /** * Timestamp of the event */ timestamp: string; /** * Current step index in the workflow */ stepIndex?: number; /** * Step type for step events */ stepType?: "agent" | "func" | "conditional-when" | "parallel-all" | "parallel-race" | "tap" | "workflow" | "guardrail" | "sleep" | "sleep-until" | "foreach" | "loop" | "branch" | "map"; /** * Additional metadata */ metadata?: Record; /** * Error information if status is "error" */ error?: DangerouslyAllowAny; } /** * Writer interface for emitting stream events from workflow steps */ interface WorkflowStreamWriter { /** * Write a custom event to the stream */ write(event: Omit, "type"> & { type: WorkflowStreamEventType; }): void; /** * Pipe events from an agent's fullStream to the workflow stream * @param fullStream - The agent's fullStream async iterable * @param options - Optional configuration for piping */ pipeFrom(fullStream: AsyncIterable, options?: { prefix?: string; agentId?: string; filter?: (part: DangerouslyAllowAny) => boolean; }): Promise; } /** * The state parameter passed to workflow steps */ type WorkflowStepState = Omit, "data" | "result"> & { /** Workflow execution context for event tracking */ workflowContext?: WorkflowExecutionContext; /** AbortSignal for checking suspension during step execution */ signal?: AbortSignal; }; /** * The base input type for the workflow * @private - INTERNAL USE ONLY */ type InternalBaseWorkflowInputSchema = z.ZodTypeAny | BaseMessage | BaseMessage[] | UIMessage | UIMessage[] | string; /** * Context object for new execute API with helper functions * @private - INTERNAL USE ONLY */ interface WorkflowExecuteContext { data: DATA; state: WorkflowStepState; getStepData: (stepId: string) => WorkflowStepData | undefined; getStepResult: (stepId: string) => T | null; getInitData: >() => T; suspend: (reason?: string, suspendData?: SUSPEND_DATA) => Promise; bail: (result?: WORKFLOW_RESULT) => never; abort: () => never; resumeData?: RESUME_DATA; retryCount?: number; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; /** * Logger instance for this workflow execution. * Provides execution-scoped logging with full context (userId, conversationId, executionId). */ logger: Logger; /** * Stream writer for emitting events during streaming execution. * Always available - uses NoOpWorkflowStreamWriter when not streaming */ writer: WorkflowStreamWriter; } /** * A function that can be executed by the workflow * Uses context-based API with data, state, and helper functions * @private - INTERNAL USE ONLY */ type InternalWorkflowFunc = (context: WorkflowExecuteContext) => Promise; type InternalWorkflowStepConfig = { /** * Unique identifier for the step * @required - Must be provided for proper step tracking */ id: string; /** * Human-readable name for the step */ name?: string; /** * Description of what the step does */ purpose?: string; /** * Number of retry attempts when the step throws an error */ retries?: number; } & T; /** * Base step interface for building new steps * @private - INTERNAL USE ONLY */ interface InternalBaseWorkflowStep { /** * Unique identifier for the step */ id: string; /** * Human-readable name for the step */ name: string | null; /** * Description of what the step does */ purpose: string | null; /** * Type identifier for the step */ type: string; /** * Optional input schema for runtime validation */ inputSchema?: z.ZodTypeAny; /** * Optional output schema for runtime validation */ outputSchema?: z.ZodTypeAny; /** * Optional suspend data schema for this step */ suspendSchema?: z.ZodTypeAny; /** * Optional resume data schema for this step */ resumeSchema?: z.ZodTypeAny; /** * Number of retry attempts when the step throws an error */ retries?: number; /** * Execute the step with the given context * @param context - The execution context containing data, state, and helpers * @returns The result of the step */ execute: (context: WorkflowExecuteContext) => Promise; } /** * Any step that can be accepted by the workflow * @private - INTERNAL USE ONLY */ type InternalAnyWorkflowStep = InternalBaseWorkflowStep | Omit, "type">; /** * Infer the result type from a list of steps * @private - INTERNAL USE ONLY */ type InternalInferWorkflowStepsResult>> = { [K in keyof STEPS]: ExtractExecuteResult; }; type InternalExtractWorkflowInputData = TF.IsUnknown extends true ? BaseMessage | BaseMessage[] | UIMessage | UIMessage[] | string : TF.IsAny extends true ? BaseMessage | BaseMessage[] | UIMessage | UIMessage[] | string : T extends z.ZodType ? z.infer : T; type ExtractExecuteResult = T extends { execute: (...args: any[]) => infer R; } ? R extends Promise ? U : R : never; type OutputSpec = Output.Output; type AgentOutputSchema = OutputSpec | z.ZodTypeAny; type InferAgentOutput = SCHEMA extends OutputSpec ? InferGenerateOutput : SCHEMA extends z.ZodTypeAny ? z.infer : never; type AgentConfig = Omit & { schema: SCHEMA | ((context: Omit, "suspend" | "writer">) => SCHEMA | Promise); }; type AgentResultMapper = (output: InferAgentOutput, context: WorkflowExecuteContext) => Promise | RESULT; /** * Creates an agent step for a workflow * * @example * ```ts * const w = createWorkflow( * andAgent( * ({ data }) => `Generate a greeting for the user ${data.name}`, * agent, * { schema: z.object({ greeting: z.string() }) } * ), * andThen({ * id: "extract-greeting", * execute: async ({ data }) => data.greeting * }) * ); * ``` * * @param task - The task (prompt) to execute for the agent, can be a string or a function that returns a string * @param agent - The agent to execute the task using `generateText` * @param config - The config for the agent (schema/output) `generateText` call * @param map - Optional mapper to shape or merge the agent output with existing data * @returns A workflow step that executes the agent with the task */ declare function andAgent>(task: UIMessage[] | ModelMessage[] | string | InternalWorkflowFunc, agent: Agent, config: AgentConfig, map?: AgentResultMapper): { type: "agent"; id: string; name: string; purpose: string | null; agent: Agent; execute: (context: WorkflowExecuteContext) => Promise; }; interface WorkflowStepAgent extends InternalBaseWorkflowStep { type: "agent"; agent: Agent; } type WorkflowStepFuncConfig = InternalWorkflowStepConfig<{ execute: InternalWorkflowFunc; inputSchema?: z.ZodTypeAny; outputSchema?: z.ZodTypeAny; suspendSchema?: z.ZodTypeAny; resumeSchema?: z.ZodTypeAny; }>; interface WorkflowStepFunc extends InternalBaseWorkflowStep { type: "func"; } interface WorkflowStepWorkflow extends InternalBaseWorkflowStep { type: "workflow"; workflow: InternalWorkflow; } type WorkflowStepGuardrailConfig<_INPUT, DATA> = InternalWorkflowStepConfig<{ inputGuardrails?: InputGuardrail[]; outputGuardrails?: OutputGuardrail[]; }>; interface WorkflowStepGuardrail extends InternalBaseWorkflowStep { type: "guardrail"; inputGuardrails?: InputGuardrail[]; outputGuardrails?: OutputGuardrail[]; } type WorkflowStepTapConfig = InternalWorkflowStepConfig<{ execute: InternalWorkflowFunc; inputSchema?: z.ZodTypeAny; suspendSchema?: z.ZodTypeAny; resumeSchema?: z.ZodTypeAny; }>; interface WorkflowStepTap extends InternalBaseWorkflowStep { type: "tap"; } type WorkflowStepConditionalWhenConfig = InternalWorkflowStepConfig<{ condition: InternalWorkflowFunc; step: InternalAnyWorkflowStep; inputSchema?: z.ZodTypeAny; outputSchema?: z.ZodTypeAny; suspendSchema?: z.ZodTypeAny; resumeSchema?: z.ZodTypeAny; }>; interface WorkflowStepConditionalWhen extends InternalBaseWorkflowStep | RESULT, any, any> { type: "conditional-when"; condition: InternalWorkflowFunc; } type WorkflowStepParallelRaceConfig = InternalWorkflowStepConfig<{ steps: ReadonlyArray>; }>; interface WorkflowStepParallelRace extends InternalBaseWorkflowStep { type: "parallel-race"; steps: ReadonlyArray>; } type WorkflowStepParallelAllConfig> | WorkflowStepParallelDynamicStepsFunc> = InternalWorkflowStepConfig<{ steps: STEPS; }>; interface WorkflowStepParallelAll extends InternalBaseWorkflowStep { type: "parallel-all"; steps: WorkflowStepParallelSteps | WorkflowStepParallelDynamicStepsFunc; } type WorkflowStepSleepConfig = InternalWorkflowStepConfig<{ duration: number | InternalWorkflowFunc; }>; interface WorkflowStepSleep extends InternalBaseWorkflowStep { type: "sleep"; duration: number | InternalWorkflowFunc; } type WorkflowStepSleepUntilConfig = InternalWorkflowStepConfig<{ date: Date | InternalWorkflowFunc; }>; interface WorkflowStepSleepUntil extends InternalBaseWorkflowStep { type: "sleep-until"; date: Date | InternalWorkflowFunc; } type WorkflowStepForEachItemsFunc = InternalWorkflowFunc; type WorkflowStepForEachMapFunc = (context: WorkflowExecuteContext, item: ITEM, index: number) => Promise | MAP_DATA; type WorkflowStepForEachConfig = InternalWorkflowStepConfig<{ step: InternalAnyWorkflowStep; concurrency?: number; items?: WorkflowStepForEachItemsFunc; map?: WorkflowStepForEachMapFunc; }>; interface WorkflowStepForEach extends InternalBaseWorkflowStep { type: "foreach"; step: InternalAnyWorkflowStep; concurrency?: number; items?: WorkflowStepForEachItemsFunc; map?: WorkflowStepForEachMapFunc; } type WorkflowStepLoopSteps = readonly [InternalAnyWorkflowStep] | readonly [ InternalAnyWorkflowStep, ...InternalAnyWorkflowStep[], InternalAnyWorkflowStep ]; type WorkflowStepLoopBaseConfig = InternalWorkflowStepConfig<{ condition: InternalWorkflowFunc; }>; type WorkflowStepLoopSingleStepConfig = WorkflowStepLoopBaseConfig & { step: InternalAnyWorkflowStep; steps?: never; }; type WorkflowStepLoopMultiStepConfig = WorkflowStepLoopBaseConfig & { steps: WorkflowStepLoopSteps; step?: never; }; type WorkflowStepLoopConfig = WorkflowStepLoopSingleStepConfig | WorkflowStepLoopMultiStepConfig; interface WorkflowStepLoop extends InternalBaseWorkflowStep { type: "loop"; loopType: "dowhile" | "dountil"; step: InternalAnyWorkflowStep; steps: WorkflowStepLoopSteps; condition: InternalWorkflowFunc; } type WorkflowStepBranchConfig = InternalWorkflowStepConfig<{ branches: ReadonlyArray<{ condition: InternalWorkflowFunc; step: InternalAnyWorkflowStep; }>; }>; interface WorkflowStepBranch extends InternalBaseWorkflowStep, any, any> { type: "branch"; branches: ReadonlyArray<{ condition: InternalWorkflowFunc; step: InternalAnyWorkflowStep; }>; } type WorkflowStepMapEntry = { source: "value"; value: unknown; } | { source: "data"; path?: string; } | { source: "input"; path?: string; } | { source: "step"; stepId: string; path?: string; } | { source: "context"; key: string; path?: string; } | { source: "fn"; fn: InternalWorkflowFunc; }; type WorkflowStepMapEntryResult = ENTRY extends { source: "value"; value: infer VALUE; } ? VALUE : ENTRY extends { source: "fn"; fn: (...args: any[]) => Promise; } ? RESULT : unknown; type WorkflowStepMapResult>> = { [KEY in keyof MAP]: WorkflowStepMapEntryResult; }; type WorkflowStepMapConfig>> = InternalWorkflowStepConfig<{ map: MAP; inputSchema?: z.ZodTypeAny; outputSchema?: z.ZodTypeAny; }>; interface WorkflowStepMap>> extends InternalBaseWorkflowStep, any, any> { type: "map"; map: MAP; } type WorkflowStepParallelDynamicStepsFunc = (context: WorkflowExecuteContext) => Promise>; type WorkflowStepParallelSteps = ReadonlyArray>; type WorkflowStep = WorkflowStepAgent | WorkflowStepFunc | WorkflowStepConditionalWhen | WorkflowStepGuardrail | WorkflowStepParallelAll | WorkflowStepTap | WorkflowStepParallelRace | WorkflowStepWorkflow | WorkflowStepSleep | WorkflowStepSleepUntil | WorkflowStepForEach | WorkflowStepLoop | WorkflowStepBranch | WorkflowStepMap>>; /** * Internal type to allow overriding the run method for the workflow */ interface InternalWorkflow<_INPUT, DATA, RESULT> extends Omit, "run" | "restart" | "restartAllActive"> { run: (input: DATA, options?: InternalWorkflowRunOptions) => Promise<{ executionId: string; startAt: Date; endAt: Date; status: "completed"; result: RESULT; }>; } interface InternalWorkflowRunOptions extends WorkflowRunOptions { } /** * Creates an async function step for the workflow * * @example * ```ts * const w = createWorkflow( * andThen({ * id: "process-data", * execute: async ({ data }) => { * const processed = await someAsyncOperation(data.value); * return { ...data, processed }; * } * }), * andThen({ * id: "format-result", * execute: async ({ data }) => { * return { result: `Processed: ${data.processed}` }; * } * }) * ); * ``` * * @param config - Configuration object with execute function and metadata * @returns A workflow step that executes the function and returns the result */ declare function andThen({ execute, inputSchema, outputSchema, suspendSchema, resumeSchema, ...config }: WorkflowStepFuncConfig): WorkflowStepFunc; /** * Creates a conditional step for the workflow that executes only when a condition is met * * @example * ```ts * const w = createWorkflow( * andWhen({ * id: "admin-permissions", * condition: async ({ data }) => data.userType === "admin", * execute: async ({ data }) => { * return { ...data, permissions: ["read", "write", "delete"] }; * } * }), * andWhen({ * id: "high-value-processing", * condition: async ({ data }) => data.value > 100, * step: andAgent( * ({ data }) => `Process high value transaction: ${data.value}`, * agent, * { schema: z.object({ processed: z.boolean() }) } * ) * }) * ); * ``` * * @param config - Configuration object with condition, step/execute function, and metadata * @returns A conditional workflow step that executes the step only when the condition evaluates to true */ declare function andWhen({ condition, step, inputSchema, outputSchema, suspendSchema, resumeSchema, ...config }: WorkflowStepConditionalWhenConfig): WorkflowStepConditionalWhen; /** * Creates a parallel execution step that runs multiple steps simultaneously and waits for all to complete * * @example * ```ts * const w = createWorkflow( * andAll({ * id: "parallel-fetch", * steps: [ * andThen({ * id: "fetch-user", * execute: async ({ data }) => { * const userInfo = await fetchUserInfo(data.userId); * return { userInfo }; * } * }), * andThen({ * id: "fetch-permissions", * execute: async ({ data }) => { * const permissions = await fetchPermissions(data.userId); * return { permissions }; * } * }), * andAgent( * ({ data }) => `Generate recommendations for user ${data.userId}`, * agent, * { schema: z.object({ recommendations: z.array(z.string()) }) } * ) * ] * }), * andThen({ * id: "combine-results", * execute: async ({ data }) => { * // data is now an array: [{ userInfo }, { permissions }, { recommendations }] * return { combined: data.flat() }; * } * }) * ); * ``` * * @param config - Configuration object with steps array and metadata * @returns A workflow step that executes all steps simultaneously and returns their results as an array */ declare function andAll> | WorkflowStepParallelDynamicStepsFunc>({ steps: inputSteps, ...config }: WorkflowStepParallelAllConfig): { type: "parallel-all"; steps: InternalAnyWorkflowStep[] ? InternalInferWorkflowStepsResult : STEPS extends WorkflowStepParallelDynamicStepsFunc ? InternalInferWorkflowStepsResult>> : never>[]; execute: (context: WorkflowExecuteContext) => Promise[] ? InternalInferWorkflowStepsResult : STEPS extends WorkflowStepParallelDynamicStepsFunc ? InternalInferWorkflowStepsResult>> : never>; id: string; name: string; purpose: string; retries?: number; }; /** * Creates a race execution step that runs multiple steps simultaneously and returns the first completed result * * @example * ```ts * const w = createWorkflow( * andRace({ * id: "race-data-sources", * steps: [ * andThen({ * id: "check-cache", * execute: async ({ data }) => { * // Fast operation * const cacheResult = await checkCache(data.query); * return { source: "cache", result: cacheResult }; * } * }), * andThen({ * id: "query-database", * execute: async ({ data }) => { * // Slower operation * const dbResult = await queryDatabase(data.query); * return { source: "database", result: dbResult }; * } * }), * andAgent( * ({ data }) => `Generate fallback response for: ${data.query}`, * agent, * { schema: z.object({ source: z.literal("ai"), result: z.string() }) } * ) * ] * }), * andThen({ * id: "process-result", * execute: async ({ data }) => { * // data is the result from whichever step completed first * return { finalResult: data.result, source: data.source }; * } * }) * ); * ``` * * @param config - Configuration object with steps array and metadata * @returns A workflow step that executes all steps simultaneously and returns the result from the first step to complete */ declare function andRace>>({ steps, ...config }: InternalWorkflowStepConfig<{ steps: STEPS; }>): { type: "parallel-race"; steps: InternalAnyWorkflowStep[number]>[]; execute: (context: WorkflowExecuteContext) => Promise[number]>; id: string; name: string; purpose: string; retries?: number; }; /** * A safe way to tap into the workflow state without affecting the result. * * @example * ```ts * const w = createWorkflow( * andTap({ * id: "log-processing", * execute: async ({ data }) => { * console.log("Processing data:", data); * } * }), * andThen({ * id: "process-data", * execute: async ({ data }) => { * // data is unchanged from the tap step * return { ...data, processed: true }; * } * }) * ); * ``` * * @param config - Configuration object with execute function and metadata * @returns A workflow step that executes the function */ declare function andTap({ execute, inputSchema, suspendSchema, resumeSchema, ...config }: WorkflowStepTapConfig): { type: "tap"; inputSchema: zod.ZodTypeAny | undefined; suspendSchema: zod.ZodTypeAny | undefined; resumeSchema: zod.ZodTypeAny | undefined; execute: (context: WorkflowExecuteContext) => Promise; id: string; name: string; purpose: string; retries?: number; }; /** * Applies guardrails to the current workflow data. * Use input guardrails for string/message data and output guardrails for structured data. */ declare function andGuardrail({ inputGuardrails, outputGuardrails, ...config }: WorkflowStepGuardrailConfig): { type: "guardrail"; inputGuardrails: InputGuardrail[] | undefined; outputGuardrails: OutputGuardrail[] | undefined; execute: (context: WorkflowExecuteContext) => Promise; id: string; name: string; purpose: string; retries?: number; }; /** * Creates a sleep step for the workflow * * @example * ```ts * const w = createWorkflow( * andSleep({ id: "pause", duration: 500 }), * andThen({ id: "next", execute: async ({ data }) => ({ ...data }) }) * ); * ``` */ declare function andSleep({ duration, ...config }: WorkflowStepSleepConfig): { type: "sleep"; duration: number | InternalWorkflowFunc; execute: (context: WorkflowExecuteContext) => Promise; id: string; name: string; purpose: string; retries?: number; }; /** * Creates a sleep-until step for the workflow * * @example * ```ts * const w = createWorkflow( * andSleepUntil({ id: "pause-until", date: new Date(Date.now() + 1000) }), * andThen({ id: "next", execute: async ({ data }) => ({ ...data }) }) * ); * ``` */ declare function andSleepUntil({ date, ...config }: WorkflowStepSleepUntilConfig): { type: "sleep-until"; date: Date | InternalWorkflowFunc; execute: (context: WorkflowExecuteContext) => Promise; id: string; name: string; purpose: string; retries?: number; }; /** * Creates a foreach step that runs a step for each item in an array. * Use items to select the array and map to shape each item before execution. */ declare function andForEach({ step, concurrency, items, map, ...config }: WorkflowStepForEachConfig): { type: "foreach"; step: InternalAnyWorkflowStep; concurrency: number; items: WorkflowStepForEachItemsFunc | undefined; map: WorkflowStepForEachMapFunc | undefined; execute: (context: WorkflowExecuteContext) => Promise; id: string; name: string; purpose: string; retries?: number; }; /** * Creates a branching step that runs all steps whose conditions match. */ declare function andBranch({ branches, ...config }: WorkflowStepBranchConfig): { type: "branch"; branches: readonly { condition: InternalWorkflowFunc; step: InternalAnyWorkflowStep; }[]; execute: (context: WorkflowExecuteContext) => Promise<(RESULT | undefined)[]>; id: string; name: string; purpose: string; retries?: number; }; type LoopType = "dowhile" | "dountil"; /** * Creates a do-while loop step for the workflow. */ declare function andDoWhile(config: WorkflowStepLoopConfig): { type: "loop"; loopType: LoopType; step: InternalAnyWorkflowStep | InternalAnyWorkflowStep; steps: WorkflowStepLoopSteps; condition: InternalWorkflowFunc; execute: (context: WorkflowExecuteContext) => Promise; id: string; name: string; purpose: string; retries?: number; }; /** * Creates a do-until loop step for the workflow. */ declare function andDoUntil(config: WorkflowStepLoopConfig): { type: "loop"; loopType: LoopType; step: InternalAnyWorkflowStep | InternalAnyWorkflowStep; steps: WorkflowStepLoopSteps; condition: InternalWorkflowFunc; execute: (context: WorkflowExecuteContext) => Promise; id: string; name: string; purpose: string; retries?: number; }; /** * Creates a mapping step that composes data from input, steps, or context. */ declare function andMap>>({ map, ...config }: WorkflowStepMapConfig): { type: "map"; map: MAP; execute: (context: WorkflowExecuteContext) => Promise>; id: string; name: string; purpose: string; retries?: number; inputSchema?: zod.ZodTypeAny; outputSchema?: zod.ZodTypeAny; }; /** * Creates an async function step for the workflow * * EXPERIMENTAL: This step is experimental and doesn't directly hook into or support the Observability * * @example * ```ts * const nestedWorkflow = createWorkflow( * andThen({ * id: "nested-process", * execute: async ({ data }) => { * const processed = await someAsyncOperation(data.value); * return { ...data, processed }; * } * }) * ); * * const w = createWorkflow( * andThen({ * id: "main-process", * execute: async ({ data }) => { * const processed = await someAsyncOperation(data.value); * return { ...data, processed }; * } * }), * andWorkflow(nestedWorkflow) * ); * ``` * * @param workflow - The workflow to execute as a step * @returns A workflow step that executes the function and returns the result */ declare function andWorkflow(workflow: InternalWorkflow): WorkflowStepWorkflow; /** * Creates a workflow from multiple and* functions * * @example * ```ts * const workflow = createWorkflow({ * id: "user-processing", * name: "User Processing Workflow", * purpose: "Process user data and generate personalized content", * input: z.object({ userId: z.string(), userType: z.enum(["admin", "user"]) }), * result: z.object({ processed: z.boolean(), content: z.string() }), * memory: new InMemoryStorage() // Optional workflow-specific memory * }, * andThen({ * id: "fetch-user", * execute: async ({ data }) => { * const userInfo = await fetchUserInfo(data.userId); * return { ...data, userInfo }; * } * }), * andWhen({ * id: "admin-permissions", * condition: async ({ data }) => data.userType === "admin", * execute: async ({ data }) => ({ ...data, permissions: ["read", "write", "delete"] }) * }), * andAgent( * ({ data }) => `Generate personalized content for ${data.userInfo.name}`, * agent, * { schema: z.object({ content: z.string() }) } * ), * andThen({ * id: "finalize-result", * execute: async ({ data }) => ({ * processed: true, * content: data.content * }) * }) * ); * * // Run with optional memory override * const result = await workflow.run( * { userId: "123", userType: "admin" }, * { memory: new InMemoryStorage() } * ); * ``` * * @param config - The workflow configuration * @param steps - Variable number of and* functions to execute * @returns A configured workflow instance */ declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, S13>, s14: WorkflowStep, S13, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, S13>, s14: WorkflowStep, S13, S14>, s15: WorkflowStep, S14, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, S13>, s14: WorkflowStep, S13, S14>, s15: WorkflowStep, S14, S15>, s16: WorkflowStep, S15, WorkflowResult>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, S13>, s14: WorkflowStep, S13, S14>, s15: WorkflowStep, S14, S15>, s16: WorkflowStep, S15, S16>, s17: WorkflowStep, S16, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, S13>, s14: WorkflowStep, S13, S14>, s15: WorkflowStep, S14, S15>, s16: WorkflowStep, S15, S16>, s17: WorkflowStep, S16, S17>, s18: WorkflowStep, S17, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, S13>, s14: WorkflowStep, S13, S14>, s15: WorkflowStep, S14, S15>, s16: WorkflowStep, S15, S16>, s17: WorkflowStep, S16, S17>, s18: WorkflowStep, S17, S18>, s19: WorkflowStep, S18, z.infer>): Workflow; declare function createWorkflow(config: WorkflowConfig, s1: WorkflowStep, WorkflowInput, S1>, s2: WorkflowStep, S1, S2>, s3: WorkflowStep, S2, S3>, s4: WorkflowStep, S3, S4>, s5: WorkflowStep, S4, S5>, s6: WorkflowStep, S5, S6>, s7: WorkflowStep, S6, S7>, s8: WorkflowStep, S7, S8>, s9: WorkflowStep, S8, S9>, s10: WorkflowStep, S9, S10>, s11: WorkflowStep, S10, S11>, s12: WorkflowStep, S11, S12>, s13: WorkflowStep, S12, S13>, s14: WorkflowStep, S13, S14>, s15: WorkflowStep, S14, S15>, s16: WorkflowStep, S15, S16>, s17: WorkflowStep, S16, S17>, s18: WorkflowStep, S17, S18>, s19: WorkflowStep, S18, S19>, s20: WorkflowStep, S19, z.infer>): Workflow; /** * Serialized workflow step for API/snapshot */ interface SerializedWorkflowStep { id: string; name: string; purpose?: string; type: string; stepIndex: number; inputSchema?: unknown; outputSchema?: unknown; suspendSchema?: unknown; resumeSchema?: unknown; retries?: number; agentId?: string; workflowId?: string; executeFunction?: string; conditionFunction?: string; conditionFunctions?: string[]; loopType?: "dowhile" | "dountil"; sleepDurationMs?: number; sleepDurationFn?: string; sleepUntil?: string; sleepUntilFn?: string; concurrency?: number; mapConfig?: string; guardrailInputCount?: number; guardrailOutputCount?: number; nestedStep?: SerializedWorkflowStep; subSteps?: SerializedWorkflowStep[]; subStepsCount?: number; } /** * A workflow chain that provides a fluent API for building workflows * * @example * ```ts * const workflow = createWorkflowChain({ * id: "user-processing", * name: "User Processing Workflow", * purpose: "Process user data and generate personalized content", * input: z.object({ userId: z.string(), userType: z.enum(["admin", "user"]) }), * result: z.object({ processed: z.boolean(), content: z.string() }), * memory: new Memory({ storage: new LibSQLMemoryAdapter({ url: "file:memory.db" }) }) // Optional workflow-specific memory * }) * .andThen({ * id: "fetch-user", * execute: async ({ data }) => { * const userInfo = await fetchUserInfo(data.userId); * return { ...data, userInfo }; * } * }) * .andWhen({ * id: "admin-permissions", * condition: async ({ data }) => data.userType === "admin", * execute: async ({ data }) => ({ ...data, permissions: ["read", "write", "delete"] }) * }) * .andAgent( * ({ data }) => `Generate personalized content for ${data.userInfo.name}`, * agent, * { schema: z.object({ content: z.string() }) } * ) * .andThen({ * id: "finalize-result", * execute: async ({ data }) => ({ * processed: true, * content: data.content * }) * }); * * // Run with optional memory override * const result = await workflow.run( * { userId: "123", userType: "admin" }, * { memory: new Memory({ storage: new LibSQLMemoryAdapter({ url: "file:memory.db" }) }) } * ); * ``` */ declare class WorkflowChain, SUSPEND_SCHEMA extends z.ZodTypeAny = z.ZodAny, RESUME_SCHEMA extends z.ZodTypeAny = z.ZodAny> { private steps; private config; constructor(config: WorkflowConfig); /** * Creates an agent step for a workflow * * @example * ```ts * const w = createWorkflowChain({ * id: "greeting-workflow", * input: z.object({ name: z.string() }), * result: z.string() * }) * .andAgent( * ({ data }) => `Generate a greeting for the user ${data.name}`, * agent, * { schema: z.object({ greeting: z.string() }) } * ) * .andThen({ * id: "extract-greeting", * execute: async ({ data }) => data.greeting * }) * ``` * * @param task - The task (prompt) to execute for the agent, can be a string or a function that returns a string * @param agent - The agent to execute the task using `generateText` * @param config - The config for the agent (schema) `generateText` call * @param map - Optional mapper to shape or merge the agent output with existing data * @returns A workflow step that executes the agent with the task */ andAgent(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc, CURRENT_DATA, string | UIMessage[] | ModelMessage[], any, any>, agent: Agent, config: AgentConfig, CURRENT_DATA>): WorkflowChain, SUSPEND_SCHEMA, RESUME_SCHEMA>; andAgent(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc, CURRENT_DATA, string | UIMessage[] | ModelMessage[], any, any>, agent: Agent, config: AgentConfig, CURRENT_DATA>, map: (output: InferAgentOutput, context: WorkflowExecuteContext, CURRENT_DATA, any, any>) => Promise | NEW_DATA): WorkflowChain; /** * Add a function step to the workflow with both input and output schemas * @param config - Step configuration with schemas * @returns A new chain with the function step added */ andThen(config: { inputSchema: IS; outputSchema: OS; suspendSchema?: SS; resumeSchema?: RS; execute: (context: { data: z.infer; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer : z.infer) => Promise; resumeData?: RS extends z.ZodTypeAny ? z.infer : z.infer; retryCount?: number; logger: Logger; writer: WorkflowStreamWriter; }) => Promise>; id: string; name?: string; purpose?: string; retries?: number; }): WorkflowChain, SUSPEND_SCHEMA, RESUME_SCHEMA>; /** * Add a function step to the workflow with only input schema * @param config - Step configuration with input schema * @returns A new chain with the function step added */ andThen(config: { inputSchema: IS; outputSchema?: never; suspendSchema?: SS; resumeSchema?: RS; execute: (context: { data: z.infer; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer : z.infer) => Promise; resumeData?: RS extends z.ZodTypeAny ? z.infer : z.infer; retryCount?: number; logger: Logger; writer: WorkflowStreamWriter; }) => Promise; id: string; name?: string; purpose?: string; retries?: number; }): WorkflowChain; /** * Add a function step to the workflow with only output schema * @param config - Step configuration with output schema * @returns A new chain with the function step added */ andThen(config: { inputSchema?: never; outputSchema: OS; suspendSchema?: SS; resumeSchema?: RS; execute: (context: { data: CURRENT_DATA; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer : z.infer) => Promise; resumeData?: RS extends z.ZodTypeAny ? z.infer : z.infer; retryCount?: number; logger: Logger; writer: WorkflowStreamWriter; }) => Promise>; id: string; name?: string; purpose?: string; retries?: number; }): WorkflowChain, SUSPEND_SCHEMA, RESUME_SCHEMA>; /** * Add a function step to the workflow with only resumeSchema * @param config - Step configuration with resumeSchema * @returns A new chain with the function step added */ andThen(config: { inputSchema?: never; outputSchema?: never; suspendSchema?: SS; resumeSchema: RS; execute: (context: { data: CURRENT_DATA; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer : z.infer) => Promise; resumeData?: z.infer; retryCount?: number; logger: Logger; writer: WorkflowStreamWriter; }) => Promise; id: string; name?: string; purpose?: string; retries?: number; }): WorkflowChain; /** * Add a function step to the workflow * * @example * ```ts * const workflow = createWorkflowChain(config) * .andThen({ * id: "process", * execute: async ({ data }) => { * const processed = await someAsyncOperation(data.value); * return { ...data, processed }; * } * }) * .andThen({ * id: "enrich", * execute: async ({ data }) => { * const enriched = await enrichData(data.processed); * return { ...data, enriched }; * } * }); * ``` * * @param config - Step configuration * @returns A new chain with the function step added */ andThen(config: { execute: (context: { data: CURRENT_DATA; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: z.infer) => Promise; resumeData?: z.infer; retryCount?: number; logger: Logger; writer: WorkflowStreamWriter; }) => Promise; id: string; name?: string; purpose?: string; retries?: number; inputSchema?: never; outputSchema?: never; suspendSchema?: z.ZodTypeAny; resumeSchema?: z.ZodTypeAny; }): WorkflowChain; /** * Add a conditional step with explicit schemas * @param config - Step configuration with schemas * @returns A new chain with the conditional step added */ andWhen(config: WorkflowStepConditionalWhenConfig, z.infer, z.infer> & { inputSchema: IS; outputSchema: OS; suspendSchema?: SS; resumeSchema?: RS; condition: (context: { data: z.infer; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer : z.infer) => Promise; resumeData?: RS extends z.ZodTypeAny ? z.infer : z.infer; logger: Logger; writer: WorkflowStreamWriter; }) => Promise; }): WorkflowChain | z.infer, SUSPEND_SCHEMA, RESUME_SCHEMA>; /** * Add a conditional step that executes when a condition is true * * @example * ```ts * const workflow = createWorkflowChain(config) * .andWhen({ * id: "admin-permissions", * condition: async ({ data }) => data.userType === "admin", * execute: async ({ data }) => ({ ...data, permissions: ["read", "write", "delete"] }) * }) * .andWhen({ * id: "high-value-flag", * condition: async ({ data }) => data.value > 1000, * execute: async ({ data }) => ({ ...data, flagged: true, requiresReview: true }) * }) * .andWhen({ * id: "process-pending", * condition: async ({ data }) => data.status === "pending", * execute: async ({ data }) => { * const result = await agent.generateText( * `Process pending request for ${data.userId}`, * { output: Output.object({ schema: z.object({ processed: z.boolean() }) }) } * ); * return { ...data, ...result.output }; * } * }); * ``` * * @param condition - Function that determines if the step should execute based on the current data * @param stepInput - Either a workflow step or an agent to execute when the condition is true * @returns A new chain with the conditional step added */ andWhen(config: WorkflowStepConditionalWhenConfig, CURRENT_DATA, NEW_DATA> & { inputSchema?: never; outputSchema?: never; suspendSchema?: z.ZodTypeAny; resumeSchema?: z.ZodTypeAny; }): WorkflowChain; /** * Add a tap step to the workflow with optional input schema * @param config - Step configuration with optional inputSchema * @returns A new chain with the tap step added (data unchanged) */ andTap(config: { inputSchema: IS; suspendSchema?: SS; resumeSchema?: RS; execute: (context: { data: z.infer; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: SS extends z.ZodTypeAny ? z.infer : z.infer) => Promise; resumeData?: RS extends z.ZodTypeAny ? z.infer : z.infer; retryCount?: number; logger: Logger; writer: WorkflowStreamWriter; }) => Promise; id: string; name?: string; purpose?: string; retries?: number; }): WorkflowChain; /** * Add a tap step to the workflow * * @example * ```ts * const workflow = createWorkflowChain(config) * .andTap({ * id: "log-translation", * execute: async ({ data }) => { * console.log("🔄 Translating text:", data); * } * }) * .andThen({ * id: "return-translation", * // the input data is still the same as the andTap ONLY executes, it doesn't return anything * execute: async ({ data }) => { * return { ...data, translatedText: data.translatedText }; * } * }); * ``` * * @param fn - The async function to execute with the current workflow data * @returns A new chain with the tap step added */ andTap<_NEW_DATA>(config: { execute: (context: { data: CURRENT_DATA; state: WorkflowStepState>; workflowState: WorkflowStateStore; setWorkflowState: (update: WorkflowStateUpdater) => void; getStepData: (stepId: string) => WorkflowStepData | undefined; suspend: (reason?: string, suspendData?: z.infer) => Promise; resumeData?: z.infer; retryCount?: number; logger: Logger; writer: WorkflowStreamWriter; }) => Promise; id: string; name?: string; purpose?: string; retries?: number; inputSchema?: never; suspendSchema?: z.ZodTypeAny; resumeSchema?: z.ZodTypeAny; }): WorkflowChain; /** * Add a guardrail step to validate or sanitize data */ andGuardrail(config: WorkflowStepGuardrailConfig, CURRENT_DATA>): WorkflowChain; /** * Add a sleep step to the workflow */ andSleep(config: WorkflowStepSleepConfig, CURRENT_DATA>): WorkflowChain; /** * Add a sleep-until step to the workflow */ andSleepUntil(config: WorkflowStepSleepUntilConfig, CURRENT_DATA>): WorkflowChain; /** * Add a branching step that runs all matching branches */ andBranch(config: WorkflowStepBranchConfig, CURRENT_DATA, NEW_DATA>): WorkflowChain, SUSPEND_SCHEMA, RESUME_SCHEMA>; /** * Add a foreach step that runs a step for each item in an array */ andForEach(config: WorkflowStepForEachConfig, CURRENT_DATA, ITEM, NEW_DATA, MAP_DATA>): WorkflowChain; /** * Add a do-while loop step */ andDoWhile(config: WorkflowStepLoopConfig, CURRENT_DATA, NEW_DATA>): WorkflowChain; /** * Add a do-until loop step */ andDoUntil(config: WorkflowStepLoopConfig, CURRENT_DATA, NEW_DATA>): WorkflowChain; /** * Add a mapping step to the workflow */ andMap, CURRENT_DATA>>>(config: WorkflowStepMapConfig, CURRENT_DATA, MAP>): WorkflowChain, SUSPEND_SCHEMA, RESUME_SCHEMA>; /** * Add a workflow step to the workflow * * @example * ```ts * import { myWorkflow } from "./my-workflow"; * * const workflow = createWorkflowChain(config) * .andThen({ * id: "fetch-user", * execute: async ({ data }) => { * const userInfo = await fetchUserInfo(data.userId); * return { userInfo }; * } * }) * .andWorkflow(myWorkflow) * ``` */ andWorkflow(workflow: InternalWorkflow): WorkflowChain; /** * Add a parallel execution step that runs multiple steps simultaneously and waits for all to complete * * @example * ```ts * const workflow = createWorkflowChain(config) * .andAll({ * id: "parallel-fetch", * steps: [ * { * id: "fetch-user", * execute: async ({ data }) => { * const userInfo = await fetchUserInfo(data.userId); * return { userInfo }; * } * }, * { * id: "fetch-permissions", * execute: async ({ data }) => { * const permissions = await fetchPermissions(data.userId); * return { permissions }; * } * }, * { * id: "generate-recommendations", * execute: async ({ data }) => { * const result = await agent.generateText( * `Generate recommendations for user ${data.userId}`, * { output: Output.object({ schema: z.object({ recommendations: z.array(z.string()) }) }) } * ); * return result.output; * } * } * ] * }) * .andThen({ * id: "combine-results", * execute: async ({ data }) => { * // data is now an array: [{ userInfo }, { permissions }, { recommendations }] * return { combined: data.flat() }; * } * }); * ``` * * @param steps - Array of workflow steps to execute in parallel * @returns A new chain with the parallel step added */ andAll, CURRENT_DATA, NEW_DATA>>, INFERRED_RESULT = InternalInferWorkflowStepsResult>({ steps, ...config }: WorkflowStepParallelAllConfig, CURRENT_DATA, NEW_DATA, STEPS>): WorkflowChain; /** * Add a race execution step that runs multiple steps simultaneously and returns the first completed result * * @example * ```ts * const workflow = createWorkflowChain(config) * .andRace({ * id: "race-data-sources", * steps: [ * { * id: "check-cache", * execute: async ({ data }) => { * // Fast operation * const cacheResult = await checkCache(data.query); * return { source: "cache", result: cacheResult }; * } * }, * { * id: "query-database", * execute: async ({ data }) => { * // Slower operation * const dbResult = await queryDatabase(data.query); * return { source: "database", result: dbResult }; * } * }, * { * id: "ai-fallback", * execute: async ({ data }) => { * const result = await agent.generateText( * `Generate fallback response for: ${data.query}`, * { * output: Output.object({ * schema: z.object({ source: z.literal("ai"), result: z.string() }), * }), * } * ); * return result.output; * } * } * ] * }) * .andThen({ * id: "process-result", * execute: async ({ data }) => { * // data is the result from whichever step completed first * return { finalResult: data.result, source: data.source }; * } * }); * ``` * * @param steps - Array of workflow steps to execute in parallel * @returns A new chain with the race step added */ andRace, CURRENT_DATA, NEW_DATA>>, INFERRED_RESULT = InternalInferWorkflowStepsResult[number]>({ steps, ...config }: WorkflowStepParallelRaceConfig): WorkflowChain; /** * Convert the current chain to a runnable workflow */ toWorkflow(): Workflow; /** * Execute the workflow with the given input */ run(input: WorkflowInput, options?: WorkflowRunOptions): Promise>; /** * Start the workflow in the background without waiting for completion */ startAsync(input: WorkflowInput, options?: WorkflowRunOptions): Promise; /** * Replay a historical execution from the selected step * This recreates a workflow instance via `createWorkflow(...)` on each call. * Use persistent/shared memory (or register the workflow) so source execution state is discoverable. * For ephemeral setup patterns, prefer `chain.toWorkflow().timeTravel(...)` and reuse that instance. */ timeTravel(options: WorkflowTimeTravelOptions): Promise>; /** * Stream a historical replay from the selected step * This recreates a workflow instance via `createWorkflow(...)` on each call. * Use persistent/shared memory (or register the workflow) so source execution state is discoverable. * For ephemeral setup patterns, prefer `chain.toWorkflow().timeTravelStream(...)` and reuse that instance. */ timeTravelStream(options: WorkflowTimeTravelOptions): WorkflowStreamResult; /** * Restart an interrupted execution from persisted checkpoint state * This recreates a workflow instance via `createWorkflow(...)` on each call. * Use persistent/shared memory (or register the workflow) so prior execution state is discoverable. * For ephemeral setup patterns, prefer `chain.toWorkflow().restart(...)` and reuse that instance. */ restart(executionId: string, options?: WorkflowRunOptions): Promise>; /** * Restart all active (running) executions for this workflow * This recreates a workflow instance via `createWorkflow(...)` on each call. * Use persistent/shared memory (or register the workflow) so active executions can be found. * For ephemeral setup patterns, prefer `chain.toWorkflow().restartAllActive()` and reuse that instance. */ restartAllActive(): Promise; /** * Execute the workflow with streaming support */ stream(input: WorkflowInput, options?: WorkflowRunOptions): WorkflowStreamResult; } /** * Creates a new workflow chain with the given configuration */ declare function createWorkflowChain(config: WorkflowConfig): WorkflowChain, SUSPEND_SCHEMA, RESUME_SCHEMA>; /** * Workflow registration information */ interface RegisteredWorkflow { workflow: Workflow; registeredAt: Date; executionCount: number; lastExecutedAt?: Date; inputSchema?: any; suspendSchema?: any; resumeSchema?: any; resultSchema?: any; } /** * Singleton registry for managing workflows and their execution history */ declare global { var ___voltagent_workflow_registry: WorkflowRegistry | undefined; } declare class WorkflowRegistry extends SimpleEventEmitter { private workflows; private logger; activeExecutions: Map; private constructor(); /** * Get the singleton instance of WorkflowRegistry */ static getInstance(): WorkflowRegistry; /** * Clears registry state. Primarily used by tests for deterministic isolation. */ reset(): void; /** * Register a workflow with the registry */ registerWorkflow(workflow: Workflow): void; /** * Get a specific workflow by ID */ getWorkflow(id: string): RegisteredWorkflow | undefined; /** * Get all registered workflows */ getAllWorkflows(): RegisteredWorkflow[]; /** * Unregister a workflow from the registry */ unregisterWorkflow(id: string): void; /** * Get workflow statistics */ getWorkflowStats(_workflowId: string): { totalExecutions: number; successfulExecutions: number; failedExecutions: number; averageExecutionTime: number; lastExecutionTime?: Date; }; /** * Get all workflow IDs that have registrations */ getAllWorkflowIds(): string[]; /** * Get total number of registered workflows */ getWorkflowCount(): number; /** * Resume a suspended workflow execution */ resumeSuspendedWorkflow(workflowId: string, executionId: string, resumeData?: any, resumeStepId?: string): Promise | null>; /** * Restart a running workflow execution from persisted checkpoint state */ restartWorkflowExecution(workflowId: string, executionId: string, options?: WorkflowRunOptions): Promise>; /** * Restart all active (running) workflow executions */ restartAllActiveWorkflowRuns(options?: { workflowId?: string; }): Promise; /** * Get all suspended workflow executions */ getSuspendedWorkflows(): Promise>; /** * Get workflows as API response format */ getWorkflowsForApi(): { id: string; name: string; purpose: string; stepsCount: number; status: "idle"; }[]; /** * Suspend all active workflows for graceful shutdown */ suspendAllActiveWorkflows(reason?: string): Promise; /** * Get detailed workflow with serialized steps for API response */ getWorkflowDetailForApi(id: string): { id: string; name: string; purpose: string; stepsCount: number; status: "idle"; steps: SerializedWorkflowStep[]; inputSchema: any; resultSchema: any; suspendSchema: any; resumeSchema: any; } | null; } /** * Creates a workflow suspension controller that can be used to externally suspend a running workflow. * * @example * ```typescript * import { createSuspendController } from "@voltagent/core"; * * // Create controller * const controller = createSuspendController(); * * // Run workflow with controller * const execution = await workflow.run(input, { suspendController: controller }); * * // Suspend from outside * controller.suspend("Waiting for approval"); * * // Check status * if (controller.isSuspended()) { * console.log("Suspended because:", controller.getReason()); * } * ``` */ declare function createSuspendController(): WorkflowSuspendController; declare const FILESYSTEM_SYSTEM_PROMPT = "You have access to a virtual filesystem. All file paths must start with a /.\n\n- ls: list files in a directory (requires absolute path)\n- read_file: read a file from the filesystem\n- write_file: write to a file in the filesystem\n- edit_file: edit a file in the filesystem\n- delete_file: delete a file from the filesystem\n- glob: find files matching a pattern (e.g., \"**/*.ts\")\n- grep: search for text within files"; declare const LS_TOOL_DESCRIPTION = "List files and directories in a directory"; declare const READ_FILE_TOOL_DESCRIPTION = "Read the contents of a file"; declare const WRITE_FILE_TOOL_DESCRIPTION = "Write content to a new file. Returns an error if the file already exists"; declare const EDIT_FILE_TOOL_DESCRIPTION = "Edit a file by replacing a specific string with a new string"; declare const DELETE_FILE_TOOL_DESCRIPTION = "Delete a file from the filesystem"; declare const GLOB_TOOL_DESCRIPTION = "Find files matching a glob pattern (e.g., '**/*.ts' for all TypeScript files)"; declare const GREP_TOOL_DESCRIPTION = "Search for a regex pattern in files. Returns matching files and line numbers"; type FilesystemToolkitOptions = { backend?: FilesystemBackend | FilesystemBackendFactory; systemPrompt?: string | null; customToolDescriptions?: Record | null; toolTokenLimitBeforeEvict?: number | null; }; declare function createFilesystemToolkit(agent: Agent, options?: FilesystemToolkitOptions): Toolkit; declare function createToolResultEvictor(options: { agent: Agent; backend: FilesystemBackend | FilesystemBackendFactory; tokenLimit: number; excludeToolNames?: string[]; }): (tool: Tool) => Tool; type PlanAgentTodoStatus = "pending" | "in_progress" | "done"; type PlanAgentTodoItem = { id: string; content: string; status: PlanAgentTodoStatus; createdAt?: string; updatedAt?: string; }; type PlanAgentFileData = FileData; type PlanAgentState = { todos?: PlanAgentTodoItem[]; files?: Record; }; type TodoBackend = { listTodos(): Promise; setTodos(todos: PlanAgentTodoItem[]): Promise; }; type TodoBackendFactory = (context: { agent: Agent; operationContext: OperationContext; }) => TodoBackend; declare class ConversationTodoBackend implements TodoBackend { private agent; private operationContext; constructor(agent: Agent, operationContext: OperationContext); listTodos(): Promise; setTodos(todos: PlanAgentTodoItem[]): Promise; } declare const WRITE_TODOS_TOOL_NAME = "write_todos"; declare const WRITE_TODOS_TOOL_DESCRIPTION = "Write or update the current todo list for the conversation"; type PlanningToolkitOptions = { backend?: TodoBackend | TodoBackendFactory; systemPrompt?: string | null; }; declare function createPlanningToolkit(agent: Agent, options?: PlanningToolkitOptions): Toolkit; type PlanAgentSubagentConfigDefinition = Exclude; type PlanAgentCustomSubagentDefinition = Omit & { name: string; description?: string; systemPrompt: string; model?: AgentOptions["model"]; tools?: (Tool | Toolkit | Tool$1)[]; toolkits?: Toolkit[]; }; type PlanAgentSubagentDefinition = Agent | PlanAgentSubagentConfigDefinition | PlanAgentCustomSubagentDefinition; type TaskToolOptions = { systemPrompt?: string | null; taskDescription?: string | null; maxSteps?: number; supervisorConfig?: SupervisorConfig; }; type PlanAgentOptions = Omit & { systemPrompt?: InstructionsDynamicValue; tools?: (Tool | Toolkit | Tool$1)[]; toolkits?: Toolkit[]; toolRouting?: ToolRoutingConfig | false; subagents?: PlanAgentSubagentDefinition[]; generalPurposeAgent?: boolean; planning?: PlanningToolkitOptions | false; summarization?: AgentOptions["summarization"]; filesystem?: FilesystemToolkitOptions | false; task?: TaskToolOptions | false; extensions?: PlanAgentExtension[]; toolResultEviction?: { enabled?: boolean; tokenLimit?: number; }; }; type PlanAgentExtensionContext = { agentRef: () => Agent | undefined; options: PlanAgentOptions; planningEnabled: boolean; }; type PlanAgentExtensionResult = { systemPrompt?: string | null; hooks?: AgentHooks; tools?: (Tool | Toolkit | Tool$1)[]; toolkits?: Toolkit[] | ((agent: Agent) => Toolkit[]); subagents?: PlanAgentSubagentDefinition[]; afterSubagents?: (options: { agent: Agent; subagents: Array<{ name: string; description: string; config: SubAgentConfig; }>; }) => Toolkit | Toolkit[] | null; }; type PlanAgentExtension = { name: string; apply: (context: PlanAgentExtensionContext) => PlanAgentExtensionResult | null | undefined; }; declare class PlanAgent extends Agent { constructor(options: PlanAgentOptions); } /** * Enum defining the next action to take after a reasoning step. */ declare enum NextAction { CONTINUE = "continue", VALIDATE = "validate", FINAL_ANSWER = "final_answer" } /** * Zod schema for the ReasoningStep data structure. */ declare const ReasoningStepSchema: z.ZodObject<{ id: z.ZodString; type: z.ZodEnum<["thought", "analysis"]>; title: z.ZodString; reasoning: z.ZodString; action: z.ZodOptional; result: z.ZodOptional; next_action: z.ZodOptional>; confidence: z.ZodDefault>; timestamp: z.ZodString; historyEntryId: z.ZodString; agentId: z.ZodString; }, "strip", z.ZodTypeAny, { type: "thought" | "analysis"; title: string; id: string; reasoning: string; timestamp: string; historyEntryId: string; agentId: string; confidence: number; action?: string | undefined; result?: string | undefined; next_action?: NextAction | undefined; }, { type: "thought" | "analysis"; title: string; id: string; reasoning: string; timestamp: string; historyEntryId: string; agentId: string; action?: string | undefined; result?: string | undefined; next_action?: NextAction | undefined; confidence?: number | undefined; }>; /** * TypeScript type inferred from the ReasoningStepSchema. */ type ReasoningStep = z.infer; declare const DEFAULT_INSTRUCTIONS = "\nYou are equipped with 'think' and 'analyze' capabilities to methodically tackle problems and organize your reasoning process. ALWAYS utilize 'think' before initiating any tool calls or formulating a response.\n\n1. **Think** (Internal Workspace):\n * Objective: Employ the 'think' tool as an internal workspace to dissect complex issues, chart out solution paths, and determine the next steps in your reasoning. Use this to organize your internal thought process.\n * Method: Invoke 'think' repeatedly if necessary for problem decomposition. Articulate your rationale and specify the planned next step (e.g., \"initiate tool call,\" \"compute value,\" \"request clarification\").\n\n2. **Analyze** (Assessment):\n * Objective: Assess the outcome of a thinking phase or a sequence of tool interactions. Determine if the outcome aligns with expectations, is adequate, or necessitates further exploration.\n * Method: Call 'analyze' following a series of tool uses or a completed thought sequence. Define the 'next_action' based on your assessment: 'continue' (further reasoning is required), 'validate' (if possible, seek external verification), or 'final_answer' (prepared to deliver the conclusion).\n * Justify your assessment, indicating whether the result is accurate/sufficient.\n\n## Core Principles\n* **Initiate with Thought:** It is MANDATORY to use the 'think' tool prior to other tool interactions or response generation, except for trivial requests. Use 'think' multiple times for intricate problems.\n* **Iterative Problem Solving:** Employ 'think' and 'analyze' in cycles to construct a transparent reasoning trajectory. The standard sequence is Think -> [Think -> ...] -> [Tool Calls if needed] -> [Analyze if needed] -> ... -> final_answer. Repeat this loop until a satisfactory resolution is achieved.\n* **Parallel Tool Execution:** Following a 'think' step, multiple tool calls can be executed concurrently if required.\n* **Maintain Internal Reasoning:** The steps involving 'think' and 'analyze' constitute your internal cognitive process. Do not expose these steps directly to the user unless specifically asked to elaborate on your reasoning.\n* **Deliver Concise Conclusions:** Once your analysis concludes with 'next_action: final_answer', present a clear and precise final answer to the user, synthesized from your reasoning steps.\n"; declare const FEW_SHOT_EXAMPLES = "\n## Illustrations\n\n**Illustration 1: Basic Knowledge Retrieval**\n\n*User Query:* What is the tallest mountain in the world?\n\n*Agent's Internal Processing:*\n```json\n{\n \"tool_call\": {\n \"name\": \"think\",\n \"arguments\": {\n \"title\": \"Parse Request\",\n \"thought\": \"The user is asking for the name of the world's highest peak. This is well-known geographical data.\",\n \"action\": \"Recall or look up the tallest mountain.\",\n \"confidence\": 0.98\n }\n }\n}\n```\n*--(Agent internally accesses the information)--*\n```json\n{\n \"tool_call\": {\n \"name\": \"analyze\",\n \"arguments\": {\n \"title\": \"Assess Information\",\n \"result\": \"Mount Everest is recognized as the tallest mountain above sea level.\",\n \"analysis\": \"The retrieved data directly answers the user's query accurately.\",\n \"next_action\": \"final_answer\",\n \"confidence\": 1.0\n }\n }\n}\n```\n\n*Agent's Final Response to User:*\nThe tallest mountain in the world is Mount Everest.\n\n**Illustration 2: Sequential Information Gathering**\n\n*User Query:* Who directed the movie 'Inception' and what year was it released?\n\n*Agent's Internal Processing:*\n```json\n{\n \"tool_call\": {\n \"name\": \"think\",\n \"arguments\": {\n \"title\": \"Outline Information Needs\",\n \"thought\": \"The request asks for two specific details about the movie 'Inception': its director and release year. I'll handle these sequentially. First, find the director.\",\n \"action\": \"Search for the director of 'Inception'.\",\n \"confidence\": 0.95\n }\n }\n}\n```\n*--(Tool interaction: search(query=\"director of Inception\"))--*\n*--(Tool Outcome: \"Christopher Nolan\")--*\n```json\n{\n \"tool_call\": {\n \"name\": \"analyze\",\n \"arguments\": {\n \"title\": \"Evaluate Director Search\",\n \"result\": \"The search identified Christopher Nolan as the director.\",\n \"analysis\": \"This fulfills the first part of the request. Next, I need the release year.\",\n \"next_action\": \"continue\",\n \"confidence\": 1.0\n }\n }\n}\n```\n```json\n{\n \"tool_call\": {\n \"name\": \"think\",\n \"arguments\": {\n \"title\": \"Plan Release Year Retrieval\",\n \"thought\": \"The subsequent step is to determine the release year for 'Inception'.\",\n \"action\": \"Search for the release year of 'Inception'.\",\n \"confidence\": 0.95\n }\n }\n}\n```\n*--(Tool interaction: search(query=\"release year of Inception\"))--*\n*--(Tool Outcome: \"2010\")--*\n```json\n{\n \"tool_call\": {\n \"name\": \"analyze\",\n \"arguments\": {\n \"title\": \"Evaluate Release Year Search\",\n \"result\": \"The search indicated the release year was 2010.\",\n \"analysis\": \"I have now obtained both the director's name and the release year. I am ready to formulate the final response.\",\n \"next_action\": \"final_answer\",\n \"confidence\": 1.0\n }\n }\n}\n```\n\n*Agent's Final Response to User:*\nThe movie 'Inception' was directed by Christopher Nolan and released in 2010.\n"; type CreateReasoningToolsOptions = { addInstructions?: boolean; think?: boolean; analyze?: boolean; addFewShot?: boolean; fewShotExamples?: string; }; /** * Factory function to create a Toolkit containing reasoning tools and instructions. */ declare const createReasoningTools: (options?: CreateReasoningToolsOptions) => Toolkit; type BaseGuardrailOptions = { id?: string; name?: string; description?: string; severity?: GuardrailSeverity; }; type SensitiveNumberGuardrailOptions = BaseGuardrailOptions & { /** * Minimum digit run length that will be redacted. * @default 4 */ minimumDigits?: number; /** * Replacement text used for redacted segments. * @default "[redacted]" */ replacement?: string; }; type EmailGuardrailOptions = BaseGuardrailOptions & { replacement?: string; }; type PhoneGuardrailOptions = BaseGuardrailOptions & { replacement?: string; }; type ProfanityGuardrailMode = "redact" | "block"; type ProfanityGuardrailOptions = BaseGuardrailOptions & { bannedWords?: string[]; replacement?: string; mode?: ProfanityGuardrailMode; }; type MaxLengthGuardrailMode = "truncate" | "block"; type MaxLengthGuardrailOptions = BaseGuardrailOptions & { maxCharacters: number; mode?: MaxLengthGuardrailMode; }; type InputGuardrailBaseOptions = BaseGuardrailOptions & { message?: string; }; type ProfanityInputGuardrailOptions = InputGuardrailBaseOptions & { bannedWords?: string[]; replacement?: string; mode?: "mask" | "block"; }; type PIIInputGuardrailOptions = InputGuardrailBaseOptions & { replacement?: string; maskEmails?: boolean; maskPhones?: boolean; }; type PromptInjectionGuardrailOptions = InputGuardrailBaseOptions & { phrases?: string[]; }; type InputLengthGuardrailOptions = InputGuardrailBaseOptions & { maxCharacters: number; mode?: MaxLengthGuardrailMode; }; type HTMLSanitizerGuardrailOptions = InputGuardrailBaseOptions & { allowBasicFormatting?: boolean; }; /** * Creates a guardrail that redacts long numeric sequences such as account or card numbers. */ declare function createSensitiveNumberGuardrail(options?: SensitiveNumberGuardrailOptions): OutputGuardrail; /** * Creates a guardrail that redacts email addresses. */ declare function createEmailRedactorGuardrail(options?: EmailGuardrailOptions): OutputGuardrail; /** * Creates a guardrail that redacts common phone number patterns. */ declare function createPhoneNumberGuardrail(options?: PhoneGuardrailOptions): OutputGuardrail; /** * Creates a guardrail that detects profanity and either redacts or blocks output. */ declare function createProfanityGuardrail(options?: ProfanityGuardrailOptions): OutputGuardrail; /** * Guardrail that enforces a maximum character length. */ declare function createMaxLengthGuardrail(options: MaxLengthGuardrailOptions): OutputGuardrail; declare function createProfanityInputGuardrail(options?: ProfanityInputGuardrailOptions): InputGuardrail; declare function createPIIInputGuardrail(options?: PIIInputGuardrailOptions): InputGuardrail; declare function createPromptInjectionGuardrail(options?: PromptInjectionGuardrailOptions): InputGuardrail; declare function createInputLengthGuardrail(options: InputLengthGuardrailOptions): InputGuardrail; declare function createHTMLSanitizerInputGuardrail(options?: HTMLSanitizerGuardrailOptions): InputGuardrail; declare function createDefaultInputSafetyGuardrails(): InputGuardrail[]; /** * Convenience helper that returns a collection of common PII guardrails. */ declare function createDefaultPIIGuardrails(options?: { sensitiveNumber?: SensitiveNumberGuardrailOptions; email?: EmailGuardrailOptions; phone?: PhoneGuardrailOptions; }): OutputGuardrail[]; /** * Convenience helper that returns commonly recommended safety guardrails. */ declare function createDefaultSafetyGuardrails(options?: { profanity?: ProfanityGuardrailOptions; maxLength?: MaxLengthGuardrailOptions; }): OutputGuardrail[]; type EmptyGuardrailExtras = Record; type CreateGuardrailDefinition = EmptyGuardrailExtras> = Omit, keyof TExtra | "handler"> & TExtra & { handler: GuardrailFunction; }; type CreateInputGuardrailOptions = CreateGuardrailDefinition; type CreateOutputGuardrailOptions = CreateGuardrailDefinition, OutputGuardrailResult, { streamHandler?: OutputGuardrailStreamHandler; }>; declare function createInputGuardrail(options: CreateInputGuardrailOptions): InputGuardrail; declare function createOutputGuardrail(options: CreateOutputGuardrailOptions): OutputGuardrail; type EmptyMiddlewareExtras = Record; type CreateMiddlewareDefinition = EmptyMiddlewareExtras> = Omit, keyof TExtra | "handler"> & TExtra & { handler: MiddlewareFunction; }; type CreateInputMiddlewareOptions = CreateMiddlewareDefinition; type CreateOutputMiddlewareOptions = CreateMiddlewareDefinition, OutputMiddlewareResult>; declare function createInputMiddleware(options: CreateInputMiddlewareOptions): InputMiddleware; declare function createOutputMiddleware(options: CreateOutputMiddlewareOptions): OutputMiddleware; declare const getGlobalVoltOpsClient: () => VoltOpsClient | undefined; /** * Prompt manager with caching and Liquid template processing */ /** * Implementation of VoltOpsPromptManager with caching and Liquid templates */ declare class VoltOpsPromptManagerImpl implements VoltOpsPromptManager { private readonly cache; private readonly apiClient; private readonly templateEngine; private readonly cacheConfig; private readonly logger; constructor(options: VoltOpsClientOptions); /** * Get prompt content by reference with caching and template processing */ getPrompt(reference: PromptReference): Promise; /** * Preload prompts for better performance */ preload(references: PromptReference[]): Promise; /** * Clear cache */ clearCache(): void; /** * Get cache statistics */ getCacheStats(): { size: number; entries: string[]; }; /** * Convert API response to PromptContent with metadata */ private convertApiResponseToPromptContent; /** * Generate cache key for prompt reference */ private getCacheKey; /** * Get cached prompt if valid */ private getCachedPrompt; /** * Set cached prompt with TTL and size limit enforcement */ private setCachedPrompt; /** * Evict oldest cache entry to make room for new one */ private evictOldestEntry; /** * Process template variables using configured template engine */ private processTemplate; /** * Process PromptContent with template processing */ private processPromptContent; /** * Process MessageContent (can be string or array of parts) */ private processMessageContent; } /** * API client for prompt operations */ /** * Implementation of PromptApiClient for VoltOps API communication */ declare class VoltOpsPromptApiClient implements PromptApiClient { private readonly baseUrl; private readonly publicKey; private readonly secretKey; private readonly fetchFn; private readonly logger; constructor(options: VoltOpsClientOptions); /** * Fetch prompt content from VoltOps API */ fetchPrompt(reference: PromptReference): Promise; /** * Build URL for prompt API endpoint */ private buildPromptUrl; /** * Build authentication headers */ private buildHeaders; } /** * Simple template engine for basic variable substitution */ /** * Template engine interface */ type TemplateEngine = { /** Process template with variables */ process: (content: string, variables: Record) => string; /** Engine name for debugging */ name: string; }; /** * Simple mustache-style template engine (built-in, no dependencies) * Supports {{variable}} syntax for basic variable substitution */ declare const createSimpleTemplateEngine: () => TemplateEngine; declare const TRIGGER_CONTEXT_KEY: unique symbol; declare const SERVERLESS_ENV_CONTEXT_KEY: unique symbol; interface DefaultTriggerCatalogEntry { triggerId: string; dslTriggerId?: string; displayName: string; service: string; category?: string | null; authType?: string | null; deliveryModes: string[]; beta?: boolean; defaultVersion?: string | null; metadata?: Record | null; version?: string; sourceHash?: string | null; payloadSchema?: Record | null; configSchema?: Record | null; versionMetadata?: Record | null; events: ReadonlyArray; } interface DefaultTriggerCatalogEvent extends Record { key: string; displayName: string; description: string; deliveryMode: string; defaultConfig?: Record | null; [key: string]: unknown; } declare const DEFAULT_TRIGGER_CATALOG: readonly [{ readonly triggerId: "cron"; readonly displayName: "Cron Trigger"; readonly service: "Scheduler"; readonly category: "Platform & General"; readonly authType: null; readonly deliveryModes: ["schedule"]; readonly metadata: { readonly description: "Run an agent or workflow on a recurring schedule using cron expressions."; }; readonly version: "1.0.0"; readonly events: readonly [{ readonly key: "cron.schedule"; readonly displayName: "Scheduled run"; readonly description: "Execute on the provided cron expression schedule (e.g., every minute, hourly)."; readonly deliveryMode: "schedule"; readonly defaultConfig: { readonly schedule: { readonly type: "cron"; readonly expression: "*/5 * * * *"; readonly timezone: "UTC"; }; }; }]; }, { readonly triggerId: "gmail-new-email"; readonly dslTriggerId: "gmail"; readonly displayName: "Gmail"; readonly service: "Gmail"; readonly category: "Email & Messaging"; readonly authType: "oauth2"; readonly deliveryModes: ["polling"]; readonly metadata: { readonly description: "Trigger when a new email appears in a selected Gmail inbox or label."; }; readonly version: "1.0.0"; readonly events: readonly [{ readonly key: "gmail.newEmail"; readonly displayName: "New email"; readonly description: "Detect new emails in the configured Gmail account and optional label or search filter."; readonly deliveryMode: "polling"; }]; }, { readonly triggerId: "github"; readonly displayName: "GitHub"; readonly service: "GitHub"; readonly category: "Developer Tools"; readonly authType: "token"; readonly deliveryModes: ["webhook"]; readonly metadata: { readonly description: "Trigger workflows from GitHub repository activity such as pushes, pull requests, or issue updates."; readonly docsUrl: "https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads"; }; readonly version: "1.0.0"; readonly events: readonly [{ readonly key: "github.*"; readonly displayName: "Any event"; readonly description: "Emit whenever GitHub delivers any webhook event (wildcard)."; readonly deliveryMode: "webhook"; }, { readonly key: "github.check_run"; readonly displayName: "Check run"; readonly description: "Triggered when a check run is created, rerequested, completed, or has a requested action."; readonly deliveryMode: "webhook"; }, { readonly key: "github.check_suite"; readonly displayName: "Check suite"; readonly description: "Triggered when a check suite is completed, requested, or rerequested."; readonly deliveryMode: "webhook"; }, { readonly key: "github.commit_comment"; readonly displayName: "Commit comment"; readonly description: "Triggered when a commit comment is created."; readonly deliveryMode: "webhook"; }, { readonly key: "github.create"; readonly displayName: "Create"; readonly description: "Triggered when a repository, branch, or tag is created."; readonly deliveryMode: "webhook"; }, { readonly key: "github.delete"; readonly displayName: "Delete"; readonly description: "Triggered when a repository branch or tag is deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.deploy_key"; readonly displayName: "Deploy key"; readonly description: "Triggered when a deploy key is added or removed from a repository."; readonly deliveryMode: "webhook"; }, { readonly key: "github.deployment"; readonly displayName: "Deployment"; readonly description: "Triggered when a deployment is created."; readonly deliveryMode: "webhook"; }, { readonly key: "github.deployment_status"; readonly displayName: "Deployment status"; readonly description: "Triggered when the status of a deployment changes."; readonly deliveryMode: "webhook"; }, { readonly key: "github.fork"; readonly displayName: "Fork"; readonly description: "Triggered when a user forks a repository."; readonly deliveryMode: "webhook"; }, { readonly key: "github.github_app_authorization"; readonly displayName: "GitHub App authorization"; readonly description: "Triggered when someone revokes their authorization of a GitHub App."; readonly deliveryMode: "webhook"; }, { readonly key: "github.gollum"; readonly displayName: "Gollum"; readonly description: "Triggered when a Wiki page is created or updated."; readonly deliveryMode: "webhook"; }, { readonly key: "github.installation"; readonly displayName: "Installation"; readonly description: "Triggered when someone installs, uninstalls, or accepts new permissions for a GitHub App."; readonly deliveryMode: "webhook"; }, { readonly key: "github.installation_repositories"; readonly displayName: "Installation repositories"; readonly description: "Triggered when a repository is added or removed from a GitHub App installation."; readonly deliveryMode: "webhook"; }, { readonly key: "github.issue_comment"; readonly displayName: "Issue comment"; readonly description: "Triggered when an issue comment is created, edited, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.issues"; readonly displayName: "Issues"; readonly description: "Triggered when an issue is created, edited, deleted, transferred, pinned, closed, reopened, or changed."; readonly deliveryMode: "webhook"; }, { readonly key: "github.label"; readonly displayName: "Label"; readonly description: "Triggered when a repository's label is created, edited, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.marketplace_purchase"; readonly displayName: "Marketplace purchase"; readonly description: "Triggered when a GitHub Marketplace plan is purchased, upgraded, downgraded, or cancelled."; readonly deliveryMode: "webhook"; }, { readonly key: "github.member"; readonly displayName: "Member"; readonly description: "Triggered when a user accepts an invitation, is removed, or has permissions changed as a collaborator."; readonly deliveryMode: "webhook"; }, { readonly key: "github.membership"; readonly displayName: "Membership"; readonly description: "Triggered when a user is added or removed from a team (organization hooks only)."; readonly deliveryMode: "webhook"; }, { readonly key: "github.meta"; readonly displayName: "Meta"; readonly description: "Triggered when the webhook configuration itself is deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.milestone"; readonly displayName: "Milestone"; readonly description: "Triggered when a milestone is created, closed, opened, edited, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.org_block"; readonly displayName: "Org block"; readonly description: "Triggered when an organization blocks or unblocks a user (organization hooks only)."; readonly deliveryMode: "webhook"; }, { readonly key: "github.organization"; readonly displayName: "Organization"; readonly description: "Triggered when an organization is renamed, deleted, or membership changes (organization hooks only)."; readonly deliveryMode: "webhook"; }, { readonly key: "github.page_build"; readonly displayName: "Page build"; readonly description: "Triggered on pushes to a GitHub Pages enabled branch that results in a page build."; readonly deliveryMode: "webhook"; }, { readonly key: "github.project"; readonly displayName: "Project"; readonly description: "Triggered when a project is created, updated, closed, reopened, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.project_card"; readonly displayName: "Project card"; readonly description: "Triggered when a project card is created, edited, moved, converted to an issue, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.project_column"; readonly displayName: "Project column"; readonly description: "Triggered when a project column is created, updated, moved, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.public"; readonly displayName: "Public"; readonly description: "Triggered when a private repository is open sourced."; readonly deliveryMode: "webhook"; }, { readonly key: "github.pull_request"; readonly displayName: "Pull request"; readonly description: "Triggered when a pull request is opened, edited, closed, reopened, labeled, assigned, or synchronized."; readonly deliveryMode: "webhook"; }, { readonly key: "github.pull_request_review"; readonly displayName: "Pull request review"; readonly description: "Triggered when a pull request review is submitted, edited, or dismissed."; readonly deliveryMode: "webhook"; }, { readonly key: "github.pull_request_review_comment"; readonly displayName: "Pull request review comment"; readonly description: "Triggered when a comment on a pull request diff is created, edited, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.push"; readonly displayName: "Push"; readonly description: "Triggered on a push to a branch or tag. This is the default event for repository webhooks."; readonly deliveryMode: "webhook"; }, { readonly key: "github.release"; readonly displayName: "Release"; readonly description: "Triggered when a release is published, edited, deleted, or prereleased."; readonly deliveryMode: "webhook"; }, { readonly key: "github.repository"; readonly displayName: "Repository"; readonly description: "Triggered when a repository is created, archived, unarchived, renamed, transferred, or deleted."; readonly deliveryMode: "webhook"; }, { readonly key: "github.repository_import"; readonly displayName: "Repository import"; readonly description: "Triggered when a repository import succeeds, fails, or is cancelled."; readonly deliveryMode: "webhook"; }, { readonly key: "github.repository_vulnerability_alert"; readonly displayName: "Repository vulnerability alert"; readonly description: "Triggered when a Dependabot security alert is created, dismissed, or resolved."; readonly deliveryMode: "webhook"; }, { readonly key: "github.security_advisory"; readonly displayName: "Security advisory"; readonly description: "Triggered when a security advisory is published, updated, or withdrawn for an organization."; readonly deliveryMode: "webhook"; }, { readonly key: "github.star"; readonly displayName: "Star"; readonly description: "Triggered when a star is added to or removed from a repository."; readonly deliveryMode: "webhook"; }, { readonly key: "github.status"; readonly displayName: "Status"; readonly description: "Triggered when the status of a Git commit changes."; readonly deliveryMode: "webhook"; }, { readonly key: "github.team"; readonly displayName: "Team"; readonly description: "Triggered when an organization's team is created, deleted, edited, or repository access changes (organization hooks only)."; readonly deliveryMode: "webhook"; }, { readonly key: "github.team_add"; readonly displayName: "Team add"; readonly description: "Triggered when a repository is added to a team."; readonly deliveryMode: "webhook"; }, { readonly key: "github.watch"; readonly displayName: "Watch"; readonly description: "Triggered when someone stars a repository."; readonly deliveryMode: "webhook"; }]; }, { readonly triggerId: "slack"; readonly displayName: "Slack"; readonly service: "Slack"; readonly category: "Email & Messaging"; readonly authType: "token"; readonly deliveryModes: ["webhook"]; readonly metadata: { readonly description: "Trigger workflows from events happening inside your Slack workspace such as messages, reactions, and channel activity."; readonly docsUrl: "https://api.slack.com/events"; }; readonly version: "1.0.0"; readonly events: readonly [{ readonly key: "slack.anyEvent"; readonly displayName: "Any Slack event"; readonly description: "Receive every event delivered to your Slack app via the Events API. Use with caution in busy workspaces."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: true; readonly channelId: null; readonly includeBotMessages: true; }; }; }, { readonly key: "slack.appMention"; readonly displayName: "Bot or app mention"; readonly description: "Trigger when your bot or app is mentioned in a channel where it is present."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: false; readonly channelId: null; readonly includeBotMessages: false; }; }; }, { readonly key: "slack.messagePosted"; readonly displayName: "Message posted to channel"; readonly description: "Trigger when a new message is posted to a channel that the app is added to."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: false; readonly channelId: null; readonly includeBotMessages: false; }; }; }, { readonly key: "slack.reactionAdded"; readonly displayName: "Reaction added"; readonly description: "Trigger when a reaction is added to a message in a channel your app has joined."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: false; readonly channelId: null; readonly includeBotMessages: true; }; }; }, { readonly key: "slack.fileShare"; readonly displayName: "File shared"; readonly description: "Trigger when a file is shared in a channel that the app is added to."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: false; readonly channelId: null; readonly includeBotMessages: true; }; }; }, { readonly key: "slack.filePublic"; readonly displayName: "File made public"; readonly description: "Trigger when a file is made public in the workspace."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: true; readonly channelId: null; readonly includeBotMessages: true; }; }; }, { readonly key: "slack.channelCreated"; readonly displayName: "Channel created"; readonly description: "Trigger when a new public channel is created in the workspace."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: true; readonly channelId: null; readonly includeBotMessages: true; }; }; }, { readonly key: "slack.teamJoin"; readonly displayName: "User joined workspace"; readonly description: "Trigger when a new user joins the Slack workspace."; readonly deliveryMode: "webhook"; readonly defaultConfig: { readonly provider: { readonly type: "slack"; readonly watchWorkspace: true; readonly channelId: null; readonly includeBotMessages: true; }; }; }]; }, { readonly triggerId: "discord"; readonly displayName: "Discord (Actions)"; readonly service: "Discord"; readonly category: "Email & Messaging"; readonly authType: "bot-token"; readonly deliveryModes: []; readonly metadata: { readonly description: "Use Discord bot tokens or webhooks with VoltAgent actions. This integration only powers outgoing actions (no event triggers)."; readonly actionOnly: true; }; readonly version: "1.0.0"; readonly events: readonly []; }, { readonly triggerId: "airtable-record"; readonly dslTriggerId: "airtable"; readonly displayName: "Airtable"; readonly service: "Airtable"; readonly category: "Productivity"; readonly authType: "token"; readonly deliveryModes: ["polling"]; readonly metadata: { readonly description: "Trigger when new rows are added to an Airtable base or view."; }; readonly version: "1.0.0"; readonly events: readonly [{ readonly key: "airtable.recordCreated"; readonly displayName: "Record created"; readonly description: "Poll the configured Base/Table/View and emit when a new record is created."; readonly deliveryMode: "polling"; }]; }, { readonly triggerId: "google-calendar"; readonly dslTriggerId: "google-calendar"; readonly displayName: "Google Calendar"; readonly service: "GoogleCalendar"; readonly category: "Productivity"; readonly authType: "oauth2"; readonly deliveryModes: ["polling"]; readonly metadata: { readonly description: "React to Google Calendar events such as created, updated, started, or cancelled meetings."; }; readonly version: "1.0.0"; readonly events: readonly [{ readonly key: "googlecalendar.eventCreated"; readonly displayName: "Event created"; readonly description: "Trigger when a new Google Calendar event is created on the selected calendar."; readonly deliveryMode: "polling"; readonly defaultConfig: { readonly provider: { readonly type: "googlecalendar"; readonly calendarId: "primary"; readonly triggerType: "eventCreated"; readonly matchTerm: null; readonly expandRecurringEvents: false; readonly pollIntervalSeconds: 60; }; }; }, { readonly key: "googlecalendar.eventUpdated"; readonly displayName: "Event updated"; readonly description: "Trigger when an existing Google Calendar event is updated (title, time, description, etc.)."; readonly deliveryMode: "polling"; readonly defaultConfig: { readonly provider: { readonly type: "googlecalendar"; readonly calendarId: "primary"; readonly triggerType: "eventUpdated"; readonly matchTerm: null; readonly expandRecurringEvents: false; readonly pollIntervalSeconds: 60; }; }; }, { readonly key: "googlecalendar.eventCancelled"; readonly displayName: "Event cancelled"; readonly description: "Trigger when an event is cancelled on the selected calendar."; readonly deliveryMode: "polling"; readonly defaultConfig: { readonly provider: { readonly type: "googlecalendar"; readonly calendarId: "primary"; readonly triggerType: "eventCancelled"; readonly matchTerm: null; readonly expandRecurringEvents: false; readonly pollIntervalSeconds: 60; }; }; }, { readonly key: "googlecalendar.eventStarted"; readonly displayName: "Event started"; readonly description: "Trigger when an event start time occurs (includes recurring instances when expanded)."; readonly deliveryMode: "polling"; readonly defaultConfig: { readonly provider: { readonly type: "googlecalendar"; readonly calendarId: "primary"; readonly triggerType: "eventStarted"; readonly matchTerm: null; readonly expandRecurringEvents: true; readonly pollIntervalSeconds: 60; }; }; }, { readonly key: "googlecalendar.eventEnded"; readonly displayName: "Event ended"; readonly description: "Trigger when an event end time is reached."; readonly deliveryMode: "polling"; readonly defaultConfig: { readonly provider: { readonly type: "googlecalendar"; readonly calendarId: "primary"; readonly triggerType: "eventEnded"; readonly matchTerm: null; readonly expandRecurringEvents: true; readonly pollIntervalSeconds: 60; }; }; }]; }, { readonly triggerId: "google-drive"; readonly dslTriggerId: "google-drive"; readonly displayName: "Google Drive"; readonly service: "GoogleDrive"; readonly category: "Storage"; readonly authType: "oauth2"; readonly deliveryModes: ["polling"]; readonly metadata: { readonly description: "Detect file or folder changes in Google Drive, similar to Activepieces and n8n."; }; readonly version: "1.0.0"; readonly events: readonly [{ readonly key: "googledrive.fileChanged"; readonly displayName: "File created or updated"; readonly description: "Trigger when a file in Google Drive is created or updated, optionally filtered by MIME types."; readonly deliveryMode: "polling"; readonly defaultConfig: { readonly provider: { readonly type: "googledrive"; readonly triggerType: "fileChanged"; readonly folderId: null; readonly matchMimeTypes: null; readonly pollIntervalSeconds: 60; }; }; }, { readonly key: "googledrive.folderChanged"; readonly displayName: "Folder content changed"; readonly description: "Trigger when items in a specific folder are added or updated in Google Drive."; readonly deliveryMode: "polling"; readonly defaultConfig: { readonly provider: { readonly type: "googledrive"; readonly triggerType: "folderChanged"; readonly folderId: null; readonly matchMimeTypes: null; readonly pollIntervalSeconds: 60; }; }; }]; }]; declare class A2AServerRegistry { private readonly servers; private readonly idByServer; private readonly serverById; private readonly metadataById; private anonymousCounter; register(server: TServer, deps: A2AServerDeps): void; unregister(server: TServer): void; getServer(id: string): TServer | undefined; getMetadata(id: string): A2AServerMetadata | undefined; list(): TServer[]; listMetadata(): A2AServerMetadata[]; private resolveMetadata; private normalizeIdentifier; private ensureUniqueId; private createAnonymousSlug; private createAnonymousName; } interface RegisterOptions { startTransports?: boolean; transportOptions?: Record; } declare class MCPServerRegistry { private readonly servers; private readonly idByServer; private readonly serverById; private readonly metadataById; private anonymousCounter; register(server: TServer, deps: MCPServerDeps, options?: RegisterOptions): void; unregister(server: TServer): void; getServer(id: string): TServer | undefined; getServerMetadata(id: string): MCPServerMetadata | undefined; list(): TServer[]; listMetadata(): MCPServerMetadata[]; startAll(options?: Record): Promise; stopAll(): Promise; private startConfigured; private resolveMetadata; private normalizeIdentifier; private ensureUniqueId; private createAnonymousSlug; } /** * The action being authorized. * - "discovery": Tool is being listed/discovered (getTools/getToolsets) * - "execution": Tool is being executed (callTool) */ type MCPAuthorizationAction = "discovery" | "execution"; /** * Minimal context for tool discovery authorization. * Used when full OperationContext is not available (e.g., during getTools). */ interface MCPAuthorizationContext { /** User identifier */ userId?: string; /** User-defined context map (same as OperationContext.context) */ context?: Map | Record; } /** * Parameters passed to the `can` authorization function. */ interface MCPCanParams { /** Tool name (without server prefix) */ toolName: string; /** Server/resource identifier */ serverName: string; /** The action being authorized: "discovery" or "execution" */ action: MCPAuthorizationAction; /** Tool arguments (for attribute-based access control) */ arguments?: Record; /** User identifier */ userId?: string; /** User-defined context (from authContext or OperationContext) */ context?: Map; } /** * Result from the `can` authorization function. * Can be a simple boolean or an object with reason. */ type MCPCanResult = boolean | { allowed: boolean; reason?: string; }; /** * Simple authorization function type. * Return true/false or { allowed: boolean, reason?: string } * * @example * ```typescript * const can: MCPCanFunction = async ({ toolName, action, userId, context }) => { * const roles = context?.get("roles") as string[] ?? []; * // action is "discovery" or "execution" * if (toolName === "delete_item" && !roles.includes("admin")) { * return { allowed: false, reason: "Only admins can delete" }; * } * return true; * }; * ``` */ type MCPCanFunction = (params: MCPCanParams) => Promise | MCPCanResult; /** * Authorization configuration for MCPConfiguration. * * @example * ```typescript * const mcp = new MCPConfiguration({ * servers: { myServer: { type: "http", url: "..." } }, * authorization: { * can: async ({ toolName, action, userId, context }) => { * const roles = context?.get("roles") as string[] ?? []; * // action is "discovery" or "execution" * if (toolName === "admin_tool" && !roles.includes("admin")) { * return { allowed: false, reason: "Admin only" }; * } * return true; * }, * filterOnDiscovery: true, * }, * }); * ``` */ interface MCPAuthorizationConfig { /** * Authorization function to check if a tool can be accessed. * Called for both discovery and execution based on config options. */ can: MCPCanFunction; /** * Whether to filter tools on discovery (getTools/getToolsets). * When true, unauthorized tools are hidden from the tool list. * @default false */ filterOnDiscovery?: boolean; /** * Whether to check authorization on execution (callTool). * When true, each tool call is verified before execution. * @default true */ checkOnExecution?: boolean; } /** * Error thrown when MCP tool authorization is denied. */ declare class MCPAuthorizationError extends Error { readonly toolName: string; readonly serverName: string; readonly reason?: string; constructor(toolName: string, serverName: string, reason?: string); } /** * Handler function for processing user input requests from MCP servers. * Called when the server needs additional information during tool execution. */ type UserInputHandler = (request: ElicitRequest["params"]) => Promise; /** * Internal callback type for notifying MCPClient when handler changes. * @internal */ type HandlerChangeCallback = (handler: UserInputHandler | undefined) => void; /** * Bridge for handling user input requests from MCP servers. * * Provides a fluent API for registering handlers that process elicitation * requests during tool execution. Handlers can be set permanently, used * once, or removed dynamically at runtime. * * @example * ```typescript * // Set a permanent handler * mcpClient.elicitation.setHandler(async (request) => { * const confirmed = await askUser(request.message); * return { * action: confirmed ? "accept" : "decline", * content: confirmed ? { confirmed: true } : undefined, * }; * }); * * // Set a one-time handler * mcpClient.elicitation.once(async (request) => { * return { action: "accept", content: { approved: true } }; * }); * * // Remove the handler * mcpClient.elicitation.removeHandler(); * ``` */ declare class UserInputBridge { private handler; private readonly logger; private readonly onHandlerChange; /** * @internal */ constructor(logger: Logger, onHandlerChange: HandlerChangeCallback); /** * Whether a handler is currently registered. */ get hasHandler(): boolean; /** * Gets the current handler. * * @internal * @returns The current handler or undefined if none is set */ getHandler(): UserInputHandler | undefined; /** * Registers a handler for processing user input requests. * * The handler will be called each time the MCP server requests * additional information during tool execution. * * @param handler - Function to process user input requests * @returns This bridge instance for chaining * * @example * ```typescript * mcpClient.elicitation.setHandler(async (request) => { * console.log("Server asks:", request.message); * const userInput = await promptUser(request.requestedSchema); * return { action: "accept", content: userInput }; * }); * ``` */ setHandler(handler: UserInputHandler): this; /** * Registers a one-time handler that automatically removes itself after use. * * Useful for handling a single expected user input request without * leaving a permanent handler in place. * * @param handler - Function to process the next user input request * @returns This bridge instance for chaining * * @example * ```typescript * // Handle only the next elicitation request * mcpClient.elicitation.once(async (request) => { * return { action: "accept", content: { confirmed: true } }; * }); * ``` */ once(handler: UserInputHandler): this; /** * Removes the current handler. * * After calling this, user input requests from the server will * be automatically cancelled until a new handler is set. * * @returns This bridge instance for chaining */ removeHandler(): this; /** * Processes a user input request using the registered handler. * * @internal * @param request - The elicitation request from the server * @returns The user's response or a cancel action if no handler */ processRequest(request: ElicitRequest["params"]): Promise; private normalizeRequest; private getFallbackMessage; } /** * Handler for elicitation requests from the MCP server. * Called when the server needs user input during tool execution. * * @deprecated Use `UserInputHandler` from `UserInputBridge` instead for dynamic handler registration. */ type MCPElicitationHandler = (request: ElicitRequest["params"]) => Promise; /** * Client information for MCP */ interface ClientInfo { /** * Client name */ name: string; /** * Client version */ version: string; /** * Allow additional properties for SDK compatibility */ [key: string]: unknown; } /** * Transport error from MCP */ interface TransportError extends Error { /** * Error code */ code?: string; /** * Error details */ details?: unknown; } /** * Configuration for MCP client */ type MCPClientConfig = { /** * Client information */ clientInfo: ClientInfo; /** * MCP server configuration */ server: MCPServerConfig; /** * MCP capabilities */ capabilities?: ClientCapabilities; /** * Timeout in milliseconds for MCP requests * @default 30000 */ timeout?: number; /** * Elicitation handler for receiving user input requests from the MCP server. * When the server needs additional information during tool execution, * this handler will be called with the request details. * * @example * ```typescript * const mcpClient = new MCPClient({ * clientInfo: { name: "my-client", version: "1.0.0" }, * server: { type: "stdio", command: "my-mcp-server" }, * elicitation: { * onRequest: async (request) => { * const confirmed = await askUserForConfirmation(request.message); * return { * action: confirmed ? "accept" : "decline", * content: confirmed ? { confirmed: true } : undefined, * }; * }, * }, * }); * ``` */ elicitation?: { /** * Handler called when the MCP server requests user input. * Must return an ElicitResult with action: "accept", "decline", or "cancel". */ onRequest: MCPElicitationHandler; }; }; /** * MCP server configuration options */ type MCPServerConfig = HTTPServerConfig | SSEServerConfig | StreamableHTTPServerConfig | StdioServerConfig; /** * HTTP-based MCP server configuration with automatic fallback * Tries streamable HTTP first, falls back to SSE if not supported */ type HTTPServerConfig = { /** * Type of server connection */ type: "http"; /** * URL of the MCP server */ url: string; /** * Request initialization options */ requestInit?: RequestInit; /** * Event source initialization options (used for SSE fallback) */ eventSourceInit?: EventSourceInit; /** * Optional maximum request timeout in milliseconds. * If provided, passed to MCPClient as the per-request timeout. */ timeout?: number; }; /** * SSE-based MCP server configuration (explicit SSE transport) */ type SSEServerConfig = { /** * Type of server connection */ type: "sse"; /** * URL of the MCP server */ url: string; /** * Request initialization options */ requestInit?: RequestInit; /** * Event source initialization options */ eventSourceInit?: EventSourceInit; /** * Optional maximum request timeout in milliseconds. * If provided, passed to MCPClient as the per-request timeout. */ timeout?: number; }; /** * Streamable HTTP-based MCP server configuration (no fallback) */ type StreamableHTTPServerConfig = { /** * Type of server connection */ type: "streamable-http"; /** * URL of the MCP server */ url: string; /** * Request initialization options */ requestInit?: RequestInit; /** * Session ID for the connection */ sessionId?: string; /** * Optional maximum request timeout in milliseconds. * If provided, passed to MCPClient as the per-request timeout. */ timeout?: number; }; /** * Stdio-based MCP server configuration */ type StdioServerConfig = { /** * Type of server connection */ type: "stdio"; /** * Command to run the MCP server */ command: string; /** * Arguments to pass to the command */ args?: string[]; /** * Environment variables for the MCP server process */ env?: Record; /** * Working directory for the MCP server process */ cwd?: string; /** * Optional maximum request timeout in milliseconds. * If provided, passed to MCPClient as the per-request timeout. */ timeout?: number; }; /** * Tool call request */ type MCPToolCall = { /** * Name of the tool to call */ name: string; /** * Arguments to pass to the tool */ arguments: Record; }; /** * Tool call result */ type MCPToolResult = { /** * Result content from the tool */ content: unknown; }; /** * MCP client events */ interface MCPClientEvents { /** * Emitted when the client connects to the server */ connect: () => void; /** * Emitted when the client disconnects from the server */ disconnect: () => void; /** * Emitted when an error occurs */ error: (error: Error | TransportError) => void; /** * Emitted when a tool call completes */ toolCall: (name: string, args: Record, result: unknown) => void; } /** * A record of tools along with a helper method to convert them to an array. */ type ToolsetWithTools = Record & { /** * Converts the toolset to an array of BaseTool objects. */ getTools: () => Tool[]; }; /** * Any tool configuration */ type AnyToolConfig = Tool; /** * Options for MCPConfiguration constructor. */ interface MCPConfigurationOptions { /** * Map of server configurations keyed by server names. */ servers: Record; /** * Optional authorization configuration for tool access control. */ authorization?: MCPAuthorizationConfig; } /** * Options for MCPClient.callTool method with authorization support. */ interface MCPClientCallOptions { /** * Full operation context for authorization (from agent execution). */ operationContext?: OperationContext; /** * Authorization function. */ canFunction?: MCPCanFunction; /** * Authorization config settings. */ authorizationConfig?: MCPAuthorizationConfig; /** * Server name for authorization context. */ serverName?: string; } /** * Client for interacting with Model Context Protocol (MCP) servers. * Wraps the official MCP SDK client to provide a higher-level interface. * Internal implementation differs from original source. */ declare class MCPClient extends SimpleEventEmitter { /** * Underlying MCP client instance from the SDK. */ private client; /** * Communication channel (transport layer) for MCP interactions. */ private transport; /** * Tracks the connection status to the server. */ private connected; /** * Maximum time allowed for requests in milliseconds. */ private readonly timeout; /** * Logger instance */ private logger; /** * Information identifying this client to the server. */ private readonly clientInfo; /** * Server configuration for fallback attempts. */ private readonly serverConfig; /** * Whether to attempt SSE fallback if streamable HTTP fails. */ private shouldAttemptFallback; /** * Client capabilities for re-initialization. */ private readonly capabilities; /** * Bridge for handling user input requests from the server. * Provides methods to dynamically register and manage input handlers. * * @example * ```typescript * mcpClient.elicitation.setHandler(async (request) => { * const confirmed = await askUser(request.message); * return { action: confirmed ? "accept" : "decline" }; * }); * ``` */ readonly elicitation: UserInputBridge; /** * Get server info for logging */ private getServerInfo; /** * Creates a new MCP client instance. * @param config Configuration for the client, including server details and client identity. */ constructor(config: MCPClientConfig); /** * Sets up handlers for events from the underlying SDK client. */ private setupEventHandlers; /** * Registers the elicitation request handler with the MCP SDK client. * Delegates to UserInputBridge for actual handling. */ private registerElicitationHandler; /** * Callback invoked when the elicitation handler changes. * Currently a no-op since we always delegate to UserInputBridge. * @internal */ private updateElicitationHandler; /** * Establishes a connection to the configured MCP server. * Idempotent: does nothing if already connected. */ connect(): Promise; /** * Attempts to connect using SSE transport as a fallback. * @param originalError The error from the initial connection attempt. */ private attemptSSEFallback; /** * Closes the connection to the MCP server. * Idempotent: does nothing if not connected. */ disconnect(): Promise; /** * Fetches the definitions of available tools from the server. * @returns A record mapping tool names to their definitions (schema, description). */ listTools(): Promise>; /** * Builds executable Tool objects from the server's tool definitions. * These tools include an `execute` method for calling the remote tool. * @param options - Optional call options including authorization context. * @returns A record mapping namespaced tool names (`clientName_toolName`) to executable Tool objects. */ getAgentTools(options?: MCPClientCallOptions): Promise>>; /** * Executes a specified tool on the remote MCP server. * @param toolCall Details of the tool to call, including name and arguments. * @param options Optional call options including authorization context. * @returns The result content returned by the tool. */ callTool(toolCall: MCPToolCall, options?: MCPClientCallOptions): Promise; /** * Retrieves a list of resources available on the server. * @returns A promise resolving to the MCP resources list response. */ listResources(): Promise; /** * Ensures the client is connected before proceeding with an operation. * Attempts to connect if not currently connected. * @throws Error if connection attempt fails. */ private ensureConnected; /** * Emits an 'error' event, ensuring the payload is always an Error object. * @param error The error encountered, can be of any type. */ private emitError; /** * Type guard to check if a server configuration is for an HTTP server. * @param server The server configuration object. * @returns True if the configuration type is 'http', false otherwise. */ private isHTTPServer; /** * Type guard to check if a server configuration is for an SSE server. * @param server The server configuration object. * @returns True if the configuration type is 'sse', false otherwise. */ private isSSEServer; /** * Type guard to check if a server configuration is for a Streamable HTTP server. * @param server The server configuration object. * @returns True if the configuration type is 'streamable-http', false otherwise. */ private isStreamableHTTPServer; /** * Type guard to check if a server configuration is for a Stdio server. * @param server The server configuration object. * @returns True if the configuration type is 'stdio', false otherwise. */ private isStdioServer; /** * Overrides EventEmitter's 'on' method for type-safe event listening. * Uses the original `MCPClientEvents` for event types. */ on(event: E, listener: MCPClientEvents[E]): this; /** * Overrides EventEmitter's 'emit' method for type-safe event emission. * Uses the original `MCPClientEvents` for event types. */ emit(event: E, ...args: Parameters): boolean; } /** * Configuration manager for Model Context Protocol (MCP). * Handles multiple MCP server connections and tool management. * NOTE: This version does NOT manage singleton instances automatically. */ declare class MCPConfiguration { /** * Map of server configurations keyed by server names. */ private readonly serverConfigs; /** * Map of connected MCP clients keyed by server names (local cache). */ private readonly mcpClientsById; /** * Authorization configuration for tool access control. */ private readonly authorizationConfig?; /** * Creates a new, independent MCP configuration instance. * @param options Configuration options including server definitions and optional authorization. */ constructor(options: MCPConfigurationOptions); /** * Type guard to check if an object conforms to the basic structure of AnyToolConfig. */ private isAnyToolConfigStructure; /** * Disconnects all associated MCP clients for THIS instance. */ disconnect(): Promise; /** * Retrieves agent-ready tools from all configured MCP servers for this instance. * @param authContext - Optional authorization context for filtering tools. * @returns A flat array of all agent-ready tools. */ getTools(authContext?: MCPAuthorizationContext): Promise[]>; /** * Checks if the can authorization function is configured. */ private hasAuthorizationHandler; /** * Creates call options for MCPClient methods with authorization context. */ private createClientCallOptions; /** * Filters tools based on authorization using the `can` function. */ private filterToolsByAuthorization; /** * Retrieves raw tool definitions from all configured MCP servers for this instance. * @returns A flat record of all raw tools keyed by their namespaced name. */ getRawTools(): Promise>; /** * Retrieves agent-ready toolsets grouped by server name for this instance. * @returns A record where keys are server names and values are agent-ready toolsets. */ getToolsets(): Promise>; /** * Retrieves raw tool definitions grouped by server name for this instance. * @returns A record where keys are server names and values are records of raw tools. */ getRawToolsets(): Promise>>; /** * Retrieves a specific connected MCP client by its server name for this instance. */ getClient(serverName: TServerKeys): Promise; /** * Retrieves all configured MCP clients for this instance, ensuring they are connected. */ getClients(): Promise>; /** * Internal helper to get/create/connect a client for this instance. * Manages the local mcpClientsById cache. */ private getConnectedClient; } declare global { var ___voltagent_trigger_registry: TriggerRegistry | undefined; } declare class TriggerRegistry { private readonly logger; private readonly triggers; private readonly pathIndex; static getInstance(): TriggerRegistry; register(name: string, config: VoltAgentTriggerConfig): RegisteredTrigger; registerMany(triggers?: Record): void; unregister(name: string): boolean; get(name: string): RegisteredTrigger | undefined; getByPath(path: string): RegisteredTrigger | undefined; list(): RegisteredTrigger[]; clear(): void; } /** * Basic type definitions for VoltAgent Core */ interface MCPLoggingAdapter { setLevel?(level: string): Promise | void; getLevel?(): Promise | string | undefined; } interface MCPPromptsAdapter { listPrompts(): Promise; getPrompt(params: unknown): Promise; } interface MCPResourcesAdapter { listResources(): Promise; readResource(uri: string): Promise; listResourceTemplates?(): Promise; subscribe?(params: unknown, headers?: Record): Promise | void; unsubscribe?(params: unknown): Promise | void; } interface MCPElicitationAdapter { sendRequest(request: unknown): Promise; } interface ResumableStreamContext { conversationId: string; agentId?: string; userId: string; } interface ResumableStreamAdapter { createStream(params: ResumableStreamContext & { stream: ReadableStream; metadata?: Record; }): Promise; resumeStream(streamId: string): Promise | null>; getActiveStreamId(params: ResumableStreamContext): Promise; clearActiveStream(params: ResumableStreamContext & { streamId?: string; }): Promise; } /** * Server provider interface */ interface IServerProvider { start(): Promise<{ port: number; }>; stop(): Promise; isRunning(): boolean; } type ServerlessRequestHandler = (req: Request, ...args: unknown[]) => Promise; type CloudflareFetchHandler = (req: Request, env: Record, ctx: unknown) => Promise; interface IServerlessProvider { handleRequest(request: Request): Promise; toCloudflareWorker(): { fetch: CloudflareFetchHandler; }; toVercelEdge(): ServerlessRequestHandler; toDeno(): ServerlessRequestHandler; auto(): { fetch: CloudflareFetchHandler; } | ServerlessRequestHandler; } type ServerlessProviderFactory = (deps: ServerProviderDeps) => IServerlessProvider; /** * Server provider dependencies */ interface ServerProviderDeps { agentRegistry: { getAgent(id: string): Agent | undefined; getAllAgents(): Agent[]; getAgentCount(): number; removeAgent(id: string): boolean; registerAgent(agent: Agent): void; getGlobalVoltOpsClient(): VoltOpsClient | undefined; getGlobalLogger(): Logger | undefined; }; workflowRegistry: { getWorkflow(id: string): RegisteredWorkflow | undefined; getWorkflowsForApi(): unknown[]; getWorkflowDetailForApi(id: string): unknown; getWorkflowCount(): number; getAllWorkflowIds(): string[]; on(event: string, handler: (...args: any[]) => void): void; off(event: string, handler: (...args: any[]) => void): void; activeExecutions: Map; resumeSuspendedWorkflow(workflowId: string, executionId: string, resumeData?: any, stepId?: string): Promise; }; logger?: Logger; voltOpsClient?: VoltOpsClient; observability?: VoltAgentObservability; mcp?: { registry: MCPServerRegistry; }; a2a?: { registry: A2AServerRegistry; }; triggerRegistry: TriggerRegistry; resumableStream?: ResumableStreamAdapter; resumableStreamDefault?: boolean; ensureEnvironment?: (env?: Record) => void; } /** * Server provider factory type */ type ServerProviderFactory = (deps: ServerProviderDeps) => IServerProvider; /** * Server API response types */ interface ServerAgentResponse { id: string; name: string; description: string; status: AgentStatus; model: string; tools: ToolStatusInfo[]; memory?: Record; subAgents?: ServerAgentResponse[]; isTelemetryEnabled?: boolean; } interface ServerWorkflowResponse { id: string; name: string; purpose: string; stepsCount: number; status: "idle" | "running" | "completed" | "error"; steps: Array<{ id: string; name: string; purpose: string | null; type: string; agentId?: string; agentName?: string; }>; } interface ServerApiResponse { success: boolean; data?: T; error?: string; } /** * VoltAgent constructor options */ type VoltAgentOptions = { /** * Optional agents to register when bootstrapping VoltAgent */ agents?: Record; /** * Optional workflows to register with VoltAgent * Can be either Workflow instances or WorkflowChain instances */ workflows?: Record | WorkflowChain>; /** * Default Memory instance used when agent/workflow defaults are not provided. */ memory?: Memory; /** * Default Memory instance used for agents when they don't specify one. * Falls back to `memory` when not provided. */ agentMemory?: Memory; /** * Default Memory instance used for workflows when they don't specify one. * Falls back to `memory` when not provided. */ workflowMemory?: Memory; /** * Global tool routing defaults (search + call workflow). * When enabled, agents expose searchTools/callTool and hide pool tools from the model. */ toolRouting?: ToolRoutingConfig; /** * Default conversation persistence behavior for agents that don't define one. */ agentConversationPersistence?: AgentConversationPersistenceOptions; /** * Optional global workspace instance or configuration. * Agents inherit this workspace unless they explicitly provide their own workspace or set it to false. */ workspace?: Workspace | WorkspaceConfig; /** Optional VoltOps trigger handlers */ triggers?: VoltAgentTriggersConfig; /** * Server provider factory function * Example: honoServer({ port: 3141, enableSwaggerUI: true }) */ server?: ServerProviderFactory; /** * Serverless provider factory function for fetch-based runtimes * Example: serverlessHono({ corsOrigin: '*' }) */ serverless?: ServerlessProviderFactory; /** * Unified VoltOps client for telemetry and prompt management * Replaces the old telemetryExporter approach with a comprehensive solution. */ voltOpsClient?: VoltOpsClient; /** * Observability instance for OpenTelemetry-compliant tracing * Allows sharing the same observability instance between VoltAgent and Agents * If not provided, creates a default instance with in-memory storage */ observability?: VoltAgentObservability; /** * Global logger instance to use across all agents and workflows * If not provided, a default logger will be created */ logger?: Logger; /** * Optional collection of MCP servers to register alongside the primary server. * Enables exposing multiple VoltAgent surfaces through separate MCP endpoints. */ mcpServers?: Record; /** * Optional collection of A2A servers to expose agents via the Agent-to-Agent protocol. */ a2aServers?: Record; /** * @deprecated Use `server.port` instead */ port?: number; /** * @deprecated Use `server.autoStart` instead */ autoStart?: boolean; checkDependencies?: boolean; /** * @deprecated Server configuration is now done through server provider */ customEndpoints?: unknown[]; /** * @deprecated Server configuration is now done through server provider */ enableSwaggerUI?: boolean; }; type TriggerHttpMethod = "get" | "post" | "put" | "patch" | "delete"; interface VoltOpsTriggerEnvelope { provider?: string; trigger?: string; event?: string; payload?: TPayload; deliveryId?: string; bindingId?: string; targetId?: string; catalogId?: string; metadata?: Record | null; [key: string]: unknown; } interface VoltOpsTriggerDefinition { /** Unique trigger key, e.g. `github.star` */ name: string; /** Provider identifier such as `github`, `airtable`, or `gmail-new-email` */ provider: string; /** Short label for display purposes */ summary?: string; /** Longer description of the trigger */ description?: string; /** Suggested HTTP path (used when building default routes) */ defaultPath?: string; /** Optional delivery method metadata (webhook, polling, schedule, etc.) */ deliveryMode?: string; /** Optional category metadata */ category?: string; /** Optional payload description */ payloadType?: TPayload; } interface RegisteredTrigger { name: string; path: string; method: TriggerHttpMethod; handler: TriggerHandler; definition?: VoltOpsTriggerDefinition; summary?: string; description?: string; metadata?: Record; } interface TriggerHandlerContext { payload: TPayload; event: VoltOpsTriggerEnvelope; trigger: RegisteredTrigger; logger: Logger; headers: Record; agentRegistry: ServerProviderDeps["agentRegistry"]; workflowRegistry: ServerProviderDeps["workflowRegistry"]; voltOpsClient?: VoltOpsClient; agents: Record; rawRequest?: unknown; triggerContext: Map; } type TriggerHandlerBody = string | number | boolean | null | Record | unknown[]; interface TriggerHandlerResponse { status?: number; body?: TriggerHandlerBody; headers?: Record; } type TriggerHandlerResult = void | TriggerHandlerBody | TriggerHandlerResponse; /** * @deprecated Use {@link TriggerHandlerResult}. This alias remains for backwards compatibility. */ type TriggerHandlerReturn = TriggerHandlerResult | Promise | Promise; type TriggerHandler = (context: TriggerHandlerContext) => TriggerHandlerReturn; type VoltAgentTriggerConfig = TriggerHandler | { handler: TriggerHandler; path?: string; method?: TriggerHttpMethod; definition?: VoltOpsTriggerDefinition; summary?: string; description?: string; metadata?: Record; }; type VoltAgentTriggersConfig = Record; declare function defineVoltOpsTrigger(definition: VoltOpsTriggerDefinition): VoltOpsTriggerDefinition; type VoltOpsTriggerCatalog = typeof DEFAULT_TRIGGER_CATALOG; type VoltOpsTriggerName = VoltOpsTriggerCatalog[number]["events"][number]["key"]; type LowerFirst = S extends `${infer F}${infer R}` ? `${Lowercase}${R}` : S; type NormalizeSegment = S extends `${infer Head}-${infer Tail}` ? `${Lowercase}${Capitalize>}` : S extends `${infer Head}_${infer Tail}` ? `${Lowercase}${Capitalize>}` : LowerFirst; type ProviderIdentifier = NormalizeSegment; type EventPropertyName = K extends `${string}.${infer Rest}` ? Rest extends "*" ? "any" : NormalizeSegment : NormalizeSegment; type BuildTriggerGroups = { [Entry in TCatalog[number] as ProviderIdentifier]: Entry["events"] extends readonly any[] ? { [Event in Entry["events"][number] as EventPropertyName]: Event["key"]; } : never; }; declare const VoltOpsTriggerGroups: BuildTriggerGroups; type VoltOpsTriggerGroupMap = typeof VoltOpsTriggerGroups; declare const VoltOpsTriggerDefinitions: Record<"github.*" | "github.check_run" | "github.check_suite" | "github.commit_comment" | "github.create" | "github.delete" | "github.deploy_key" | "github.deployment" | "github.deployment_status" | "github.fork" | "github.github_app_authorization" | "github.gollum" | "github.installation" | "github.installation_repositories" | "github.issue_comment" | "github.issues" | "github.label" | "github.marketplace_purchase" | "github.member" | "github.membership" | "github.meta" | "github.milestone" | "github.org_block" | "github.organization" | "github.page_build" | "github.project" | "github.project_card" | "github.project_column" | "github.public" | "github.pull_request" | "github.pull_request_review" | "github.pull_request_review_comment" | "github.push" | "github.release" | "github.repository" | "github.repository_import" | "github.repository_vulnerability_alert" | "github.security_advisory" | "github.star" | "github.status" | "github.team" | "github.team_add" | "github.watch" | "slack.anyEvent" | "slack.appMention" | "slack.messagePosted" | "slack.reactionAdded" | "slack.fileShare" | "slack.filePublic" | "slack.channelCreated" | "slack.teamJoin" | "cron.schedule" | "gmail.newEmail" | "airtable.recordCreated" | "googlecalendar.eventCreated" | "googlecalendar.eventUpdated" | "googlecalendar.eventCancelled" | "googlecalendar.eventStarted" | "googlecalendar.eventEnded" | "googledrive.fileChanged" | "googledrive.folderChanged", VoltOpsTriggerDefinition>; declare const VoltOpsTriggerNames: VoltOpsTriggerName[]; declare function getVoltOpsTriggerDefinition(name: VoltOpsTriggerName): VoltOpsTriggerDefinition; type TriggerRegistrar = (config: VoltAgentTriggerConfig) => void; type TriggerProviderDsl> = { [Event in keyof TEvents]: TriggerRegistrar; }; type TriggerDsl = { [Provider in keyof VoltOpsTriggerGroupMap]: TriggerProviderDsl; }; /** * DSL helper that allows registering triggers with dot-access syntax. * * Example: * ```ts * const volt = new VoltAgent({ * triggers: createTriggers((on) => { * on.github.star(async ({ payload }) => { * // ... * }); * }), * }); * ``` */ declare function createTriggers(builder: (on: TriggerDsl) => void): VoltAgentTriggersConfig; /** * In-Memory Storage Adapter for Memory V2 * Stores conversations and messages in memory */ /** * In-Memory Storage Adapter * Simple implementation for testing and development */ declare class InMemoryStorageAdapter implements StorageAdapter { private storage; private conversations; private users; private workflowStates; private workflowStatesByWorkflow; private conversationSteps; /** * Add a single message */ addMessage(message: UIMessage, userId: string, conversationId: string, _context?: OperationContext): Promise; /** * Add multiple messages */ addMessages(messages: UIMessage[], userId: string, conversationId: string, context?: OperationContext): Promise; /** * Get messages with optional filtering */ getMessages(userId: string, conversationId: string, options?: GetMessagesOptions, _context?: OperationContext): Promise[]>; saveConversationSteps(steps: ConversationStepRecord[]): Promise; getConversationSteps(userId: string, conversationId: string, options?: GetConversationStepsOptions): Promise; /** * Delete specific messages by ID for a conversation */ deleteMessages(messageIds: string[], userId: string, conversationId: string, _context?: OperationContext): Promise; /** * Clear messages for a user */ clearMessages(userId: string, conversationId?: string, _context?: OperationContext): Promise; /** * Create a new conversation */ createConversation(input: CreateConversationInput): Promise; /** * Get a conversation by ID */ getConversation(id: string): Promise; /** * Get conversations for a resource */ getConversations(resourceId: string): Promise; /** * Get conversations by user ID with query options */ getConversationsByUserId(userId: string, options?: Omit): Promise; /** * Query conversations with advanced options */ queryConversations(options: ConversationQueryOptions): Promise; /** * Count conversations matching query filters */ countConversations(options: ConversationQueryOptions): Promise; /** * Update a conversation */ updateConversation(id: string, updates: Partial>): Promise; /** * Delete a conversation */ deleteConversation(id: string): Promise; /** * Get working memory content from metadata */ getWorkingMemory(params: { conversationId?: string; userId?: string; scope: WorkingMemoryScope; }): Promise; /** * Set working memory content in metadata */ setWorkingMemory(params: { conversationId?: string; userId?: string; content: string; scope: WorkingMemoryScope; }): Promise; /** * Delete working memory from metadata */ deleteWorkingMemory(params: { conversationId?: string; userId?: string; scope: WorkingMemoryScope; }): Promise; /** * Get workflow state by execution ID */ getWorkflowState(executionId: string): Promise; /** * Query workflow states with optional filters */ queryWorkflowRuns(query: WorkflowRunQuery): Promise; /** * Set workflow state */ setWorkflowState(executionId: string, state: WorkflowStateEntry): Promise; /** * Update workflow state */ updateWorkflowState(executionId: string, updates: Partial): Promise; /** * Get suspended workflow states for a workflow */ getSuspendedWorkflowStates(workflowId: string): Promise; /** * Get storage statistics */ getStats(): { totalConversations: number; totalUsers: number; totalMessages: number; }; private getOrCreateUserSteps; private getOrCreateConversationSteps; /** * Clear all data */ clear(): void; } /** * Lightweight in-memory vector database adapter * Suitable for development, testing, and small datasets (< 10k vectors) */ declare class InMemoryVectorAdapter implements VectorAdapter$1 { private vectors; private dimensions; constructor(); store(id: string, vector: number[], metadata?: Record): Promise; storeBatch(items: VectorItem$1[]): Promise; search(queryVector: number[], options?: { limit?: number; filter?: Record; threshold?: number; }): Promise; delete(id: string): Promise; deleteBatch(ids: string[]): Promise; clear(): Promise; count(): Promise; get(id: string): Promise; /** * Check if metadata matches the filter criteria */ private matchesFilter; /** * Get statistics about the vector store */ getStats(): Promise<{ count: number; dimensions: number | null; memoryUsage: number; }>; } /** * AI SDK Embedding Adapter * Wraps Vercel AI SDK embedding models for use with Memory V2 */ declare class AiSdkEmbeddingAdapter implements EmbeddingAdapter$1 { private model; private dimensions; private modelName; private options; private modelResolvePromise?; constructor(model: EmbeddingModelReference, options?: EmbeddingOptions); private resolveModel; embed(text: string): Promise; embedBatch(texts: string[]): Promise; getDimensions(): number; getModelName(): string; /** * Normalize a vector to unit length */ private normalizeVector; } type LanguageModelFactory = (modelId: string) => LanguageModel; type EmbeddingModelInstance = Exclude; type EmbeddingModelFactory = (modelId: string) => EmbeddingModelInstance; type ModelProvider = { languageModel: LanguageModelFactory; embeddingModel?: EmbeddingModelFactory; embedding?: EmbeddingModelFactory; textEmbeddingModel?: EmbeddingModelFactory; textEmbedding?: EmbeddingModelFactory; }; type ModelProviderEntry = ModelProvider | LanguageModelFactory; type ModelProviderLoader = () => Promise; declare global { var ___voltagent_model_provider_registry: ModelProviderRegistry | undefined; } declare class ModelProviderRegistry { private providers; private providerEntries; private loaders; private entryLoading; private dynamicRegistry; private refreshInterval; private lastRefreshTime; private isRefreshing; private cacheLoadPromise; private autoRefreshStarting; private constructor(); static getInstance(): ModelProviderRegistry; private createProviderLoader; private registerProviderConfig; private registerBuiltinProviders; private getRegistryEntry; private ensureCacheLoaded; private loadCachedSnapshot; getLastRefreshTime(): Date | null; refreshRegistry(force?: boolean): Promise; startAutoRefresh(intervalMs?: number): void; stopAutoRefresh(): void; registerProvider(providerId: string, provider: ModelProviderEntry): void; registerProviderLoader(providerId: string, loader: ModelProviderLoader): void; unregisterProvider(providerId: string): void; listProviders(): string[]; resolveLanguageModel(modelId: string): Promise; resolveEmbeddingModel(modelId: string): Promise; private getProvider; private getProviderEntry; private normalizeProvider; } /** * Defines the main category of a TimelineEvent. */ type TimelineEventCoreType = "agent" | "tool" | "memory" | "retriever" | "workflow" | "workflow-step"; /** * Defines the operational status of a TimelineEvent. * 'idle' is added for consistency with frontend initial states. * 'suspended' is added for workflow suspension state. */ type TimelineEventCoreStatus = "idle" | "running" | "completed" | "error" | "suspended"; /** * Defines the severity level of a TimelineEvent. */ type TimelineEventCoreLevel = "DEBUG" | "INFO" | "WARNING" | "ERROR" | "CRITICAL"; /** * Usage information for tracking resource consumption */ interface Usage { promptTokens?: number; completionTokens?: number; totalTokens?: number; input?: number; output?: number; total?: number; unit?: "TOKENS" | "CHARACTERS" | "MILLISECONDS" | "SECONDS" | "IMAGES"; inputCost?: number; outputCost?: number; totalCost?: number; [key: string]: unknown; } /** * Base metadata interface with common fields for all timeline events */ interface BaseEventMetadata { displayName?: string; id: string; agentId?: string; context?: Record; } /** * Prompt management utilities for agent prompt tuning */ type ExtractVariableNames = T extends `${string}{{${infer Param}}}${infer Rest}` ? Param | ExtractVariableNames : never; type AllowedVariableValue = string | number | boolean | undefined | null; type TemplateVariables = { [K in ExtractVariableNames]: AllowedVariableValue; }; type PromptTemplate = [ExtractVariableNames] extends [never] ? { template: T; variables?: Record; } : { template: T; variables: TemplateVariables; }; type PromptCreator = (extraVariables?: Partial>) => string; /** * Creates a type-safe, customizable prompt function from a template string. * Variable names are automatically inferred from the template `{{variable}}` syntax. * * @param template - The template string with `{{variable}}` placeholders. * @param variables - An object containing the default values for the template variables. * @returns A function that takes optional extra variables and returns the processed prompt string. */ declare const createPrompt: ({ template, variables, }: PromptTemplate) => PromptCreator; /** * Node types for agents, tools, and other components */ declare enum NodeType { AGENT = "agent", SUBAGENT = "agent", TOOL = "tool", MEMORY = "memory", MESSAGE = "message", OUTPUT = "output", GUARDRAIL = "guardrail", MIDDLEWARE = "middleware", RETRIEVER = "retriever", VECTOR = "vector", EMBEDDING = "embedding", SCORER = "scorer", WORKFLOW_STEP = "workflow_step", WORKFLOW_AGENT_STEP = "workflow_agent_step", WORKFLOW_FUNC_STEP = "workflow_func_step", WORKFLOW_TAP_STEP = "workflow_tap_step", WORKFLOW_WORKFLOW_STEP = "workflow_workflow_step", WORKFLOW_CONDITIONAL_STEP = "workflow_conditional_step", WORKFLOW_PARALLEL_ALL_STEP = "workflow_parallel_all_step", WORKFLOW_PARALLEL_RACE_STEP = "workflow_parallel_race_step", WORKFLOW_SLEEP_STEP = "workflow_sleep_step", WORKFLOW_SLEEP_UNTIL_STEP = "workflow_sleep_until_step", WORKFLOW_FOREACH_STEP = "workflow_foreach_step", WORKFLOW_LOOP_STEP = "workflow_loop_step", WORKFLOW_BRANCH_STEP = "workflow_branch_step", WORKFLOW_MAP_STEP = "workflow_map_step" } /** * Standard node ID creation function * @param type Node type * @param name Main identifier (tool name, agent name, etc.) * @param ownerId Owner ID (optional) * @returns Standard formatted node ID */ declare const createNodeId: (type: NodeType, name: string, ownerId?: string) => string; /** * Function to extract node type from NodeID * @param nodeId Node ID * @returns NodeType or null (if type cannot be found) */ declare const getNodeTypeFromNodeId: (nodeId: string) => NodeType | null; /** * Workflow step types enum */ type WorkflowStepType = "agent" | "func" | "tap" | "workflow" | "conditional-when" | "parallel-all" | "parallel-race" | "sleep" | "sleep-until" | "foreach" | "loop" | "branch" | "map"; /** * Create a workflow step node ID with consistent pattern * @param stepType Type of workflow step * @param stepIndex Index of step in workflow * @param workflowId Workflow identifier * @param options Additional options for node ID generation * @returns Consistent workflow step node ID */ declare const createWorkflowStepNodeId: (stepType: WorkflowStepType, stepIndex: number, workflowId: string, options?: { agentId?: string; parallelIndex?: number; stepName?: string; stepId?: string; }) => string; /** * Get NodeType for workflow step type * @param stepType Workflow step type * @returns Corresponding NodeType */ declare const getWorkflowStepNodeType: (stepType: WorkflowStepType) => NodeType; /** * Extract workflow step information from node ID * @param nodeId Workflow step node ID * @returns Extracted workflow step info or null */ declare const extractWorkflowStepInfo: (nodeId: string) => { stepType: WorkflowStepType; stepIndex: number; workflowId: string; agentId?: string; parallelIndex?: number; stepName?: string; } | null; /** * Tool call interface */ interface ToolCall { id: string; type: "function"; function: { name: string; arguments: string; }; } /** * Converts a Zod-like schema to a JSON representation usable in the UI * @param schema Any Zod schema object * @returns A JSON Schema compatible representation of the Zod schema */ declare function zodSchemaToJsonUI(schema: any): any; /** * Safely parse JSON string. If parsing fails, returns the original value. * @param value String to parse as JSON * @returns Parsed JSON object or original value if parsing fails */ declare function safeJsonParse(value: string | null | undefined): any; declare function serializeValueForDebug(value: unknown): unknown; /** * Type guard to check if content is a string */ declare function isTextContent(content: MessageContent): content is string; /** * Type guard to check if content is structured (array of content parts) */ declare function isStructuredContent(content: MessageContent): content is Array; /** * Check if content or message has any text parts * @param input - MessageContent or UIMessage * @returns True if has text parts */ declare function hasTextPart(content: MessageContent): boolean; declare function hasTextPart(message: UIMessage): boolean; /** * Check if content or message has any image parts * @param input - MessageContent or UIMessage * @returns True if has image parts */ declare function hasImagePart(content: MessageContent): boolean; declare function hasImagePart(message: UIMessage): boolean; /** * Check if content or message has any file parts * @param input - MessageContent or UIMessage * @returns True if has file parts */ declare function hasFilePart(content: MessageContent): boolean; declare function hasFilePart(message: UIMessage): boolean; /** * Extract text from message content or UIMessage * @param input - MessageContent (from ModelMessage.content) or UIMessage object * @returns All text content joined together * @example * // From MessageContent * const content = [{ type: "text", text: "Hello" }]; * extractText(content); // "Hello" * * // From UIMessage * const message = { id: "1", role: "user", parts: [{ type: "text", text: "Hi" }] }; * extractText(message); // "Hi" */ declare function extractText(content: MessageContent): string; declare function extractText(message: UIMessage): string; /** * Extract all text parts from structured content or UIMessage * @param input - MessageContent or UIMessage * @returns Array of text parts */ declare function extractTextParts(content: MessageContent): Array<{ type: "text"; text: string; }>; declare function extractTextParts(message: UIMessage): TextUIPart[]; /** * Extract image parts from message content or UIMessage * @param input - MessageContent or UIMessage * @returns Array of image parts (FileUIPart for UIMessage) */ declare function extractImageParts(content: MessageContent): Array; declare function extractImageParts(message: UIMessage): FileUIPart[]; /** * Extract file parts from message content or UIMessage * @param input - MessageContent or UIMessage * @returns Array of file parts */ declare function extractFileParts(content: MessageContent): Array; declare function extractFileParts(message: UIMessage): FileUIPart[]; /** * Transform text content in a message */ declare function transformTextContent(content: MessageContent, transformer: (text: string) => string): MessageContent; /** * Map UIMessage text parts with a transformer function */ declare function mapMessageContent(message: UIMessage, transformer: (text: string) => string): UIMessage; /** * Filter content parts by type */ declare function filterContentParts(content: MessageContent, predicate: (part: any) => boolean): MessageContent; /** * Normalize content to always be an array */ declare function normalizeToArray(content: MessageContent): Array; /** * Normalize content to the most compact form */ declare function normalizeContent(content: MessageContent): MessageContent; /** * Builder class for creating message content */ declare class MessageContentBuilder { private parts; /** * Add a text part */ addText(text: string): this; /** * Add an image part */ addImage(image: string | Uint8Array): this; /** * Add a file part */ addFile(file: string | Uint8Array, mimeType?: string): this; /** * Add a custom part */ addPart(part: any): this; /** * Build the final content */ build(): MessageContent; /** * Build as array (always returns array) */ buildAsArray(): Array; /** * Clear all parts */ clear(): this; /** * Get current parts count */ get length(): number; } /** * Convenience function to add timestamp to user messages (UIMessage only) */ declare function addTimestampToMessage(message: UIMessage, timestamp?: string): UIMessage; /** * Convenience function to prepend text to UIMessage text parts */ declare function prependToMessage(message: UIMessage, prefix: string): UIMessage; /** * Convenience function to append text to UIMessage text parts */ declare function appendToMessage(message: UIMessage, suffix: string): UIMessage; /** * Check if UIMessage has any content */ declare function hasContent(message: UIMessage): boolean; /** * Get content length (text characters, array items, or UIMessage parts count) * @param input - MessageContent or UIMessage * @returns Length/count of content */ declare function getContentLength(content: MessageContent): number; declare function getContentLength(message: UIMessage): number; /** * Combined message helpers object for easy importing * All functions now support both MessageContent and UIMessage formats */ declare const messageHelpers: { isTextContent: typeof isTextContent; isStructuredContent: typeof isStructuredContent; hasTextPart: typeof hasTextPart; hasImagePart: typeof hasImagePart; hasFilePart: typeof hasFilePart; extractText: typeof extractText; extractTextParts: typeof extractTextParts; extractImageParts: typeof extractImageParts; extractFileParts: typeof extractFileParts; transformTextContent: typeof transformTextContent; mapMessageContent: typeof mapMessageContent; filterContentParts: typeof filterContentParts; normalizeToArray: typeof normalizeToArray; normalizeContent: typeof normalizeContent; addTimestampToMessage: typeof addTimestampToMessage; prependToMessage: typeof prependToMessage; appendToMessage: typeof appendToMessage; hasContent: typeof hasContent; getContentLength: typeof getContentLength; MessageContentBuilder: typeof MessageContentBuilder; }; declare const isServerlessRuntime: () => boolean; declare const isNodeRuntime: () => boolean; declare const getEnvVar: (key: string) => string | undefined; type KnowledgeBaseTagFilter = { tagName: string; tagValue: string; }; type RagSearchKnowledgeBaseRequest = { knowledgeBaseId: string; query?: string | null; topK?: number; tagFilters?: KnowledgeBaseTagFilter[] | null; }; type RagKnowledgeBaseSummary = { id: string; project_id: string; name: string; description?: string | null; embedding_model: string; embedding_dimension: number; chunking_config: Record; token_count: number; created_at: string; updated_at: string; deleted_at?: string | null; }; type RagSearchKnowledgeBaseChildChunk = { chunkIndex: number; content: string; startOffset: number; endOffset: number; similarity: number; }; type RagSearchKnowledgeBaseResult = { documentId: string; documentName: string; content: string; chunkIndex: number; similarity: number; metadata: Record; childChunks?: RagSearchKnowledgeBaseChildChunk[]; }; type RagSearchKnowledgeBaseResponse = { knowledgeBaseId: string; query: string; totalResults: number; results: RagSearchKnowledgeBaseResult[]; }; type VoltAgentRagRetrieverKnowledgeBaseOptions = { knowledgeBaseName: string; }; type VoltAgentRagRetrieverOptions = RetrieverOptions & VoltAgentRagRetrieverKnowledgeBaseOptions & { voltOpsClient?: VoltOpsClient; topK?: number; tagFilters?: KnowledgeBaseTagFilter[] | null; maxChunkCharacters?: number; includeSources?: boolean; includeSimilarity?: boolean; }; /** * Retriever that queries VoltAgent RAG Knowledge Bases via the VoltAgent API. * * Works with the `/rag/project/search` endpoint and returns the top-k chunks as context. */ declare class VoltAgentRagRetriever extends BaseRetriever { private readonly search; private readonly listKnowledgeBases; private readonly knowledgeBaseName; private resolvedKnowledgeBaseId; private resolveKnowledgeBaseIdPromise; private readonly topK; private readonly tagFilters; private readonly maxChunkCharacters; private readonly includeSources; private readonly includeSimilarity; constructor(options: VoltAgentRagRetrieverOptions); getObservabilityAttributes(): Record; private resolveKnowledgeBaseId; retrieve(input: string | BaseMessage[], options: RetrieveOptions): Promise; } /** * Creates an AgentTool from a retriever, allowing it to be used as a tool in an agent. * This is the preferred way to use a retriever as a tool, as it properly maintains the 'this' context. * * @param retriever - The retriever instance to convert to a tool * @param options - Options for customizing the tool * @returns An AgentTool that can be added to an agent's tools * * @example * ```typescript * const retriever = new SimpleRetriever(); * const searchTool = createRetrieverTool(retriever, { * name: "search_knowledge", * description: "Searches the knowledge base for information" * }); * * agent.addTool(searchTool); * ``` */ declare const createRetrieverTool: (retriever: Retriever, options?: { name?: string; description?: string; }) => AgentTool; /** * Registry to manage and track agents */ declare global { var ___voltagent_agent_registry: AgentRegistry | undefined; } declare class AgentRegistry { private agents; private isInitialized; private globalVoltOpsClient?; private globalLogger?; private globalObservability?; private globalMemory?; private globalAgentMemory?; private globalWorkflowMemory?; private globalToolRouting?; private globalWorkspace?; /** * Track parent-child relationships between agents (child -> parents) */ private agentRelationships; private constructor(); /** * Get the singleton instance of AgentRegistry */ static getInstance(): AgentRegistry; /** * Initialize the registry */ initialize(): void; /** * Register a new agent */ registerAgent(agent: Agent): void; /** * Get an agent by ID */ getAgent(id: string): Agent | undefined; /** * Get all registered agents */ getAllAgents(): Agent[]; /** * Register a parent-child relationship between agents * @param parentId ID of the parent agent * @param childId ID of the child agent (sub-agent) */ registerSubAgent(parentId: string, childId: string): void; /** * Remove a parent-child relationship * @param parentId ID of the parent agent * @param childId ID of the child agent */ unregisterSubAgent(parentId: string, childId: string): void; /** * Get all parent agent IDs for a given child agent * @param childId ID of the child agent * @returns Array of parent agent IDs */ getParentAgentIds(childId: string): string[]; /** * Clear all parent-child relationships for an agent when it's removed * @param agentId ID of the agent being removed */ clearAgentRelationships(agentId: string): void; /** * Remove an agent by ID */ removeAgent(id: string): boolean; /** * Get agent count */ getAgentCount(): number; /** * Check if registry is initialized */ isRegistryInitialized(): boolean; /** * Set the global VoltOpsClient instance. * This replaces the old telemetryExporter approach with a unified solution. */ setGlobalVoltOpsClient(client: VoltOpsClient | undefined): void; /** * Get the global VoltOpsClient instance. */ getGlobalVoltOpsClient(): VoltOpsClient | undefined; /** * Set the global Logger instance. */ setGlobalLogger(logger: Logger): void; /** * Get the global Logger instance. */ getGlobalLogger(): Logger | undefined; /** * Set the global VoltAgentObservability instance. * This enables OpenTelemetry-compliant tracing for all agents. */ setGlobalObservability(observability: VoltAgentObservability): void; /** * Get the global VoltAgentObservability instance. */ getGlobalObservability(): VoltAgentObservability | undefined; /** * Set the global fallback Memory instance. */ setGlobalMemory(memory: Memory | undefined): void; /** * Get the global fallback Memory instance. */ getGlobalMemory(): Memory | undefined; /** * Set the global default Memory instance for agents. */ setGlobalAgentMemory(memory: Memory | undefined): void; /** * Get the global default Memory instance for agents. */ getGlobalAgentMemory(): Memory | undefined; /** * Set the global default Memory instance for workflows. */ setGlobalWorkflowMemory(memory: Memory | undefined): void; /** * Get the global default Memory instance for workflows. */ getGlobalWorkflowMemory(): Memory | undefined; /** * Set the global default tool routing configuration. */ setGlobalToolRouting(toolRouting: ToolRoutingConfig | undefined): void; /** * Get the global default tool routing configuration. */ getGlobalToolRouting(): ToolRoutingConfig | undefined; /** * Set the global Workspace instance. */ setGlobalWorkspace(workspace: Workspace | undefined): void; /** * Get the global Workspace instance. */ getGlobalWorkspace(): Workspace | undefined; } type UpdateOptions = { filter?: string; useCache?: boolean; forceRefresh?: boolean; }; /** * Package update info with semver details */ type PackageUpdateInfo = { name: string; installed: string; latest: string; type: "major" | "minor" | "patch" | "latest"; packageJson: string; }; /** * Checks for dependency updates using native package manager commands * @returns Object containing update information */ declare const checkForUpdates: (packagePath?: string, options?: UpdateOptions) => Promise<{ hasUpdates: boolean; updates: PackageUpdateInfo[]; count: number; message: string; }>; /** * Update all packages that have available updates using native package manager * @param packagePath Optional path to package.json, uses current directory if not provided * @returns Result of the update operation */ declare const updateAllPackages: (packagePath?: string) => Promise<{ success: boolean; message: string; updatedPackages?: string[]; requiresRestart?: boolean; }>; /** * Update a single package to its latest version using native package manager * @param packageName Name of the package to update * @param packagePath Optional path to package.json, uses current directory if not provided * @returns Result of the update operation */ declare const updateSinglePackage: (packageName: string, packagePath?: string) => Promise<{ success: boolean; message: string; packageName: string; requiresRestart?: boolean; }>; /** * Main VoltAgent class for managing agents and server */ declare class VoltAgent { private registry; private workflowRegistry; private serverInstance?; private serverlessProvider?; private logger; private observability?; private defaultAgentMemory?; private defaultWorkflowMemory?; private readonly defaultAgentConversationPersistence?; private readonly mcpServers; private readonly mcpServerRegistry; private readonly a2aServers; private readonly a2aServerRegistry; private readonly ensureEnvironmentBinding; private readonly triggerRegistry; private readonly agentRefs; private lastServerlessRemoteConfig?; readonly ready: Promise; initError?: unknown; degraded: boolean; constructor(options: VoltAgentOptions); serverless(): IServerlessProvider; private ensureEnvironment; private autoConfigureVoltOpsClientFromEnv; private syncServerlessObservabilityRemote; private isSameServerlessRemoteConfig; private areHeaderRecordsEqual; /** * Setup graceful shutdown handlers */ private setupShutdownHandlers; private isSoleSignalHandler; /** * Check for dependency updates */ private checkDependencies; /** * Register an agent */ registerTrigger(name: string, config: VoltAgentTriggerConfig): void; registerTriggers(triggers?: VoltAgentTriggersConfig): void; private applyDefaultMemoryToAgent; private applyDefaultConversationPersistenceToAgent; private applyDefaultWorkspaceToAgent; private applyDefaultWorkspaceToAgents; private applyDefaultMemoryToWorkflow; registerAgent(agent: Agent): void; /** * Register multiple agents */ registerAgents(agents?: Record): void; /** * Start the server */ startServer(): Promise; /** * Stop the server */ stopServer(): Promise; /** * Get all registered agents */ getAgents(): Agent[]; /** * Get agent by ID */ getAgent(id: string): Agent | undefined; /** * Get agent count */ getAgentCount(): number; /** * Register workflows */ registerWorkflows(workflows: Record | WorkflowChain>): void; /** * Register a single workflow */ registerWorkflow(workflow: Workflow): void; /** * Get all registered workflows */ getWorkflows(): Workflow[]; /** * Get workflow by ID */ getWorkflow(id: string): Workflow | undefined; /** * Get workflow count */ getWorkflowCount(): number; /** * Get observability instance */ getObservability(): VoltAgentObservability | undefined; /** * Shutdown telemetry (delegates to VoltAgentObservability) */ shutdownTelemetry(): Promise; /** * Gracefully shutdown all VoltAgent resources * This includes stopping the server, suspending workflows, and shutting down telemetry * Useful for programmatic cleanup or when integrating with other frameworks */ shutdown(): Promise; private initializeMCPServer; private initializeA2AServer; private startConfiguredMcpTransports; getMCPDependencies(): MCPServerDeps; private getA2ADependencies; getServerInstance(): IServerProvider | undefined; private shutdownMcpServers; private shutdownA2AServers; } /** * Utility for converting between different usage formats */ /** * Convert AI SDK usage format to VoltAgent usage format * AI SDK uses: inputTokens, outputTokens, totalTokens * VoltAgent uses: promptTokens, completionTokens, totalTokens */ declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined; export { A2AServerRegistry, AbortError, Agent, type AgentConversationPersistenceMode, type AgentConversationPersistenceOptions, type AgentEvalConfig, type AgentEvalContext, type AgentEvalFeedbackHelper, type AgentEvalFeedbackSaveInput, type AgentEvalOperationType, type AgentEvalPayload, type AgentEvalResult, type AgentEvalResultCallbackArgs, type AgentEvalSamplingPolicy, type AgentEvalScorerConfig, type AgentEvalScorerFactory, type AgentEvalScorerReference, type AgentEvalToolCall, type AgentEvalToolResult, type AgentFeedbackHandle, type AgentFeedbackMarkProvidedInput, type AgentFeedbackMetadata, type AgentFeedbackOptions, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnFallback, type AgentHookOnHandoff, type AgentHookOnHandoffComplete, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnRetry, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolError, type AgentHookOnToolStart, type AgentHooks, type AgentMarkFeedbackProvidedInput, type AgentModelConfig, type AgentModelReference, type AgentModelValue, type AgentOptions, AgentRegistry, type AgentResponse, type AgentScorerState, type AgentStatus, type AgentSummarizationOptions, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type BuildScorerOptions, type BuildScorerRunArgs, type BuildScorerRunResult, type BuilderAnalyzeContext, type BuilderPrepareContext, type BuilderReasonContext, type BuilderScoreContext, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, CompositeFilesystemBackend, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type ConversationStepRecord, type ConversationStepType, type ConversationTitleConfig, type ConversationTitleGenerator, ConversationTodoBackend, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateInputGuardrailOptions, type CreateInputMiddlewareOptions, type CreateOutputGuardrailOptions, type CreateOutputMiddlewareOptions, type CreateReasoningToolsOptions, type CreateScorerOptions, DEFAULT_INSTRUCTIONS, DELETE_FILE_TOOL_DESCRIPTION, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, EDIT_FILE_TOOL_DESCRIPTION, type EditResult, type EmbeddingAdapter, type EmbeddingAdapterConfig, type EmbeddingAdapterInput, EmbeddingAdapterNotConfiguredError, EmbeddingError, type EmbeddingModelFactory, type EmbeddingModelReference, type EmbeddingRouterModelId, type ExtractVariableNames, FEW_SHOT_EXAMPLES, FILESYSTEM_SYSTEM_PROMPT, type FallbackStage, type FileData, type FileInfo, type FilesystemBackend, type FilesystemBackendContext, type FilesystemBackendFactory, type FilesystemToolkitOptions, GLOB_TOOL_DESCRIPTION, GREP_TOOL_DESCRIPTION, type GenerateObjectOptions, type GenerateObjectResultWithContext, type GenerateObjectSubAgentConfig, type GenerateReasonResult, type GenerateScoreResult, type GenerateScoreStep, type GenerateTextOptions, type GenerateTextResultWithContext, type GenerateTextSubAgentConfig, type GetConversationStepsOptions, type GetMessagesOptions, type GrepMatch, type GuardrailAction, type GuardrailContext, type GuardrailDefinition, type GuardrailFunction, type GuardrailSeverity, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryFilesystemBackend, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type InputGuardrail, type InputGuardrailArgs, type InputGuardrailBlockedEventData, type InputGuardrailBlockedStreamPart, type InputGuardrailResult, type InputMiddleware, type InputMiddlewareArgs, type InputMiddlewareResult, type KnowledgeBaseTagFilter, type LLMProvider, LS_TOOL_DESCRIPTION, type LanguageModelFactory, LazyRemoteExportProcessor, LocalSandbox, type LocalSandboxIsolationOptions, type LocalSandboxIsolationProvider, type LocalSandboxOptions, type LocalScorerDefinition, type LocalScorerExecutionResult, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, type MCPAuthorizationAction, type MCPAuthorizationConfig, type MCPAuthorizationContext, MCPAuthorizationError, type MCPCanFunction, type MCPCanParams, type MCPCanResult, MCPClient, type MCPClientCallOptions, type MCPClientConfig, MCPConfiguration, type MCPConfigurationOptions, type MCPElicitationAdapter, type MCPElicitationHandler, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, type ManagedMemoryAddMessageInput, type ManagedMemoryAddMessagesInput, type ManagedMemoryClearMessagesInput, type ManagedMemoryConnectionInfo, type ManagedMemoryConversationsClient, type ManagedMemoryCredentialCreateResult, type ManagedMemoryCredentialListResult, type ManagedMemoryCredentialSummary, type ManagedMemoryDatabaseSummary, type ManagedMemoryDeleteMessagesInput, type ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, type ManagedMemoryQueryWorkflowRunsInput, type ManagedMemorySetWorkingMemoryInput, type ManagedMemoryStatus, type ManagedMemoryUpdateConversationInput, type ManagedMemoryVoltOpsClient, type ManagedMemoryWorkflowStateUpdateInput, type ManagedMemoryWorkflowStatesClient, type ManagedMemoryWorkingMemoryClient, type ManagedMemoryWorkingMemoryInput, Memory, type MemoryConfig, type MemoryOptions, type MemoryStorageMetadata, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, MiddlewareAbortError, type MiddlewareAbortOptions, type MiddlewareContext, type MiddlewareDefinition, type MiddlewareDirection, type MiddlewareFunction, type ModelForProvider, type ModelProvider, type ModelProviderEntry, type ModelProviderLoader, ModelProviderRegistry, type ModelRouterModelId, type ModelToolCall, NextAction, NodeFilesystemBackend, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type NormalizedCommand, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnFallbackHookArgs, type OnHandoffCompleteHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnRetryHookArgs, type OnRetryHookArgsBase, type OnRetryLLMHookArgs, type OnRetryMiddlewareHookArgs, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolEndHookResult, type OnToolErrorHookArgs, type OnToolErrorHookResult, type OnToolStartHookArgs, type OperationContext, type OutputGuardrail, type OutputGuardrailArgs, type OutputGuardrailResult, type OutputMiddleware, type OutputMiddlewareArgs, type OutputMiddlewareResult, type OutputSpec$1 as OutputSpec, type PackageUpdateInfo, PlanAgent, type PlanAgentExtension, type PlanAgentExtensionContext, type PlanAgentExtensionResult, type PlanAgentFileData, type PlanAgentOptions, type PlanAgentState, type PlanAgentSubagentDefinition, type PlanAgentTodoItem, type PlanAgentTodoStatus, type PlanningToolkitOptions, type PrepareStep, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderId, type ProviderModelsMap, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ProviderTool, READ_FILE_TOOL_DESCRIPTION, type RagKnowledgeBaseSummary, type RagSearchKnowledgeBaseChildChunk, type RagSearchKnowledgeBaseRequest, type RagSearchKnowledgeBaseResponse, type RagSearchKnowledgeBaseResult, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredTrigger, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type ResumableStreamAdapter, type ResumableStreamContext, type RetrieveOptions, type Retriever, type RetrieverOptions, type RetrySource, type RunLocalScorersArgs, type RunLocalScorersResult, SERVERLESS_ENV_CONTEXT_KEY, type SamplingMetadata, type SamplingPolicy, type ScorerBuilder, type ScorerContext, type ScorerLifecycleScope, type ScorerPipelineContext, type ScorerReasonContext, type ScorerResult, type SearchOptions, type SearchResult$1 as SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type ServerlessProviderFactory, type ServerlessRemoteEndpointConfig, type ServerlessRemoteExportConfig, type ServerlessRequestHandler, ServerlessVoltAgentObservability, type SpanAttributes, type SpanEvent, type SpanFilterConfig, SpanFilterProcessor, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, StorageLogProcessor, type StoredUIMessage, type StreamObjectFinishResult, type StreamObjectOnFinishCallback, type StreamObjectOptions, type StreamObjectResultWithContext, type StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextResultWithContext, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, TRIGGER_CONTEXT_KEY, type TaskToolOptions, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, type TodoBackend, type TodoBackendFactory, Tool, type ToolCall, type ToolContext, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, type ToolExecutionResult, type ToolHookOnEnd, type ToolHookOnEndArgs, type ToolHookOnEndResult, type ToolHookOnStart, type ToolHookOnStartArgs, type ToolHooks, ToolManager, type ToolOptions, type ToolResultOutput, type ToolRoutingConfig, type ToolRoutingEmbeddingConfig, type ToolRoutingEmbeddingInput, type ToolSchema, type ToolSearchCandidate, type ToolSearchContext, type ToolSearchResult, type ToolSearchResultItem, type ToolSearchSelection, type ToolSearchStrategy, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type TriggerHandler, type TriggerHandlerBody, type TriggerHandlerContext, type TriggerHandlerResponse, type TriggerHandlerResult, type TriggerHandlerReturn, type TriggerHttpMethod, TriggerRegistry, type Usage, type UsageInfo, UserInputBridge, type UserInputHandler, type VectorAdapter$1 as VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem$1 as VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, VoltAgentRagRetriever, type VoltAgentRagRetrieverOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, type VoltAgentTriggerConfig, type VoltAgentTriggersConfig, type VoltOpsActionExecutionResult, type VoltOpsActionsApi, VoltOpsActionsClient, type VoltOpsActionsTransport, type VoltOpsAirtableCreateRecordParams, type VoltOpsAirtableCredential, type VoltOpsAirtableDeleteRecordParams, type VoltOpsAirtableGetRecordParams, type VoltOpsAirtableListRecordsParams, type VoltOpsAirtableUpdateRecordParams, type VoltOpsAppendEvalRunResultPayload, type VoltOpsAppendEvalRunResultsRequest, VoltOpsClient, type VoltOpsClientOptions, type VoltOpsCompleteEvalRunRequest, type VoltOpsCreateEvalRunRequest, type VoltOpsCreateScorerRequest, type VoltOpsDiscordChannelMessageParams, type VoltOpsDiscordChannelType, type VoltOpsDiscordConfig, type VoltOpsDiscordCreateChannelParams, type VoltOpsDiscordCredential, type VoltOpsDiscordDeleteChannelParams, type VoltOpsDiscordGetChannelParams, type VoltOpsDiscordListChannelsParams, type VoltOpsDiscordListMembersParams, type VoltOpsDiscordListMessagesParams, type VoltOpsDiscordMemberRoleParams, type VoltOpsDiscordReactionParams, type VoltOpsDiscordSendMessageParams, type VoltOpsDiscordSendWebhookMessageParams, type VoltOpsDiscordUpdateChannelParams, type VoltOpsEvalResultStatus, type VoltOpsEvalRunCompletionSummaryPayload, type VoltOpsEvalRunErrorPayload, type VoltOpsEvalRunResultLiveMetadata, type VoltOpsEvalRunResultScorePayload, type VoltOpsEvalRunStatus, type VoltOpsEvalRunSummary, type VoltOpsFeedback, type VoltOpsFeedbackConfig, type VoltOpsFeedbackCreateInput, type VoltOpsFeedbackExpiresIn, type VoltOpsFeedbackToken, type VoltOpsFeedbackTokenCreateInput, type VoltOpsObservabilityApi, type VoltOpsObservabilityTrace, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, type VoltOpsScorerSummary, type VoltOpsSlackCredential, type VoltOpsSlackDeleteMessageParams, type VoltOpsSlackPostMessageParams, type VoltOpsSlackSearchMessagesParams, type VoltOpsTerminalEvalRunStatus, type VoltOpsTraceListOptions, type VoltOpsTraceListResponse, type VoltOpsTraceSortOrder, type VoltOpsTriggerDefinition, VoltOpsTriggerDefinitions, type VoltOpsTriggerEnvelope, type VoltOpsTriggerGroupMap, type VoltOpsTriggerName, VoltOpsTriggerNames, WRITE_FILE_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_DESCRIPTION, WRITE_TODOS_TOOL_NAME, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type WeightedBlendComponent, type WeightedBlendOptions, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, type WorkflowHookContext, type WorkflowHookStatus, type WorkflowHooks, WorkflowRegistry, type WorkflowRestartAllResult, type WorkflowRestartCheckpoint, type WorkflowRunQuery, type WorkflowStartAsyncResult, type WorkflowStateEntry, type WorkflowStateStore, type WorkflowStateUpdater, type WorkflowStats, type WorkflowStepContext, type WorkflowStepData, type WorkflowStepStatus, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, Workspace, type WorkspaceConfig, type DeleteResult as WorkspaceDeleteResult, type EditResult as WorkspaceEditResult, type FileData as WorkspaceFileData, type FileInfo as WorkspaceFileInfo, WorkspaceFilesystem, type FilesystemBackend as WorkspaceFilesystemBackend, type FilesystemBackendContext as WorkspaceFilesystemBackendContext, type FilesystemBackendFactory as WorkspaceFilesystemBackendFactory, type WorkspaceFilesystemCallContext, type WorkspaceFilesystemConfig, type WorkspaceFilesystemDeleteOptions, type WorkspaceFilesystemOperationOptions, type WorkspaceFilesystemOptions, type WorkspaceFilesystemReadOptions, type WorkspaceFilesystemRmdirOptions, type WorkspaceFilesystemSearchOptions, type WorkspaceFilesystemToolName, type WorkspaceFilesystemToolPolicy, type WorkspaceFilesystemToolkitOptions, type WorkspaceFilesystemWriteOptions, type GrepMatch as WorkspaceGrepMatch, type WorkspaceIdentity, type WorkspaceInfo, type MkdirResult as WorkspaceMkdirResult, type WorkspacePathContext, type RmdirResult as WorkspaceRmdirResult, type WorkspaceSandbox, type WorkspaceSandboxExecuteOptions, type WorkspaceSandboxResult, type WorkspaceSandboxStatus, type WorkspaceSandboxToolName, type WorkspaceSandboxToolkitContext, type WorkspaceSandboxToolkitOptions, type WorkspaceScope, WorkspaceSearch, type WorkspaceSearchConfig, type WorkspaceSearchHybridWeights, type WorkspaceSearchIndexPath, type WorkspaceSearchIndexSummary, type WorkspaceSearchMode, type WorkspaceSearchOptions, type WorkspaceSearchResult, type WorkspaceSearchToolName, type WorkspaceSearchToolkitContext, type WorkspaceSearchToolkitOptions, type WorkspaceSkill, type WorkspaceSkillIndexSummary, type WorkspaceSkillMetadata, type WorkspaceSkillSearchHybridWeights, type WorkspaceSkillSearchMode, type WorkspaceSkillSearchOptions, type WorkspaceSkillSearchResult, WorkspaceSkills, type WorkspaceSkillsConfig, type WorkspaceSkillsPromptHookContext, type WorkspaceSkillsPromptOptions, type WorkspaceSkillsRootResolver, type WorkspaceSkillsRootResolverContext, type WorkspaceSkillsToolName, type WorkspaceSkillsToolkitContext, type WorkspaceSkillsToolkitOptions, type WorkspaceStatus, type WorkspaceToolConfig, type WorkspaceToolPolicies, type WorkspaceToolPolicy, type WorkspaceToolPolicyGroup, type WorkspaceToolkitOptions, type WriteResult as WorkspaceWriteResult, type WriteResult, addTimestampToMessage, andAgent, andAll, andBranch, andDoUntil, andDoWhile, andForEach, andGuardrail, andMap, andRace, andSleep, andSleepUntil, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSamplingMetadata, buildScorer, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createDefaultInputSafetyGuardrails, createDefaultPIIGuardrails, createDefaultSafetyGuardrails, createEmailRedactorGuardrail, createEmbeddingToolSearchStrategy, createFilesystemToolkit, createHTMLSanitizerInputGuardrail, createHooks, createInputGuardrail, createInputLengthGuardrail, createInputMiddleware, createMaxLengthGuardrail, createNodeId, createOutputGuardrail, createOutputMiddleware, createPIIInputGuardrail, createPhoneNumberGuardrail, createPlanningToolkit, createProfanityGuardrail, createProfanityInputGuardrail, createPrompt, createPromptInjectionGuardrail, createReasoningTools, createRetrieverTool, createScorer, createSensitiveNumberGuardrail, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolResultEvictor, createToolkit, createTriggers, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, createWorkspaceFilesystemToolkit, createWorkspaceSandboxToolkit, createWorkspaceSearchToolkit, createWorkspaceSkillsPromptHook, createWorkspaceSkillsToolkit, VoltAgent as default, defineVoltOpsTrigger, detectLocalSandboxIsolation, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getGlobalVoltOpsClient, getNodeTypeFromNodeId, getVoltOpsTriggerDefinition, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isMiddlewareAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeCommandAndArgs, normalizeContent, normalizeScorerResult, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, runLocalScorers, safeJsonParse, serializeValueForDebug, setWaitUntil, shouldSample, tool, transformTextContent, updateAllPackages, updateSinglePackage, weightedBlend, zodSchemaToJsonUI };