@voltagent/core 0.1.11 → 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
 
@@ -648,6 +650,10 @@ type OperationContext = {
648
650
  parentAgentId?: string;
649
651
  /** Parent history entry ID if part of a delegation chain */
650
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>;
651
657
  };
652
658
  /**
653
659
  * Tool execution context passed to tool.execute method
@@ -2086,6 +2092,7 @@ declare class Agent<TProvider extends {
2086
2092
  * Initialize a new history entry
2087
2093
  * @param input User input
2088
2094
  * @param initialStatus Initial status
2095
+ * @param options Options including parent context
2089
2096
  * @returns Created operation context
2090
2097
  */
2091
2098
  private initializeHistory;
@@ -2144,6 +2151,10 @@ declare class Agent<TProvider extends {
2144
2151
  * Agent event creator (update)
2145
2152
  */
2146
2153
  private addAgentEvent;
2154
+ /**
2155
+ * Helper method to enrich and end an OpenTelemetry span associated with a tool call.
2156
+ */
2157
+ private _endOtelToolSpan;
2147
2158
  /**
2148
2159
  * Generate a text response without streaming
2149
2160
  */
@@ -2895,6 +2906,13 @@ type VoltAgentOptions = {
2895
2906
  port?: number;
2896
2907
  autoStart?: boolean;
2897
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[];
2898
2916
  };
2899
2917
  /**
2900
2918
  * Main VoltAgent class for managing agents and server
@@ -2931,6 +2949,8 @@ declare class VoltAgent {
2931
2949
  * Get agent count
2932
2950
  */
2933
2951
  getAgentCount(): number;
2952
+ private initializeGlobalTelemetry;
2953
+ shutdownTelemetry(): Promise<void>;
2934
2954
  }
2935
2955
 
2936
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 };