@voltagent/core 0.1.10 → 0.1.12

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.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { Span } from '@opentelemetry/api';
3
+ import { SpanExporter } from '@opentelemetry/sdk-trace-base';
2
4
  import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
3
5
  import { EventEmitter } from 'node:events';
4
6
 
@@ -423,6 +425,7 @@ type ProviderOptions = {
423
425
  onFinish?: (result: unknown) => Promise<void>;
424
426
  onError?: (error: unknown) => Promise<void>;
425
427
  toolExecutionContext?: ToolExecutionContext;
428
+ [key: string]: unknown;
426
429
  };
427
430
  /**
428
431
  * Agent configuration options
@@ -647,6 +650,10 @@ type OperationContext = {
647
650
  parentAgentId?: string;
648
651
  /** Parent history entry ID if part of a delegation chain */
649
652
  parentHistoryEntryId?: string;
653
+ /** The root OpenTelemetry span for this operation */
654
+ otelSpan?: Span;
655
+ /** Map to store active OpenTelemetry spans for tool calls within this operation */
656
+ toolSpans?: Map<string, Span>;
650
657
  };
651
658
  /**
652
659
  * Tool execution context passed to tool.execute method
@@ -2085,6 +2092,7 @@ declare class Agent<TProvider extends {
2085
2092
  * Initialize a new history entry
2086
2093
  * @param input User input
2087
2094
  * @param initialStatus Initial status
2095
+ * @param options Options including parent context
2088
2096
  * @returns Created operation context
2089
2097
  */
2090
2098
  private initializeHistory;
@@ -2143,6 +2151,10 @@ declare class Agent<TProvider extends {
2143
2151
  * Agent event creator (update)
2144
2152
  */
2145
2153
  private addAgentEvent;
2154
+ /**
2155
+ * Helper method to enrich and end an OpenTelemetry span associated with a tool call.
2156
+ */
2157
+ private _endOtelToolSpan;
2146
2158
  /**
2147
2159
  * Generate a text response without streaming
2148
2160
  */
@@ -2894,6 +2906,13 @@ type VoltAgentOptions = {
2894
2906
  port?: number;
2895
2907
  autoStart?: boolean;
2896
2908
  checkDependencies?: boolean;
2909
+ /**
2910
+ * Optional OpenTelemetry SpanExporter instance or array of instances.
2911
+ * If provided, VoltAgent will attempt to initialize and register
2912
+ * a NodeTracerProvider with a BatchSpanProcessor for the given exporter(s).
2913
+ * It's recommended to only provide this in one VoltAgent instance per application process.
2914
+ */
2915
+ telemetryExporter?: SpanExporter | SpanExporter[];
2897
2916
  };
2898
2917
  /**
2899
2918
  * Main VoltAgent class for managing agents and server
@@ -2930,6 +2949,8 @@ declare class VoltAgent {
2930
2949
  * Get agent count
2931
2950
  */
2932
2951
  getAgentCount(): number;
2952
+ private initializeGlobalTelemetry;
2953
+ shutdownTelemetry(): Promise<void>;
2933
2954
  }
2934
2955
 
2935
2956
  export { Agent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentTool, AllowedVariableValue, AnyToolConfig, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, DataContent, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryManager, MemoryMessage, MemoryOptions, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, Retriever, RetrieverOptions, RetryConfig, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, Tool, ToolCall, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStatus, ToolStatusInfo, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, checkForUpdates, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, VoltAgent as default, getNodeTypeFromNodeId, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };