@voltagent/core 1.1.24 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +51 -19
- package/dist/index.d.ts +51 -19
- package/dist/index.js +35 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -158,7 +158,7 @@ declare class ToolManager {
|
|
|
158
158
|
* @returns The result of the tool execution
|
|
159
159
|
* @throws Error if the tool doesn't exist or fails to execute
|
|
160
160
|
*/
|
|
161
|
-
executeTool(toolName: string, args:
|
|
161
|
+
executeTool(toolName: string, args: unknown, options?: ToolExecuteOptions): Promise<unknown>;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -192,7 +192,7 @@ type ToolOptions<T extends ToolSchema = ToolSchema, O extends ToolSchema | undef
|
|
|
192
192
|
/**
|
|
193
193
|
* Function to execute when the tool is called
|
|
194
194
|
*/
|
|
195
|
-
execute
|
|
195
|
+
execute?: (args: z.infer<T>, context?: OperationContext) => Promise<O extends ToolSchema ? z.infer<O> : unknown>;
|
|
196
196
|
};
|
|
197
197
|
/**
|
|
198
198
|
* Tool class for defining tools that agents can use
|
|
@@ -221,7 +221,12 @@ declare class Tool<T extends ToolSchema = ToolSchema, O extends ToolSchema | und
|
|
|
221
221
|
/**
|
|
222
222
|
* Function to execute when the tool is called
|
|
223
223
|
*/
|
|
224
|
-
readonly execute
|
|
224
|
+
readonly execute?: (args: z.infer<T>, context?: OperationContext) => Promise<O extends ToolSchema ? z.infer<O> : unknown>;
|
|
225
|
+
/**
|
|
226
|
+
* Whether this tool should be executed on the client side.
|
|
227
|
+
* Returns true when no server-side execute handler is provided.
|
|
228
|
+
*/
|
|
229
|
+
readonly isClientSide: () => boolean;
|
|
225
230
|
/**
|
|
226
231
|
* Create a new tool
|
|
227
232
|
*/
|
|
@@ -3447,6 +3452,20 @@ type ModelToolCall = {
|
|
|
3447
3452
|
toolName: string;
|
|
3448
3453
|
args: Record<string, unknown>;
|
|
3449
3454
|
};
|
|
3455
|
+
/**
|
|
3456
|
+
* Represents the payload used when sending a tool's result back to the chat runtime
|
|
3457
|
+
* via useChat().addToolResult in the Vercel AI SDK.
|
|
3458
|
+
*/
|
|
3459
|
+
type ClientSideToolResult = {
|
|
3460
|
+
tool: string;
|
|
3461
|
+
toolCallId: string;
|
|
3462
|
+
output: unknown;
|
|
3463
|
+
} | {
|
|
3464
|
+
tool: string;
|
|
3465
|
+
toolCallId: string;
|
|
3466
|
+
state: "output-error";
|
|
3467
|
+
errorText: string;
|
|
3468
|
+
};
|
|
3450
3469
|
/**
|
|
3451
3470
|
* Agent response format
|
|
3452
3471
|
*/
|
|
@@ -3500,6 +3519,10 @@ type OperationContext = {
|
|
|
3500
3519
|
startTime: Date;
|
|
3501
3520
|
/** Cancellation error to be thrown when operation is aborted */
|
|
3502
3521
|
cancellationError?: CancellationError;
|
|
3522
|
+
/** Input provided to the agent operation (string, UIMessages, or BaseMessages) */
|
|
3523
|
+
input?: string | UIMessage[] | BaseMessage[];
|
|
3524
|
+
/** Output generated by the agent operation (text or object) */
|
|
3525
|
+
output?: string | object;
|
|
3503
3526
|
};
|
|
3504
3527
|
/**
|
|
3505
3528
|
* Specific information related to a tool execution error.
|
|
@@ -3865,7 +3888,7 @@ declare class Agent {
|
|
|
3865
3888
|
readonly purpose?: string;
|
|
3866
3889
|
readonly instructions: InstructionsDynamicValue;
|
|
3867
3890
|
readonly model: LanguageModel | DynamicValue<LanguageModel>;
|
|
3868
|
-
readonly
|
|
3891
|
+
readonly dynamicTools?: DynamicValue<(Tool<any, any> | Toolkit)[]>;
|
|
3869
3892
|
readonly hooks: AgentHooks;
|
|
3870
3893
|
readonly temperature?: number;
|
|
3871
3894
|
readonly maxOutputTokens?: number;
|
|
@@ -4606,6 +4629,15 @@ interface WorkflowStreamWriter {
|
|
|
4606
4629
|
filter?: (part: DangerouslyAllowAny) => boolean;
|
|
4607
4630
|
}): Promise<void>;
|
|
4608
4631
|
}
|
|
4632
|
+
/**
|
|
4633
|
+
* The state parameter passed to workflow steps
|
|
4634
|
+
*/
|
|
4635
|
+
type WorkflowStepState<INPUT> = Omit<WorkflowState<INPUT, DangerouslyAllowAny>, "data" | "result"> & {
|
|
4636
|
+
/** Workflow execution context for event tracking */
|
|
4637
|
+
workflowContext?: WorkflowExecutionContext;
|
|
4638
|
+
/** AbortSignal for checking suspension during step execution */
|
|
4639
|
+
signal?: AbortSignal;
|
|
4640
|
+
};
|
|
4609
4641
|
|
|
4610
4642
|
/**
|
|
4611
4643
|
* WorkflowTraceContext - Manages trace hierarchy and common attributes for workflows
|
|
@@ -4934,8 +4966,8 @@ type ExtractExecuteResult<T> = T extends {
|
|
|
4934
4966
|
execute: (...args: any[]) => infer R;
|
|
4935
4967
|
} ? R extends Promise<infer U> ? U : R : never;
|
|
4936
4968
|
|
|
4937
|
-
type AgentConfig$1<SCHEMA extends z.ZodTypeAny> = BaseGenerationOptions & {
|
|
4938
|
-
schema: SCHEMA;
|
|
4969
|
+
type AgentConfig$1<SCHEMA extends z.ZodTypeAny, INPUT, DATA> = BaseGenerationOptions & {
|
|
4970
|
+
schema: SCHEMA | ((context: Omit<WorkflowExecuteContext<INPUT, DATA, any, any>, "suspend" | "writer">) => SCHEMA | Promise<SCHEMA>);
|
|
4939
4971
|
};
|
|
4940
4972
|
/**
|
|
4941
4973
|
* Creates an agent step for a workflow
|
|
@@ -4960,7 +4992,7 @@ type AgentConfig$1<SCHEMA extends z.ZodTypeAny> = BaseGenerationOptions & {
|
|
|
4960
4992
|
* @param config - The config for the agent (schema) `generateObject` call
|
|
4961
4993
|
* @returns A workflow step that executes the agent with the task
|
|
4962
4994
|
*/
|
|
4963
|
-
declare function andAgent<INPUT, DATA, SCHEMA extends z.ZodTypeAny>(task: UIMessage[] | ModelMessage[] | string | InternalWorkflowFunc<INPUT, DATA, UIMessage[] | ModelMessage[] | string, any, any>, agent: Agent, config: AgentConfig$1<SCHEMA>): {
|
|
4995
|
+
declare function andAgent<INPUT, DATA, SCHEMA extends z.ZodTypeAny>(task: UIMessage[] | ModelMessage[] | string | InternalWorkflowFunc<INPUT, DATA, UIMessage[] | ModelMessage[] | string, any, any>, agent: Agent, config: AgentConfig$1<SCHEMA, INPUT, DATA>): {
|
|
4964
4996
|
type: "agent";
|
|
4965
4997
|
id: string;
|
|
4966
4998
|
name: string;
|
|
@@ -5369,8 +5401,8 @@ interface SerializedWorkflowStep {
|
|
|
5369
5401
|
/**
|
|
5370
5402
|
* Agent configuration for the chain
|
|
5371
5403
|
*/
|
|
5372
|
-
type AgentConfig<SCHEMA extends z.ZodTypeAny> = {
|
|
5373
|
-
schema: SCHEMA;
|
|
5404
|
+
type AgentConfig<SCHEMA extends z.ZodTypeAny, INPUT_SCHEMA extends InternalBaseWorkflowInputSchema, CURRENT_DATA> = BaseGenerationOptions & {
|
|
5405
|
+
schema: SCHEMA | ((context: Omit<WorkflowExecuteContext<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, any, any>, "suspend" | "writer">) => SCHEMA | Promise<SCHEMA>);
|
|
5374
5406
|
};
|
|
5375
5407
|
/**
|
|
5376
5408
|
* A workflow chain that provides a fluent API for building workflows
|
|
@@ -5447,7 +5479,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5447
5479
|
* @param config - The config for the agent (schema) `generateObject` call
|
|
5448
5480
|
* @returns A workflow step that executes the agent with the task
|
|
5449
5481
|
*/
|
|
5450
|
-
andAgent<SCHEMA extends z.ZodTypeAny>(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc<INPUT_SCHEMA
|
|
5482
|
+
andAgent<SCHEMA extends z.ZodTypeAny>(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, string | UIMessage[] | ModelMessage[], any, any>, agent: Agent, config: AgentConfig<SCHEMA, INPUT_SCHEMA, CURRENT_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, z.infer<SCHEMA>, SUSPEND_SCHEMA, RESUME_SCHEMA>;
|
|
5451
5483
|
/**
|
|
5452
5484
|
* Add a function step to the workflow with both input and output schemas
|
|
5453
5485
|
* @param config - Step configuration with schemas
|
|
@@ -5460,7 +5492,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5460
5492
|
resumeSchema?: RS;
|
|
5461
5493
|
execute: (context: {
|
|
5462
5494
|
data: z.infer<IS>;
|
|
5463
|
-
state:
|
|
5495
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5464
5496
|
getStepData: (stepId: string) => {
|
|
5465
5497
|
input: any;
|
|
5466
5498
|
output: any;
|
|
@@ -5486,7 +5518,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5486
5518
|
resumeSchema?: RS;
|
|
5487
5519
|
execute: (context: {
|
|
5488
5520
|
data: z.infer<IS>;
|
|
5489
|
-
state:
|
|
5521
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5490
5522
|
getStepData: (stepId: string) => {
|
|
5491
5523
|
input: any;
|
|
5492
5524
|
output: any;
|
|
@@ -5512,7 +5544,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5512
5544
|
resumeSchema?: RS;
|
|
5513
5545
|
execute: (context: {
|
|
5514
5546
|
data: CURRENT_DATA;
|
|
5515
|
-
state:
|
|
5547
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5516
5548
|
getStepData: (stepId: string) => {
|
|
5517
5549
|
input: any;
|
|
5518
5550
|
output: any;
|
|
@@ -5538,7 +5570,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5538
5570
|
resumeSchema: RS;
|
|
5539
5571
|
execute: (context: {
|
|
5540
5572
|
data: CURRENT_DATA;
|
|
5541
|
-
state:
|
|
5573
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5542
5574
|
getStepData: (stepId: string) => {
|
|
5543
5575
|
input: any;
|
|
5544
5576
|
output: any;
|
|
@@ -5580,7 +5612,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5580
5612
|
andThen<NEW_DATA>(config: {
|
|
5581
5613
|
execute: (context: {
|
|
5582
5614
|
data: CURRENT_DATA;
|
|
5583
|
-
state:
|
|
5615
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5584
5616
|
getStepData: (stepId: string) => {
|
|
5585
5617
|
input: any;
|
|
5586
5618
|
output: any;
|
|
@@ -5610,7 +5642,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5610
5642
|
resumeSchema?: RS;
|
|
5611
5643
|
condition: (context: {
|
|
5612
5644
|
data: z.infer<IS>;
|
|
5613
|
-
state:
|
|
5645
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5614
5646
|
getStepData: (stepId: string) => {
|
|
5615
5647
|
input: any;
|
|
5616
5648
|
output: any;
|
|
@@ -5671,7 +5703,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5671
5703
|
resumeSchema?: RS;
|
|
5672
5704
|
execute: (context: {
|
|
5673
5705
|
data: z.infer<IS>;
|
|
5674
|
-
state:
|
|
5706
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5675
5707
|
getStepData: (stepId: string) => {
|
|
5676
5708
|
input: any;
|
|
5677
5709
|
output: any;
|
|
@@ -5712,7 +5744,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5712
5744
|
andTap<_NEW_DATA>(config: {
|
|
5713
5745
|
execute: (context: {
|
|
5714
5746
|
data: CURRENT_DATA;
|
|
5715
|
-
state:
|
|
5747
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5716
5748
|
getStepData: (stepId: string) => {
|
|
5717
5749
|
input: any;
|
|
5718
5750
|
output: any;
|
|
@@ -7633,4 +7665,4 @@ declare class VoltAgent {
|
|
|
7633
7665
|
*/
|
|
7634
7666
|
declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
|
|
7635
7667
|
|
|
7636
|
-
export { A2AServerRegistry, AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type CachedPrompt, type ChatMessage, ClientHTTPError, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetMessagesOptions, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type LLMProvider, LazyRemoteExportProcessor, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, 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 ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, 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, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type SearchOptions, type 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 StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, VoltOpsClient, type VoltOpsClientOptions, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, safeJsonParse, serializeValueForDebug, tool, transformTextContent, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|
|
7668
|
+
export { A2AServerRegistry, AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetMessagesOptions, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type LLMProvider, LazyRemoteExportProcessor, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, 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 ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, 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, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type SearchOptions, type 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 StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, VoltOpsClient, type VoltOpsClientOptions, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, safeJsonParse, serializeValueForDebug, tool, transformTextContent, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|
package/dist/index.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ declare class ToolManager {
|
|
|
158
158
|
* @returns The result of the tool execution
|
|
159
159
|
* @throws Error if the tool doesn't exist or fails to execute
|
|
160
160
|
*/
|
|
161
|
-
executeTool(toolName: string, args:
|
|
161
|
+
executeTool(toolName: string, args: unknown, options?: ToolExecuteOptions): Promise<unknown>;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -192,7 +192,7 @@ type ToolOptions<T extends ToolSchema = ToolSchema, O extends ToolSchema | undef
|
|
|
192
192
|
/**
|
|
193
193
|
* Function to execute when the tool is called
|
|
194
194
|
*/
|
|
195
|
-
execute
|
|
195
|
+
execute?: (args: z.infer<T>, context?: OperationContext) => Promise<O extends ToolSchema ? z.infer<O> : unknown>;
|
|
196
196
|
};
|
|
197
197
|
/**
|
|
198
198
|
* Tool class for defining tools that agents can use
|
|
@@ -221,7 +221,12 @@ declare class Tool<T extends ToolSchema = ToolSchema, O extends ToolSchema | und
|
|
|
221
221
|
/**
|
|
222
222
|
* Function to execute when the tool is called
|
|
223
223
|
*/
|
|
224
|
-
readonly execute
|
|
224
|
+
readonly execute?: (args: z.infer<T>, context?: OperationContext) => Promise<O extends ToolSchema ? z.infer<O> : unknown>;
|
|
225
|
+
/**
|
|
226
|
+
* Whether this tool should be executed on the client side.
|
|
227
|
+
* Returns true when no server-side execute handler is provided.
|
|
228
|
+
*/
|
|
229
|
+
readonly isClientSide: () => boolean;
|
|
225
230
|
/**
|
|
226
231
|
* Create a new tool
|
|
227
232
|
*/
|
|
@@ -3447,6 +3452,20 @@ type ModelToolCall = {
|
|
|
3447
3452
|
toolName: string;
|
|
3448
3453
|
args: Record<string, unknown>;
|
|
3449
3454
|
};
|
|
3455
|
+
/**
|
|
3456
|
+
* Represents the payload used when sending a tool's result back to the chat runtime
|
|
3457
|
+
* via useChat().addToolResult in the Vercel AI SDK.
|
|
3458
|
+
*/
|
|
3459
|
+
type ClientSideToolResult = {
|
|
3460
|
+
tool: string;
|
|
3461
|
+
toolCallId: string;
|
|
3462
|
+
output: unknown;
|
|
3463
|
+
} | {
|
|
3464
|
+
tool: string;
|
|
3465
|
+
toolCallId: string;
|
|
3466
|
+
state: "output-error";
|
|
3467
|
+
errorText: string;
|
|
3468
|
+
};
|
|
3450
3469
|
/**
|
|
3451
3470
|
* Agent response format
|
|
3452
3471
|
*/
|
|
@@ -3500,6 +3519,10 @@ type OperationContext = {
|
|
|
3500
3519
|
startTime: Date;
|
|
3501
3520
|
/** Cancellation error to be thrown when operation is aborted */
|
|
3502
3521
|
cancellationError?: CancellationError;
|
|
3522
|
+
/** Input provided to the agent operation (string, UIMessages, or BaseMessages) */
|
|
3523
|
+
input?: string | UIMessage[] | BaseMessage[];
|
|
3524
|
+
/** Output generated by the agent operation (text or object) */
|
|
3525
|
+
output?: string | object;
|
|
3503
3526
|
};
|
|
3504
3527
|
/**
|
|
3505
3528
|
* Specific information related to a tool execution error.
|
|
@@ -3865,7 +3888,7 @@ declare class Agent {
|
|
|
3865
3888
|
readonly purpose?: string;
|
|
3866
3889
|
readonly instructions: InstructionsDynamicValue;
|
|
3867
3890
|
readonly model: LanguageModel | DynamicValue<LanguageModel>;
|
|
3868
|
-
readonly
|
|
3891
|
+
readonly dynamicTools?: DynamicValue<(Tool<any, any> | Toolkit)[]>;
|
|
3869
3892
|
readonly hooks: AgentHooks;
|
|
3870
3893
|
readonly temperature?: number;
|
|
3871
3894
|
readonly maxOutputTokens?: number;
|
|
@@ -4606,6 +4629,15 @@ interface WorkflowStreamWriter {
|
|
|
4606
4629
|
filter?: (part: DangerouslyAllowAny) => boolean;
|
|
4607
4630
|
}): Promise<void>;
|
|
4608
4631
|
}
|
|
4632
|
+
/**
|
|
4633
|
+
* The state parameter passed to workflow steps
|
|
4634
|
+
*/
|
|
4635
|
+
type WorkflowStepState<INPUT> = Omit<WorkflowState<INPUT, DangerouslyAllowAny>, "data" | "result"> & {
|
|
4636
|
+
/** Workflow execution context for event tracking */
|
|
4637
|
+
workflowContext?: WorkflowExecutionContext;
|
|
4638
|
+
/** AbortSignal for checking suspension during step execution */
|
|
4639
|
+
signal?: AbortSignal;
|
|
4640
|
+
};
|
|
4609
4641
|
|
|
4610
4642
|
/**
|
|
4611
4643
|
* WorkflowTraceContext - Manages trace hierarchy and common attributes for workflows
|
|
@@ -4934,8 +4966,8 @@ type ExtractExecuteResult<T> = T extends {
|
|
|
4934
4966
|
execute: (...args: any[]) => infer R;
|
|
4935
4967
|
} ? R extends Promise<infer U> ? U : R : never;
|
|
4936
4968
|
|
|
4937
|
-
type AgentConfig$1<SCHEMA extends z.ZodTypeAny> = BaseGenerationOptions & {
|
|
4938
|
-
schema: SCHEMA;
|
|
4969
|
+
type AgentConfig$1<SCHEMA extends z.ZodTypeAny, INPUT, DATA> = BaseGenerationOptions & {
|
|
4970
|
+
schema: SCHEMA | ((context: Omit<WorkflowExecuteContext<INPUT, DATA, any, any>, "suspend" | "writer">) => SCHEMA | Promise<SCHEMA>);
|
|
4939
4971
|
};
|
|
4940
4972
|
/**
|
|
4941
4973
|
* Creates an agent step for a workflow
|
|
@@ -4960,7 +4992,7 @@ type AgentConfig$1<SCHEMA extends z.ZodTypeAny> = BaseGenerationOptions & {
|
|
|
4960
4992
|
* @param config - The config for the agent (schema) `generateObject` call
|
|
4961
4993
|
* @returns A workflow step that executes the agent with the task
|
|
4962
4994
|
*/
|
|
4963
|
-
declare function andAgent<INPUT, DATA, SCHEMA extends z.ZodTypeAny>(task: UIMessage[] | ModelMessage[] | string | InternalWorkflowFunc<INPUT, DATA, UIMessage[] | ModelMessage[] | string, any, any>, agent: Agent, config: AgentConfig$1<SCHEMA>): {
|
|
4995
|
+
declare function andAgent<INPUT, DATA, SCHEMA extends z.ZodTypeAny>(task: UIMessage[] | ModelMessage[] | string | InternalWorkflowFunc<INPUT, DATA, UIMessage[] | ModelMessage[] | string, any, any>, agent: Agent, config: AgentConfig$1<SCHEMA, INPUT, DATA>): {
|
|
4964
4996
|
type: "agent";
|
|
4965
4997
|
id: string;
|
|
4966
4998
|
name: string;
|
|
@@ -5369,8 +5401,8 @@ interface SerializedWorkflowStep {
|
|
|
5369
5401
|
/**
|
|
5370
5402
|
* Agent configuration for the chain
|
|
5371
5403
|
*/
|
|
5372
|
-
type AgentConfig<SCHEMA extends z.ZodTypeAny> = {
|
|
5373
|
-
schema: SCHEMA;
|
|
5404
|
+
type AgentConfig<SCHEMA extends z.ZodTypeAny, INPUT_SCHEMA extends InternalBaseWorkflowInputSchema, CURRENT_DATA> = BaseGenerationOptions & {
|
|
5405
|
+
schema: SCHEMA | ((context: Omit<WorkflowExecuteContext<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, any, any>, "suspend" | "writer">) => SCHEMA | Promise<SCHEMA>);
|
|
5374
5406
|
};
|
|
5375
5407
|
/**
|
|
5376
5408
|
* A workflow chain that provides a fluent API for building workflows
|
|
@@ -5447,7 +5479,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5447
5479
|
* @param config - The config for the agent (schema) `generateObject` call
|
|
5448
5480
|
* @returns A workflow step that executes the agent with the task
|
|
5449
5481
|
*/
|
|
5450
|
-
andAgent<SCHEMA extends z.ZodTypeAny>(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc<INPUT_SCHEMA
|
|
5482
|
+
andAgent<SCHEMA extends z.ZodTypeAny>(task: string | UIMessage[] | ModelMessage[] | InternalWorkflowFunc<WorkflowInput<INPUT_SCHEMA>, CURRENT_DATA, string | UIMessage[] | ModelMessage[], any, any>, agent: Agent, config: AgentConfig<SCHEMA, INPUT_SCHEMA, CURRENT_DATA>): WorkflowChain<INPUT_SCHEMA, RESULT_SCHEMA, z.infer<SCHEMA>, SUSPEND_SCHEMA, RESUME_SCHEMA>;
|
|
5451
5483
|
/**
|
|
5452
5484
|
* Add a function step to the workflow with both input and output schemas
|
|
5453
5485
|
* @param config - Step configuration with schemas
|
|
@@ -5460,7 +5492,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5460
5492
|
resumeSchema?: RS;
|
|
5461
5493
|
execute: (context: {
|
|
5462
5494
|
data: z.infer<IS>;
|
|
5463
|
-
state:
|
|
5495
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5464
5496
|
getStepData: (stepId: string) => {
|
|
5465
5497
|
input: any;
|
|
5466
5498
|
output: any;
|
|
@@ -5486,7 +5518,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5486
5518
|
resumeSchema?: RS;
|
|
5487
5519
|
execute: (context: {
|
|
5488
5520
|
data: z.infer<IS>;
|
|
5489
|
-
state:
|
|
5521
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5490
5522
|
getStepData: (stepId: string) => {
|
|
5491
5523
|
input: any;
|
|
5492
5524
|
output: any;
|
|
@@ -5512,7 +5544,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5512
5544
|
resumeSchema?: RS;
|
|
5513
5545
|
execute: (context: {
|
|
5514
5546
|
data: CURRENT_DATA;
|
|
5515
|
-
state:
|
|
5547
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5516
5548
|
getStepData: (stepId: string) => {
|
|
5517
5549
|
input: any;
|
|
5518
5550
|
output: any;
|
|
@@ -5538,7 +5570,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5538
5570
|
resumeSchema: RS;
|
|
5539
5571
|
execute: (context: {
|
|
5540
5572
|
data: CURRENT_DATA;
|
|
5541
|
-
state:
|
|
5573
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5542
5574
|
getStepData: (stepId: string) => {
|
|
5543
5575
|
input: any;
|
|
5544
5576
|
output: any;
|
|
@@ -5580,7 +5612,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5580
5612
|
andThen<NEW_DATA>(config: {
|
|
5581
5613
|
execute: (context: {
|
|
5582
5614
|
data: CURRENT_DATA;
|
|
5583
|
-
state:
|
|
5615
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5584
5616
|
getStepData: (stepId: string) => {
|
|
5585
5617
|
input: any;
|
|
5586
5618
|
output: any;
|
|
@@ -5610,7 +5642,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5610
5642
|
resumeSchema?: RS;
|
|
5611
5643
|
condition: (context: {
|
|
5612
5644
|
data: z.infer<IS>;
|
|
5613
|
-
state:
|
|
5645
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5614
5646
|
getStepData: (stepId: string) => {
|
|
5615
5647
|
input: any;
|
|
5616
5648
|
output: any;
|
|
@@ -5671,7 +5703,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5671
5703
|
resumeSchema?: RS;
|
|
5672
5704
|
execute: (context: {
|
|
5673
5705
|
data: z.infer<IS>;
|
|
5674
|
-
state:
|
|
5706
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5675
5707
|
getStepData: (stepId: string) => {
|
|
5676
5708
|
input: any;
|
|
5677
5709
|
output: any;
|
|
@@ -5712,7 +5744,7 @@ declare class WorkflowChain<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema
|
|
|
5712
5744
|
andTap<_NEW_DATA>(config: {
|
|
5713
5745
|
execute: (context: {
|
|
5714
5746
|
data: CURRENT_DATA;
|
|
5715
|
-
state:
|
|
5747
|
+
state: WorkflowStepState<WorkflowInput<INPUT_SCHEMA>>;
|
|
5716
5748
|
getStepData: (stepId: string) => {
|
|
5717
5749
|
input: any;
|
|
5718
5750
|
output: any;
|
|
@@ -7633,4 +7665,4 @@ declare class VoltAgent {
|
|
|
7633
7665
|
*/
|
|
7634
7666
|
declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
|
|
7635
7667
|
|
|
7636
|
-
export { A2AServerRegistry, AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type CachedPrompt, type ChatMessage, ClientHTTPError, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetMessagesOptions, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type LLMProvider, LazyRemoteExportProcessor, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, 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 ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, 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, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type SearchOptions, type 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 StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, VoltOpsClient, type VoltOpsClientOptions, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, safeJsonParse, serializeValueForDebug, tool, transformTextContent, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|
|
7668
|
+
export { A2AServerRegistry, AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, type AgentHookOnPrepareModelMessages, type AgentHookOnStart, type AgentHookOnStepFinish, type AgentHookOnToolEnd, type AgentHookOnToolStart, type AgentHooks, type AgentOptions, AgentRegistry, type AgentResponse, type AgentStatus, type AgentTool, AiSdkEmbeddingAdapter, type AllowedVariableValue, type ApiToolInfo, type BaseEventMetadata, type BaseGenerationOptions, type BaseLLMOptions, type BaseMessage, BaseRetriever, type BaseTool, type BaseToolCall, type CachedPrompt, type ChatMessage, ClientHTTPError, type ClientSideToolResult, type CloudflareFetchHandler, type Conversation, ConversationAlreadyExistsError, ConversationNotFoundError, type ConversationQueryOptions, type ConversationQueryOptions as ConversationQueryOptionsV2, type Conversation as ConversationV2, type CreateConversationInput, type CreateConversationInput as CreateConversationInputV2, type CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, type DataContent, type Document, type DynamicValue, type DynamicValueOptions, type EmbeddingAdapter$1 as EmbeddingAdapter, EmbeddingAdapterNotConfiguredError, EmbeddingError, type ExtractVariableNames, FEW_SHOT_EXAMPLES, type GenerateObjectOptions, type GenerateObjectSubAgentConfig, type GenerateTextOptions, type GenerateTextSubAgentConfig, type GetMessagesOptions, type IServerProvider, type IServerlessProvider, type VoltOpsClient$1 as IVoltOpsClient, InMemoryStorageAdapter$1 as InMemoryObservabilityAdapter, InMemoryStorageAdapter, InMemoryVectorAdapter, type InferGenerateObjectResponse, type InferGenerateTextResponse, type InferMessage, type InferModel, type InferProviderParams, type InferStreamResponse, type InferTool, type LLMProvider, LazyRemoteExportProcessor, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, 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 ManagedMemoryGetMessagesInput, type ManagedMemoryMessagesClient, 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, type ModelToolCall, NextAction, NodeType, VoltAgentObservability$1 as NodeVoltAgentObservability, type ObservabilityConfig, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, type OnPrepareModelMessagesHookArgs, type OnPrepareModelMessagesHookResult, type OnStartHookArgs, type OnStepFinishHookArgs, type OnToolEndHookArgs, type OnToolStartHookArgs, type OperationContext, type PackageUpdateInfo, type PromptApiClient, type PromptApiResponse, type PromptContent, type PromptCreator, type PromptHelper, type PromptReference, type PromptTemplate, type ProviderObjectResponse, type ProviderObjectStreamResponse, type ProviderParams, type ProviderResponse, type ProviderTextResponse, type ProviderTextStreamResponse, type ReadableStreamType, type ReasoningStep, ReasoningStepSchema, type RegisterOptions, type RegisteredWorkflow, type RemoteLogExportConfig, RemoteLogProcessor, type RetrieveOptions, type Retriever, type RetrieverOptions, type SearchOptions, type 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 StreamObjectSubAgentConfig, type StreamPart, type StreamTextFinishResult, type StreamTextOnFinishCallback, type StreamTextOptions, type StreamTextSubAgentConfig, type SubAgentConfig, type SubAgentMethod, type SubAgentStateData, type SupervisorConfig, type TemplateVariables, type TimelineEventCoreLevel, type TimelineEventCoreStatus, type TimelineEventCoreType, Tool, type ToolCall, ToolDeniedError, type ToolErrorInfo, type ToolExecuteOptions, ToolManager, type ToolOptions, type ToolSchema, type ToolStatus, type ToolStatusInfo, type ToolWithNodeId, type Toolkit, type Usage, type UsageInfo, type VectorAdapter, VectorAdapterNotConfiguredError, VectorError, type VectorItem, type VectorSearchOptions, type Voice, type VoiceEventData, type VoiceEventType, type VoiceMetadata, type VoiceOptions, VoltAgent, VoltAgentError, VoltAgentObservability, type VoltAgentOptions, type VoltAgentStreamTextResult, type VoltAgentTextStreamPart, VoltOpsClient, type VoltOpsClientOptions, VoltOpsPromptApiClient, type VoltOpsPromptManager, VoltOpsPromptManagerImpl, WebSocketEventEmitter, WebSocketLogProcessor, WebSocketSpanProcessor, type Workflow, type WorkflowConfig, type WorkflowExecutionContext, WorkflowRegistry, type WorkflowStateEntry, type WorkflowStats, type WorkflowStepContext, type WorkflowStepType, type WorkflowTimelineEvent, type WorkingMemoryConfig, type WorkingMemoryScope, type WorkingMemorySummary, type WorkingMemoryUpdateOptions, addTimestampToMessage, andAgent, andAll, andRace, andTap, andThen, andWhen, andWorkflow, appendToMessage, buildRetrieverLogMessage, buildSpanTree, checkForUpdates, convertUsage, cosineSimilarity, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createSimpleTemplateEngine, createSubagent, createSuspendController, createTool, createToolkit, createVoltAgentObservability, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getEnvVar, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isNodeRuntime, isServerlessRuntime, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeToArray, prependToMessage, readableLogRecordToObservabilityLog, readableSpanToObservabilitySpan, safeJsonParse, serializeValueForDebug, tool, transformTextContent, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|
package/dist/index.js
CHANGED
|
@@ -329,8 +329,9 @@ function andAgent(task, agent, config) {
|
|
|
329
329
|
const { state } = context8;
|
|
330
330
|
const { schema, ...restConfig } = config;
|
|
331
331
|
const finalTask = typeof task === "function" ? await task(context8) : task;
|
|
332
|
+
const finalSchema = typeof schema === "function" ? await schema(context8) : schema;
|
|
332
333
|
if (!state.workflowContext) {
|
|
333
|
-
const result = await agent.generateObject(finalTask,
|
|
334
|
+
const result = await agent.generateObject(finalTask, finalSchema, {
|
|
334
335
|
...restConfig,
|
|
335
336
|
context: restConfig.context ?? state.context,
|
|
336
337
|
conversationId: restConfig.conversationId ?? state.conversationId,
|
|
@@ -352,7 +353,7 @@ function andAgent(task, agent, config) {
|
|
|
352
353
|
return result.object;
|
|
353
354
|
}
|
|
354
355
|
try {
|
|
355
|
-
const result = await agent.generateObject(finalTask,
|
|
356
|
+
const result = await agent.generateObject(finalTask, finalSchema, {
|
|
356
357
|
...restConfig,
|
|
357
358
|
context: restConfig.context ?? state.context,
|
|
358
359
|
conversationId: restConfig.conversationId ?? state.conversationId,
|
|
@@ -400,6 +401,7 @@ function convertWorkflowStateToParam(state, executionContext, signal) {
|
|
|
400
401
|
error: state.error,
|
|
401
402
|
usage: state.usage,
|
|
402
403
|
suspension: state.suspension,
|
|
404
|
+
cancellation: state.cancellation,
|
|
403
405
|
workflowContext: executionContext,
|
|
404
406
|
signal
|
|
405
407
|
};
|
|
@@ -8012,9 +8014,6 @@ var ToolManager = class _ToolManager {
|
|
|
8012
8014
|
if (!tool2 || !tool2.name) {
|
|
8013
8015
|
throw new Error("Cannot add an invalid or unnamed tool.");
|
|
8014
8016
|
}
|
|
8015
|
-
if (!tool2.execute || typeof tool2.execute !== "function") {
|
|
8016
|
-
throw new Error(`Tool ${tool2.name} must have an execute function`);
|
|
8017
|
-
}
|
|
8018
8017
|
const conflictsWithToolkitTool = this.toolkits.some(
|
|
8019
8018
|
(toolkit) => toolkit.tools.some((t) => t.name === tool2.name)
|
|
8020
8019
|
);
|
|
@@ -8097,13 +8096,7 @@ var ToolManager = class _ToolManager {
|
|
|
8097
8096
|
);
|
|
8098
8097
|
}
|
|
8099
8098
|
} else {
|
|
8100
|
-
|
|
8101
|
-
this.addTool(item);
|
|
8102
|
-
} else {
|
|
8103
|
-
this.logger.warn(
|
|
8104
|
-
`[ToolManager] Skipping tool '${item.name}' due to missing or invalid 'execute' function.`
|
|
8105
|
-
);
|
|
8106
|
-
}
|
|
8099
|
+
this.addTool(item);
|
|
8107
8100
|
}
|
|
8108
8101
|
}
|
|
8109
8102
|
}
|
|
@@ -8328,6 +8321,13 @@ var Tool = class {
|
|
|
8328
8321
|
* Function to execute when the tool is called
|
|
8329
8322
|
*/
|
|
8330
8323
|
execute;
|
|
8324
|
+
/**
|
|
8325
|
+
* Whether this tool should be executed on the client side.
|
|
8326
|
+
* Returns true when no server-side execute handler is provided.
|
|
8327
|
+
*/
|
|
8328
|
+
isClientSide = /* @__PURE__ */ __name(() => {
|
|
8329
|
+
return typeof this.execute !== "function";
|
|
8330
|
+
}, "isClientSide");
|
|
8331
8331
|
/**
|
|
8332
8332
|
* Create a new tool
|
|
8333
8333
|
*/
|
|
@@ -8342,9 +8342,6 @@ var Tool = class {
|
|
|
8342
8342
|
if (!options.parameters) {
|
|
8343
8343
|
throw new Error(`Tool '${options.name}' parameters schema is required`);
|
|
8344
8344
|
}
|
|
8345
|
-
if (!options.execute) {
|
|
8346
|
-
throw new Error(`Tool '${options.name}' execute function is required`);
|
|
8347
|
-
}
|
|
8348
8345
|
this.id = options.id || (0, import_uuid2.v4)();
|
|
8349
8346
|
this.name = options.name;
|
|
8350
8347
|
this.description = options.description || "";
|
|
@@ -11213,7 +11210,7 @@ var Agent = class {
|
|
|
11213
11210
|
purpose;
|
|
11214
11211
|
instructions;
|
|
11215
11212
|
model;
|
|
11216
|
-
|
|
11213
|
+
dynamicTools;
|
|
11217
11214
|
hooks;
|
|
11218
11215
|
temperature;
|
|
11219
11216
|
maxOutputTokens;
|
|
@@ -11238,7 +11235,7 @@ var Agent = class {
|
|
|
11238
11235
|
this.purpose = options.purpose;
|
|
11239
11236
|
this.instructions = options.instructions;
|
|
11240
11237
|
this.model = options.model;
|
|
11241
|
-
this.
|
|
11238
|
+
this.dynamicTools = typeof options.tools === "function" ? options.tools : void 0;
|
|
11242
11239
|
this.hooks = options.hooks || {};
|
|
11243
11240
|
this.temperature = options.temperature;
|
|
11244
11241
|
this.maxOutputTokens = options.maxOutputTokens;
|
|
@@ -11268,7 +11265,7 @@ var Agent = class {
|
|
|
11268
11265
|
});
|
|
11269
11266
|
this.memory = options.memory;
|
|
11270
11267
|
this.memoryManager = new MemoryManager(this.id, this.memory, {}, this.logger);
|
|
11271
|
-
const staticTools = typeof
|
|
11268
|
+
const staticTools = typeof options.tools === "function" ? [] : options.tools;
|
|
11272
11269
|
this.toolManager = new ToolManager(staticTools, this.logger);
|
|
11273
11270
|
if (options.toolkits) {
|
|
11274
11271
|
this.toolManager.addItems(options.toolkits);
|
|
@@ -11414,6 +11411,7 @@ var Agent = class {
|
|
|
11414
11411
|
this.setTraceContextUsage(oc.traceContext, result.usage);
|
|
11415
11412
|
oc.traceContext.setOutput(result.text);
|
|
11416
11413
|
oc.traceContext.end("completed");
|
|
11414
|
+
oc.output = result.text;
|
|
11417
11415
|
const returnValue = Object.assign(
|
|
11418
11416
|
Object.create(Object.getPrototypeOf(result)),
|
|
11419
11417
|
// Preserve prototype chain
|
|
@@ -11536,6 +11534,7 @@ var Agent = class {
|
|
|
11536
11534
|
this.setTraceContextUsage(oc.traceContext, finalResult.totalUsage);
|
|
11537
11535
|
oc.traceContext.setOutput(finalResult.text);
|
|
11538
11536
|
oc.traceContext.end("completed");
|
|
11537
|
+
oc.output = finalResult.text;
|
|
11539
11538
|
const usage = convertUsage(finalResult.totalUsage);
|
|
11540
11539
|
await this.getMergedHooks(options).onEnd?.({
|
|
11541
11540
|
conversationId: oc.conversationId || "",
|
|
@@ -11748,6 +11747,7 @@ var Agent = class {
|
|
|
11748
11747
|
this.setTraceContextUsage(oc.traceContext, result.usage);
|
|
11749
11748
|
oc.traceContext.setOutput(result.object);
|
|
11750
11749
|
oc.traceContext.end("completed");
|
|
11750
|
+
oc.output = result.object;
|
|
11751
11751
|
await this.getMergedHooks(options).onEnd?.({
|
|
11752
11752
|
conversationId: oc.conversationId || "",
|
|
11753
11753
|
agent: this,
|
|
@@ -11901,6 +11901,7 @@ var Agent = class {
|
|
|
11901
11901
|
this.setTraceContextUsage(oc.traceContext, finalResult.usage);
|
|
11902
11902
|
oc.traceContext.setOutput(finalResult.object);
|
|
11903
11903
|
oc.traceContext.end("completed");
|
|
11904
|
+
oc.output = finalResult.object;
|
|
11904
11905
|
await this.getMergedHooks(options).onEnd?.({
|
|
11905
11906
|
conversationId: oc.conversationId || "",
|
|
11906
11907
|
agent: this,
|
|
@@ -11970,8 +11971,6 @@ var Agent = class {
|
|
|
11970
11971
|
* Common preparation for all execution methods
|
|
11971
11972
|
*/
|
|
11972
11973
|
async prepareExecution(input, oc, options) {
|
|
11973
|
-
const model = await this.resolveValue(this.model, oc);
|
|
11974
|
-
const agentToolList = await this.resolveValue(this.tools, oc);
|
|
11975
11974
|
const buffer = this.getConversationBuffer(oc);
|
|
11976
11975
|
const uiMessages = await this.prepareMessages(input, oc, options, buffer);
|
|
11977
11976
|
const hooks = this.getMergedHooks(options);
|
|
@@ -11988,9 +11987,10 @@ var Agent = class {
|
|
|
11988
11987
|
}
|
|
11989
11988
|
}
|
|
11990
11989
|
const maxSteps = options?.maxSteps ?? this.calculateMaxSteps();
|
|
11991
|
-
const
|
|
11990
|
+
const model = await this.resolveValue(this.model, oc);
|
|
11991
|
+
const dynamicToolList = await this.resolveValue(this.dynamicTools, oc) || [];
|
|
11992
11992
|
const optionToolsArray = options?.tools || [];
|
|
11993
|
-
const mergedTools = [...
|
|
11993
|
+
const mergedTools = [...dynamicToolList, ...optionToolsArray];
|
|
11994
11994
|
const tools = await this.prepareTools(mergedTools, oc, maxSteps, options);
|
|
11995
11995
|
return {
|
|
11996
11996
|
messages,
|
|
@@ -12084,7 +12084,9 @@ var Agent = class {
|
|
|
12084
12084
|
parentAgentId: options?.parentAgentId,
|
|
12085
12085
|
traceContext,
|
|
12086
12086
|
startTime: startTimeDate,
|
|
12087
|
-
elicitation: elicitationHandler
|
|
12087
|
+
elicitation: elicitationHandler,
|
|
12088
|
+
input,
|
|
12089
|
+
output: void 0
|
|
12088
12090
|
};
|
|
12089
12091
|
}
|
|
12090
12092
|
getConversationBuffer(oc) {
|
|
@@ -12720,8 +12722,14 @@ ${toolkit.instructions}`;
|
|
|
12720
12722
|
for (const tool2 of tools) {
|
|
12721
12723
|
aiTools[tool2.name] = {
|
|
12722
12724
|
description: tool2.description,
|
|
12723
|
-
inputSchema: tool2.parameters
|
|
12725
|
+
inputSchema: tool2.parameters
|
|
12724
12726
|
// AI SDK will convert this to JSON Schema internally
|
|
12727
|
+
};
|
|
12728
|
+
if (tool2.isClientSide()) {
|
|
12729
|
+
continue;
|
|
12730
|
+
}
|
|
12731
|
+
aiTools[tool2.name] = {
|
|
12732
|
+
...aiTools[tool2.name],
|
|
12725
12733
|
execute: /* @__PURE__ */ __name(async (args) => {
|
|
12726
12734
|
const toolSpan = oc.traceContext.createChildSpan(`tool.execution:${tool2.name}`, "tool", {
|
|
12727
12735
|
label: tool2.name,
|
|
@@ -12738,6 +12746,9 @@ ${toolkit.instructions}`;
|
|
|
12738
12746
|
return await oc.traceContext.withSpan(toolSpan, async () => {
|
|
12739
12747
|
try {
|
|
12740
12748
|
await hooks.onToolStart?.({ agent: this, tool: tool2, context: oc, args });
|
|
12749
|
+
if (!tool2.execute) {
|
|
12750
|
+
throw new Error(`Tool ${tool2.name} does not have "execute" method`);
|
|
12751
|
+
}
|
|
12741
12752
|
const result = await tool2.execute(args, oc);
|
|
12742
12753
|
const validatedResult = await this.validateToolOutput(result, tool2);
|
|
12743
12754
|
toolSpan.setAttribute("output", (0, import_utils12.safeStringify)(result));
|