Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

On this pageOverview

Observability for VoltAgent with Opik

VoltAgent is an agent framework designed to simplify the creation and management of AI agents with built-in support for tool usage, memory management, and multi-agent coordination. It provides a flexible architecture for building production-ready AI agent systems.

VoltAgent's primary advantage is its modular design that allows developers to easily create, customize, and deploy AI agents with comprehensive tool integration and memory capabilities.

To use the VoltAgent integration with Opik, you will need to have VoltAgent and the required OpenTelemetry packages installed:

Bash
npm install @voltagent/core @opentelemetry/api @opentelemetry/sdk-trace @opentelemetry/exporter-trace-otlp-http

Configure your environment variables based on your Opik deployment:

If you are using Opik Cloud, you will need to set the following environment variables:

wordWrap
export OTEL_EXPORTER_OTLP_ENDPOINT=https://www.comet.com/opik/api/v1/private/otel
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=<your-api-key>,Comet-Workspace=default'

If you are using an Enterprise deployment of Opik, you will need to set the following environment variables:

wordWrap
export OTEL_EXPORTER_OTLP_ENDPOINT=https://<comet-deployment-url>/opik/api/v1/private/otel
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=<your-api-key>,Comet-Workspace=default'

If you are self-hosting Opik, you will need to set the following environment variables:

Bash
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:5173/api/v1/private/otel

Set up OpenTelemetry instrumentation for VoltAgent:

TypeScript
import { trace, SpanStatusCode } from "@opentelemetry/api";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

// Configure the OTLP exporter
const otlpExporter = new OTLPTraceExporter();

// Set up the tracer provider
const provider = new NodeTracerProvider();
provider.addSpanProcessor(new BatchSpanProcessor(otlpExporter));
provider.register();

// Your VoltAgent code will now automatically send traces to Opik
import { Agent } from "@voltagent/core";

const agent = new Agent();
// ... agent configuration

If you have any questions or suggestions for improving the VoltAgent integration, please open an issue on our GitHub repository.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu