@voltagent/core 1.1.19 → 1.1.20

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 CHANGED
@@ -7,15 +7,13 @@ import { z } from 'zod';
7
7
  import { AsyncIterableStream } from '@voltagent/internal/utils';
8
8
  export { AsyncIterableStream, createAsyncIterableStream } from '@voltagent/internal/utils';
9
9
  import { Logger, LogFn, LogBuffer } from '@voltagent/internal';
10
- import * as _opentelemetry_api from '@opentelemetry/api';
11
- import { Tracer, SpanOptions, Span, SpanStatusCode as SpanStatusCode$1, SpanKind as SpanKind$1, Context } from '@opentelemetry/api';
10
+ import { Tracer, SpanOptions, Span, SpanStatusCode as SpanStatusCode$1, context, trace, SpanKind as SpanKind$1, Context } from '@opentelemetry/api';
12
11
  export { Span, SpanOptions, Tracer, context, trace } from '@opentelemetry/api';
13
- import { LogRecordProcessor, LoggerProvider, ReadableLogRecord } from '@opentelemetry/sdk-logs';
12
+ import { LogRecordProcessor, LoggerProvider, ReadableLogRecord, SdkLogRecord } from '@opentelemetry/sdk-logs';
14
13
  import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
15
- import { SpanProcessor, ReadableSpan } from '@opentelemetry/sdk-trace-base';
14
+ import { SpanProcessor, BasicTracerProvider, ReadableSpan, Span as Span$1 } from '@opentelemetry/sdk-trace-base';
16
15
  import { DangerouslyAllowAny, PlainObject } from '@voltagent/internal/types';
17
16
  import * as TF from 'type-fest';
18
- import { EventEmitter } from 'node:events';
19
17
  import { A2AServerLike, A2AServerDeps, A2AServerMetadata, A2AServerFactory } from '@voltagent/internal/a2a';
20
18
  import { MCPServerLike, MCPServerDeps, MCPServerMetadata, MCPServerFactory } from '@voltagent/internal/mcp';
21
19
  import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
@@ -2036,18 +2034,34 @@ interface ObservabilityConfig {
2036
2034
  resourceAttributes?: Record<string, any>;
2037
2035
  spanFilters?: SpanFilterConfig;
2038
2036
  voltOpsSync?: {
2039
- sampling?: {
2040
- strategy?: "always" | "never" | "ratio" | "parent";
2041
- ratio?: number;
2042
- };
2037
+ sampling?: ObservabilitySamplingConfig;
2043
2038
  maxQueueSize?: number;
2044
2039
  maxExportBatchSize?: number;
2045
2040
  scheduledDelayMillis?: number;
2046
2041
  exportTimeoutMillis?: number;
2047
2042
  };
2043
+ serverlessRemote?: ServerlessRemoteExportConfig;
2048
2044
  spanProcessors?: SpanProcessor[];
2049
2045
  logProcessors?: LogRecordProcessor[];
2050
2046
  }
2047
+ interface ObservabilitySamplingConfig {
2048
+ strategy?: "always" | "never" | "ratio" | "parent";
2049
+ ratio?: number;
2050
+ }
2051
+ interface ServerlessRemoteEndpointConfig {
2052
+ url: string;
2053
+ headers?: Record<string, string>;
2054
+ method?: string;
2055
+ }
2056
+ interface ServerlessRemoteExportConfig {
2057
+ traces?: ServerlessRemoteEndpointConfig;
2058
+ logs?: ServerlessRemoteEndpointConfig;
2059
+ sampling?: ObservabilitySamplingConfig;
2060
+ maxQueueSize?: number;
2061
+ maxExportBatchSize?: number;
2062
+ scheduledDelayMillis?: number;
2063
+ exportTimeoutMillis?: number;
2064
+ }
2051
2065
  /**
2052
2066
  * Span filter configuration
2053
2067
  */
@@ -2227,11 +2241,22 @@ interface SpanTreeNode extends ObservabilitySpan {
2227
2241
  depth: number;
2228
2242
  }
2229
2243
  declare function buildSpanTree(spans: ObservabilitySpan[]): SpanTreeNode[];
2244
+ /**
2245
+ * Convert OpenTelemetry ReadableLogRecord to ObservabilityLogRecord
2246
+ */
2247
+ declare function readableLogRecordToObservabilityLog(readableLog: any): ObservabilityLogRecord;
2248
+
2249
+ /**
2250
+ * VoltAgentObservability (Node runtime)
2251
+ *
2252
+ * Wraps OpenTelemetry's NodeTracerProvider and configures VoltAgent-specific
2253
+ * processors/exporters. This retains the existing Node behavior.
2254
+ */
2230
2255
 
2231
2256
  /**
2232
- * VoltAgent Observability wrapper around OpenTelemetry
2257
+ * VoltAgent Observability wrapper around OpenTelemetry for Node
2233
2258
  */
2234
- declare class VoltAgentObservability {
2259
+ declare class VoltAgentObservability$1 {
2235
2260
  private provider;
2236
2261
  private loggerProvider;
2237
2262
  private tracer;
@@ -2249,112 +2274,109 @@ declare class VoltAgentObservability {
2249
2274
  private setupProcessors;
2250
2275
  private applySpanFilter;
2251
2276
  private resolveSpanFilterOptions;
2252
- /**
2253
- * Try to initialize Pino OpenTelemetry bridge if available
2254
- */
2255
2277
  private tryInitializePinoBridge;
2256
- /**
2257
- * Set up log processors
2258
- */
2259
2278
  private setupLogProcessors;
2260
- /**
2261
- * Get the OpenTelemetry tracer
2262
- */
2263
2279
  getTracer(): Tracer;
2264
- /**
2265
- * Get the LoggerProvider for logs integration
2266
- */
2267
2280
  getLoggerProvider(): LoggerProvider;
2268
- /**
2269
- * Get the storage adapter
2270
- */
2271
2281
  getStorage(): ObservabilityStorageAdapter;
2272
- /**
2273
- * Start a new span
2274
- */
2275
2282
  startSpan(name: string, options?: SpanOptions & {
2276
2283
  type?: string;
2277
2284
  attributes?: Record<string, any>;
2278
2285
  }): Span;
2279
- /**
2280
- * Start an active span (sets it as the current span in context)
2281
- */
2282
2286
  startActiveSpan<T>(name: string, options: SpanOptions & {
2283
2287
  type?: string;
2284
2288
  attributes?: Record<string, any>;
2285
2289
  }, fn: (span: Span) => T): T;
2286
- /**
2287
- * Get the current active span
2288
- */
2289
2290
  getActiveSpan(): Span | undefined;
2290
- /**
2291
- * Set attributes on the current span
2292
- */
2293
2291
  setSpanAttributes(attributes: Record<string, any>): void;
2294
- /**
2295
- * Add an event to the current span
2296
- */
2297
2292
  addSpanEvent(name: string, attributes?: Record<string, any>): void;
2298
- /**
2299
- * Set the status of the current span
2300
- */
2301
2293
  setSpanStatus(code: SpanStatusCode$1, message?: string): void;
2302
- /**
2303
- * Record an exception on the current span
2304
- */
2305
2294
  recordException(error: Error): void;
2306
- /**
2307
- * Subscribe to WebSocket events
2308
- */
2309
2295
  subscribeToWebSocketEvents(callback: (event: any) => void): (() => void) | undefined;
2310
- /**
2311
- * Get traces from storage
2312
- */
2313
2296
  getTraceFromStorage(traceId: string): Promise<any>;
2314
- /**
2315
- * Get a span from storage
2316
- */
2317
2297
  getSpan(spanId: string): Promise<any>;
2318
- /**
2319
- * Clean up old spans from storage
2320
- */
2321
2298
  cleanupOldSpans(beforeTimestamp: number): Promise<number>;
2322
- /**
2323
- * Get logs from storage
2324
- */
2325
2299
  getLogsByTraceId(traceId: string): Promise<any[]>;
2326
- /**
2327
- * Get logs from storage by span ID
2328
- */
2329
2300
  getLogsBySpanId(spanId: string): Promise<any[]>;
2330
- /**
2331
- * Shutdown the observability system
2332
- */
2333
2301
  shutdown(): Promise<void>;
2334
- /**
2335
- * Force flush all pending spans and logs
2336
- */
2337
2302
  forceFlush(): Promise<void>;
2338
- /**
2339
- * Get provider for advanced usage
2340
- */
2341
2303
  getProvider(): NodeTracerProvider;
2342
- /**
2343
- * Get OpenTelemetry context API
2344
- */
2345
- getContext(): _opentelemetry_api.ContextAPI;
2346
- /**
2347
- * Get OpenTelemetry trace API
2348
- */
2349
- getTraceAPI(): _opentelemetry_api.TraceAPI;
2350
- /**
2351
- * Get span kinds enum
2352
- */
2304
+ getContext(): typeof context;
2305
+ getTraceAPI(): typeof trace;
2306
+ getSpanKind(): typeof SpanKind$1;
2307
+ getSpanStatusCode(): typeof SpanStatusCode$1;
2308
+ }
2309
+
2310
+ /**
2311
+ * VoltAgentObservability (serverless runtime)
2312
+ *
2313
+ * Simplified observability pipeline for Workers/serverless runtimes. Uses
2314
+ * BasicTracerProvider and fetch-friendly processors only.
2315
+ */
2316
+
2317
+ declare class ServerlessVoltAgentObservability {
2318
+ private provider;
2319
+ private loggerProvider;
2320
+ private tracer;
2321
+ private storage;
2322
+ private websocketProcessor?;
2323
+ private localStorageProcessor?;
2324
+ private config;
2325
+ private resource;
2326
+ private spanFilterOptions?;
2327
+ private instrumentationScopeName;
2328
+ private spanStack;
2329
+ constructor(config?: ObservabilityConfig);
2330
+ private setupProcessors;
2331
+ private applySpanFilter;
2332
+ private resolveSpanFilterOptions;
2333
+ private setupLogProcessors;
2334
+ private initializeTelemetryPipeline;
2335
+ getTracer(): Tracer;
2336
+ getLoggerProvider(): LoggerProvider;
2337
+ getStorage(): ObservabilityStorageAdapter;
2338
+ startSpan(name: string, options?: SpanOptions & {
2339
+ type?: string;
2340
+ attributes?: Record<string, any>;
2341
+ }): Span;
2342
+ startActiveSpan<T>(name: string, options: SpanOptions & {
2343
+ type?: string;
2344
+ attributes?: Record<string, any>;
2345
+ }, fn: (span: Span) => T): T;
2346
+ getActiveSpan(): Span | undefined;
2347
+ setSpanAttributes(attributes: Record<string, any>): void;
2348
+ addSpanEvent(name: string, attributes?: Record<string, any>): void;
2349
+ setSpanStatus(code: SpanStatusCode$1, message?: string): void;
2350
+ recordException(error: Error): void;
2351
+ subscribeToWebSocketEvents(callback: (event: any) => void): (() => void) | undefined;
2352
+ getTraceFromStorage(traceId: string): Promise<any>;
2353
+ getSpan(spanId: string): Promise<any>;
2354
+ cleanupOldSpans(beforeTimestamp: number): Promise<number>;
2355
+ getLogsByTraceId(traceId: string): Promise<any[]>;
2356
+ getLogsBySpanId(spanId: string): Promise<any[]>;
2357
+ shutdown(): Promise<void>;
2358
+ forceFlush(): Promise<void>;
2359
+ getProvider(): BasicTracerProvider;
2360
+ getContext(): typeof context;
2361
+ getTraceAPI(): typeof trace;
2353
2362
  getSpanKind(): typeof SpanKind$1;
2354
- /**
2355
- * Get span status codes enum
2356
- */
2357
2363
  getSpanStatusCode(): typeof SpanStatusCode$1;
2364
+ updateServerlessRemote(config: ServerlessRemoteExportConfig): void;
2365
+ private pushSpan;
2366
+ private popSpan;
2367
+ }
2368
+
2369
+ /**
2370
+ * Minimal event emitter that works in both Node and edge runtimes.
2371
+ */
2372
+ declare class SimpleEventEmitter {
2373
+ private listeners;
2374
+ on(event: string, listener: (...args: any[]) => void): this;
2375
+ off(event: string, listener: (...args: any[]) => void): this;
2376
+ once(event: string, listener: (...args: any[]) => void): this;
2377
+ emit(event: string, ...args: any[]): boolean;
2378
+ listenerCount(event: string): number;
2379
+ removeAllListeners(event?: string): void;
2358
2380
  }
2359
2381
 
2360
2382
  /**
@@ -2367,7 +2389,7 @@ declare class VoltAgentObservability {
2367
2389
  /**
2368
2390
  * Singleton EventEmitter for WebSocket broadcasting
2369
2391
  */
2370
- declare class WebSocketEventEmitter extends EventEmitter {
2392
+ declare class WebSocketEventEmitter extends SimpleEventEmitter {
2371
2393
  private static instance;
2372
2394
  private constructor();
2373
2395
  static getInstance(): WebSocketEventEmitter;
@@ -2443,6 +2465,90 @@ declare class LocalStorageSpanProcessor implements SpanProcessor {
2443
2465
  getStorage(): ObservabilityStorageAdapter;
2444
2466
  }
2445
2467
 
2468
+ /**
2469
+ * Lazy Remote Export Processor for OpenTelemetry
2470
+ *
2471
+ * This processor delays the initialization of remote export until
2472
+ * the VoltOpsClient is available in the global registry, solving
2473
+ * the race condition between Agent and VoltAgent initialization.
2474
+ */
2475
+
2476
+ interface LazyRemoteExportConfig {
2477
+ maxQueueSize?: number;
2478
+ maxExportBatchSize?: number;
2479
+ scheduledDelayMillis?: number;
2480
+ exportTimeoutMillis?: number;
2481
+ logger?: Logger;
2482
+ }
2483
+ declare class LazyRemoteExportProcessor implements SpanProcessor {
2484
+ private config;
2485
+ private actualProcessor?;
2486
+ private pendingSpans;
2487
+ private initialized;
2488
+ private initCheckInterval?;
2489
+ private logger?;
2490
+ constructor(config?: LazyRemoteExportConfig);
2491
+ /**
2492
+ * Called when a span is started
2493
+ */
2494
+ onStart(_span: Span, _parentContext: Context): void;
2495
+ /**
2496
+ * Called when a span ends
2497
+ */
2498
+ onEnd(span: ReadableSpan): void;
2499
+ /**
2500
+ * Force flush all pending spans
2501
+ */
2502
+ forceFlush(): Promise<void>;
2503
+ /**
2504
+ * Shutdown the processor
2505
+ */
2506
+ shutdown(): Promise<void>;
2507
+ /**
2508
+ * Start periodic check for VoltOpsClient availability
2509
+ */
2510
+ private startInitializationCheck;
2511
+ /**
2512
+ * Try to initialize the actual processor
2513
+ */
2514
+ private tryInitialize;
2515
+ }
2516
+
2517
+ /**
2518
+ * SpanFilterProcessor
2519
+ *
2520
+ * Wraps another SpanProcessor and ensures only spans that match the
2521
+ * configured filter are forwarded. This prevents VoltAgent's
2522
+ * observability pipeline from processing spans that originate from
2523
+ * unrelated OpenTelemetry instrumentation.
2524
+ */
2525
+
2526
+ /**
2527
+ * Configuration for SpanFilterProcessor
2528
+ */
2529
+ interface SpanFilterOptions {
2530
+ allowedServiceNames?: string[];
2531
+ allowedInstrumentationScopes?: string[];
2532
+ predicate?: (span: Span$1 | ReadableSpan) => boolean;
2533
+ }
2534
+ /**
2535
+ * SpanProcessor wrapper that filters spans before delegating
2536
+ */
2537
+ declare class SpanFilterProcessor implements SpanProcessor {
2538
+ private readonly delegate;
2539
+ private readonly options;
2540
+ private readonly allowedServiceNames?;
2541
+ private readonly allowedInstrumentationScopes?;
2542
+ constructor(delegate: SpanProcessor, options?: SpanFilterOptions);
2543
+ onStart(span: Span$1, parentContext: Context): void;
2544
+ onEnd(span: ReadableSpan): void;
2545
+ shutdown(): Promise<void>;
2546
+ forceFlush(): Promise<void>;
2547
+ private shouldProcess;
2548
+ private extractInstrumentationScopeName;
2549
+ private extractServiceName;
2550
+ }
2551
+
2446
2552
  /**
2447
2553
  * InMemoryStorageAdapter
2448
2554
  *
@@ -2549,6 +2655,29 @@ declare class InMemoryStorageAdapter$1 implements ObservabilityStorageAdapter {
2549
2655
  };
2550
2656
  }
2551
2657
 
2658
+ /**
2659
+ * Storage Log Processor
2660
+ *
2661
+ * Stores OpenTelemetry log records in the configured storage adapter
2662
+ */
2663
+
2664
+ declare class StorageLogProcessor implements LogRecordProcessor {
2665
+ private storage;
2666
+ constructor(storage: ObservabilityStorageAdapter);
2667
+ /**
2668
+ * Called when a log record is emitted
2669
+ */
2670
+ onEmit(logRecord: ReadableLogRecord, _context?: Context): void;
2671
+ /**
2672
+ * Force flush any pending logs
2673
+ */
2674
+ forceFlush(): Promise<void>;
2675
+ /**
2676
+ * Shutdown the processor
2677
+ */
2678
+ shutdown(): Promise<void>;
2679
+ }
2680
+
2552
2681
  /**
2553
2682
  * WebSocket Log Processor
2554
2683
  *
@@ -2583,6 +2712,72 @@ declare class WebSocketLogProcessor implements LogRecordProcessor {
2583
2712
  shutdown(): Promise<void>;
2584
2713
  }
2585
2714
 
2715
+ /**
2716
+ * Remote Log Processor
2717
+ *
2718
+ * Exports OpenTelemetry log records to remote VoltOps API using OTLP protocol
2719
+ * Similar to LazyRemoteExportProcessor for spans, but for logs
2720
+ */
2721
+
2722
+ interface RemoteLogExportConfig {
2723
+ maxQueueSize?: number;
2724
+ maxExportBatchSize?: number;
2725
+ scheduledDelayMillis?: number;
2726
+ exportTimeoutMillis?: number;
2727
+ samplingConfig?: {
2728
+ strategy?: "always" | "never" | "ratio" | "parent";
2729
+ ratio?: number;
2730
+ };
2731
+ }
2732
+ /**
2733
+ * Lazy Remote Log Processor
2734
+ *
2735
+ * Delays initialization until VoltOpsClient is available,
2736
+ * then exports logs to VoltOps API using OTLP protocol
2737
+ */
2738
+ declare class RemoteLogProcessor implements LogRecordProcessor {
2739
+ private config;
2740
+ private actualProcessor?;
2741
+ private pendingLogs;
2742
+ private initialized;
2743
+ private initCheckInterval?;
2744
+ constructor(config?: RemoteLogExportConfig);
2745
+ /**
2746
+ * Called to emit a log record
2747
+ */
2748
+ onEmit(logRecord: SdkLogRecord): void;
2749
+ /**
2750
+ * Force flush all pending logs
2751
+ */
2752
+ forceFlush(): Promise<void>;
2753
+ /**
2754
+ * Shutdown the processor
2755
+ */
2756
+ shutdown(): Promise<void>;
2757
+ /**
2758
+ * Start periodic check for VoltOpsClient availability
2759
+ */
2760
+ private startInitializationCheck;
2761
+ /**
2762
+ * Try to initialize the actual processor
2763
+ */
2764
+ private tryInitialize;
2765
+ }
2766
+
2767
+ /**
2768
+ * VoltAgent Observability - Built on OpenTelemetry
2769
+ *
2770
+ * This module provides OpenTelemetry-based observability with:
2771
+ * - WebSocket real-time events via custom SpanProcessor
2772
+ * - Local storage via custom SpanProcessor
2773
+ * - OTLP export support
2774
+ * - Zero-configuration defaults
2775
+ */
2776
+
2777
+ declare const VoltAgentObservability: typeof VoltAgentObservability$1;
2778
+ type VoltAgentObservability = VoltAgentObservability$1 | ServerlessVoltAgentObservability;
2779
+ declare const createVoltAgentObservability: (config?: ObservabilityConfig) => VoltAgentObservability$1 | ServerlessVoltAgentObservability;
2780
+
2586
2781
  interface OnStartHookArgs {
2587
2782
  agent: Agent;
2588
2783
  context: OperationContext;
@@ -2690,7 +2885,6 @@ declare class AgentTraceContext {
2690
2885
  private tracer;
2691
2886
  private commonAttributes;
2692
2887
  private activeContext;
2693
- private observability;
2694
2888
  constructor(observability: VoltAgentObservability, operationName: string, options: TraceContextOptions);
2695
2889
  /**
2696
2890
  * Create a child span with automatic parent context and attribute inheritance
@@ -3447,10 +3641,6 @@ declare class Agent {
3447
3641
  * but still work standalone with their own instance
3448
3642
  */
3449
3643
  private getObservability;
3450
- /**
3451
- * Create a default observability instance for standalone agent usage
3452
- */
3453
- private getOrCreateDefaultObservability;
3454
3644
  /**
3455
3645
  * Check if semantic search is supported
3456
3646
  */
@@ -3760,6 +3950,7 @@ interface WorkflowStreamResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCHEMA
3760
3950
  cancellation: Promise<WorkflowCancellationMetadata | undefined>;
3761
3951
  error: Promise<unknown | undefined>;
3762
3952
  usage: Promise<UsageInfo>;
3953
+ toUIMessageStreamResponse: StreamTextResult<any, any>["toUIMessageStreamResponse"];
3763
3954
  /**
3764
3955
  * Resume a suspended workflow execution
3765
3956
  * @param input - Optional new input data for resuming (validated against resumeSchema if provided)
@@ -4052,7 +4243,7 @@ interface WorkflowStreamEvent {
4052
4243
  /**
4053
4244
  * Type of the event (e.g., "step-start", "step-complete", "custom", "agent-stream")
4054
4245
  */
4055
- type: string;
4246
+ type: "workflow-start" | "workflow-suspended" | "workflow-complete" | "workflow-cancelled" | "workflow-error" | "step-start" | "step-complete";
4056
4247
  /**
4057
4248
  * Unique execution ID for this workflow run
4058
4249
  */
@@ -5395,7 +5586,7 @@ interface RegisteredWorkflow {
5395
5586
  declare global {
5396
5587
  var ___voltagent_workflow_registry: WorkflowRegistry | undefined;
5397
5588
  }
5398
- declare class WorkflowRegistry extends EventEmitter {
5589
+ declare class WorkflowRegistry extends SimpleEventEmitter {
5399
5590
  private workflows;
5400
5591
  private logger;
5401
5592
  activeExecutions: Map<string, WorkflowSuspendController>;
@@ -6093,7 +6284,7 @@ type AnyToolConfig = Tool<any>;
6093
6284
  * Wraps the official MCP SDK client to provide a higher-level interface.
6094
6285
  * Internal implementation differs from original source.
6095
6286
  */
6096
- declare class MCPClient extends EventEmitter {
6287
+ declare class MCPClient extends SimpleEventEmitter {
6097
6288
  /**
6098
6289
  * Underlying MCP client instance from the SDK.
6099
6290
  */
@@ -6324,6 +6515,20 @@ interface IServerProvider {
6324
6515
  stop(): Promise<void>;
6325
6516
  isRunning(): boolean;
6326
6517
  }
6518
+ type ServerlessRequestHandler = (req: Request, ...args: unknown[]) => Promise<Response>;
6519
+ type CloudflareFetchHandler = (req: Request, env: Record<string, unknown>, ctx: unknown) => Promise<Response>;
6520
+ interface IServerlessProvider {
6521
+ handleRequest(request: Request): Promise<Response>;
6522
+ toCloudflareWorker(): {
6523
+ fetch: CloudflareFetchHandler;
6524
+ };
6525
+ toVercelEdge(): ServerlessRequestHandler;
6526
+ toDeno(): ServerlessRequestHandler;
6527
+ auto(): {
6528
+ fetch: CloudflareFetchHandler;
6529
+ } | ServerlessRequestHandler;
6530
+ }
6531
+ type ServerlessProviderFactory = (deps: ServerProviderDeps) => IServerlessProvider;
6327
6532
  /**
6328
6533
  * Server provider dependencies
6329
6534
  */
@@ -6356,6 +6561,7 @@ interface ServerProviderDeps {
6356
6561
  a2a?: {
6357
6562
  registry: A2AServerRegistry;
6358
6563
  };
6564
+ ensureEnvironment?: (env?: Record<string, unknown>) => void;
6359
6565
  }
6360
6566
  /**
6361
6567
  * Server provider factory type
@@ -6410,6 +6616,11 @@ type VoltAgentOptions = {
6410
6616
  * Example: honoServer({ port: 3141, enableSwaggerUI: true })
6411
6617
  */
6412
6618
  server?: ServerProviderFactory;
6619
+ /**
6620
+ * Serverless provider factory function for fetch-based runtimes
6621
+ * Example: serverlessHono({ corsOrigin: '*' })
6622
+ */
6623
+ serverless?: ServerlessProviderFactory;
6413
6624
  /**
6414
6625
  * Unified VoltOps client for telemetry and prompt management
6415
6626
  * Replaces the old telemetryExporter approach with a comprehensive solution.
@@ -6570,55 +6781,6 @@ interface ToolCall {
6570
6781
  */
6571
6782
  declare function zodSchemaToJsonUI(schema: any): any;
6572
6783
 
6573
- type UpdateOptions = {
6574
- filter?: string;
6575
- useCache?: boolean;
6576
- forceRefresh?: boolean;
6577
- };
6578
- /**
6579
- * Package update info with semver details
6580
- */
6581
- type PackageUpdateInfo = {
6582
- name: string;
6583
- installed: string;
6584
- latest: string;
6585
- type: "major" | "minor" | "patch" | "latest";
6586
- packageJson: string;
6587
- };
6588
- /**
6589
- * Checks for dependency updates using native package manager commands
6590
- * @returns Object containing update information
6591
- */
6592
- declare const checkForUpdates: (packagePath?: string, options?: UpdateOptions) => Promise<{
6593
- hasUpdates: boolean;
6594
- updates: PackageUpdateInfo[];
6595
- count: number;
6596
- message: string;
6597
- }>;
6598
- /**
6599
- * Update all packages that have available updates using native package manager
6600
- * @param packagePath Optional path to package.json, uses current directory if not provided
6601
- * @returns Result of the update operation
6602
- */
6603
- declare const updateAllPackages: (packagePath?: string) => Promise<{
6604
- success: boolean;
6605
- message: string;
6606
- updatedPackages?: string[];
6607
- requiresRestart?: boolean;
6608
- }>;
6609
- /**
6610
- * Update a single package to its latest version using native package manager
6611
- * @param packageName Name of the package to update
6612
- * @param packagePath Optional path to package.json, uses current directory if not provided
6613
- * @returns Result of the update operation
6614
- */
6615
- declare const updateSinglePackage: (packageName: string, packagePath?: string) => Promise<{
6616
- success: boolean;
6617
- message: string;
6618
- packageName: string;
6619
- requiresRestart?: boolean;
6620
- }>;
6621
-
6622
6784
  /**
6623
6785
  * Safely parse JSON string. If parsing fails, returns the original value.
6624
6786
  * @param value String to parse as JSON
@@ -6770,6 +6932,10 @@ declare const messageHelpers: {
6770
6932
  MessageContentBuilder: typeof MessageContentBuilder;
6771
6933
  };
6772
6934
 
6935
+ declare const isServerlessRuntime: () => boolean;
6936
+ declare const isNodeRuntime: () => boolean;
6937
+ declare const getEnvVar: (key: string) => string | undefined;
6938
+
6773
6939
  /**
6774
6940
  * Creates an AgentTool from a retriever, allowing it to be used as a tool in an agent.
6775
6941
  * This is the preferred way to use a retriever as a tool, as it properly maintains the 'this' context.
@@ -6894,6 +7060,55 @@ declare class AgentRegistry {
6894
7060
  getGlobalObservability(): VoltAgentObservability | undefined;
6895
7061
  }
6896
7062
 
7063
+ type UpdateOptions = {
7064
+ filter?: string;
7065
+ useCache?: boolean;
7066
+ forceRefresh?: boolean;
7067
+ };
7068
+ /**
7069
+ * Package update info with semver details
7070
+ */
7071
+ type PackageUpdateInfo = {
7072
+ name: string;
7073
+ installed: string;
7074
+ latest: string;
7075
+ type: "major" | "minor" | "patch" | "latest";
7076
+ packageJson: string;
7077
+ };
7078
+ /**
7079
+ * Checks for dependency updates using native package manager commands
7080
+ * @returns Object containing update information
7081
+ */
7082
+ declare const checkForUpdates: (packagePath?: string, options?: UpdateOptions) => Promise<{
7083
+ hasUpdates: boolean;
7084
+ updates: PackageUpdateInfo[];
7085
+ count: number;
7086
+ message: string;
7087
+ }>;
7088
+ /**
7089
+ * Update all packages that have available updates using native package manager
7090
+ * @param packagePath Optional path to package.json, uses current directory if not provided
7091
+ * @returns Result of the update operation
7092
+ */
7093
+ declare const updateAllPackages: (packagePath?: string) => Promise<{
7094
+ success: boolean;
7095
+ message: string;
7096
+ updatedPackages?: string[];
7097
+ requiresRestart?: boolean;
7098
+ }>;
7099
+ /**
7100
+ * Update a single package to its latest version using native package manager
7101
+ * @param packageName Name of the package to update
7102
+ * @param packagePath Optional path to package.json, uses current directory if not provided
7103
+ * @returns Result of the update operation
7104
+ */
7105
+ declare const updateSinglePackage: (packageName: string, packagePath?: string) => Promise<{
7106
+ success: boolean;
7107
+ message: string;
7108
+ packageName: string;
7109
+ requiresRestart?: boolean;
7110
+ }>;
7111
+
6897
7112
  /**
6898
7113
  * Prompt manager with caching and Liquid template processing
6899
7114
  */
@@ -7014,13 +7229,19 @@ declare class VoltAgent {
7014
7229
  private registry;
7015
7230
  private workflowRegistry;
7016
7231
  private serverInstance?;
7232
+ private serverlessProvider?;
7017
7233
  private logger;
7018
7234
  private observability?;
7019
7235
  private readonly mcpServers;
7020
7236
  private readonly mcpServerRegistry;
7021
7237
  private readonly a2aServers;
7022
7238
  private readonly a2aServerRegistry;
7239
+ private readonly ensureEnvironmentBinding;
7023
7240
  constructor(options: VoltAgentOptions);
7241
+ serverless(): IServerlessProvider;
7242
+ private ensureEnvironment;
7243
+ private autoConfigureVoltOpsClientFromEnv;
7244
+ private syncServerlessObservabilityRemote;
7024
7245
  /**
7025
7246
  * Setup graceful shutdown handlers
7026
7247
  */
@@ -7113,4 +7334,4 @@ declare class VoltAgent {
7113
7334
  */
7114
7335
  declare function convertUsage(usage: LanguageModelUsage | undefined): UsageInfo | undefined;
7115
7336
 
7116
- export { A2AServerRegistry, AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, 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, 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 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, LocalStorageSpanProcessor, type LogFilter, LoggerProxy, MCPConfiguration, type MCPElicitationAdapter, type MCPLoggingAdapter, type MCPPromptsAdapter, type MCPResourcesAdapter, MCPServerRegistry, Memory, type MemoryConfig, type MemoryOptions, type MemoryUpdateMode, Memory as MemoryV2, MemoryV2Error, type MessageContent, MessageContentBuilder, type MessageRole, type ModelToolCall, NextAction, NodeType, type ObservabilityLogRecord, type ObservabilitySpan, type ObservabilityStorageAdapter, type ObservabilityWebSocketEvent, type OnEndHookArgs, type OnErrorHookArgs, type OnHandoffHookArgs, type OnPrepareMessagesHookArgs, type OnPrepareMessagesHookResult, 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 RetrieveOptions, type Retriever, type RetrieverOptions, type SearchOptions, type SearchResult, type ServerAgentResponse, type ServerApiResponse, type ServerProviderDeps, type ServerProviderFactory, type ServerWorkflowResponse, type SpanAttributes, type SpanEvent, SpanKind, type SpanLink, type SpanStatus, SpanStatusCode, type SpanTreeNode, type StepChunkCallback, type StepFinishCallback, type StepWithContent, type StopWhen, type StorageAdapter, StorageError, 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, 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 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, createVoltOpsClient, createWorkflow, createWorkflowChain, createWorkflowStepNodeId, VoltAgent as default, extractFileParts, extractImageParts, extractText, extractTextParts, extractWorkflowStepInfo, filterContentParts, getContentLength, getGlobalLogBuffer, getGlobalLogger, getNodeTypeFromNodeId, getWorkflowStepNodeType, hasContent, hasFilePart, hasImagePart, hasTextPart, isAbortError, isStructuredContent, isTextContent, isVoltAgentError, mapMessageContent, messageHelpers, normalizeContent, normalizeToArray, prependToMessage, readableSpanToObservabilitySpan, safeJsonParse, serializeValueForDebug, tool, transformTextContent, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
7337
+ export { A2AServerRegistry, AbortError, Agent, type AgentFullState, type AgentHookOnEnd, type AgentHookOnError, type AgentHookOnHandoff, type AgentHookOnPrepareMessages, 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, 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, Memory, type MemoryConfig, type MemoryOptions, 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 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, 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 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 };