Skip to content

Commit 549fc45

Browse files
authored
docs(observability): add MLflow tracing integration (#1114)
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
1 parent 294f6a0 commit 549fc45

3 files changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
id: mlflow
3+
title: MLflow Integration
4+
sidebar_label: MLflow
5+
---
6+
7+
VoltAgent ships with an OpenTelemetry-based observability layer. You can export spans directly to [MLflow](https://mlflow.org) using standard OpenTelemetry packages — no additional wrapper needed. MLflow's OTLP endpoint ingests VoltAgent traces and renders them with rich span-type icons, chat UI, and token usage summaries.
8+
9+
## Prerequisites
10+
11+
- An MLflow server running and accessible. You can [set one up locally](https://mlflow.org/docs/latest/genai/getting-started/connect-environment.html) (via pip, Docker Compose, etc.) or use a managed service like [Databricks](https://www.databricks.com/), [AWS SageMaker](https://aws.amazon.com/sagemaker/ai/experiments/), and more.
12+
- A basic VoltAgent application setup.
13+
14+
## Installation
15+
16+
Install the OpenTelemetry SDK and OTLP protobuf exporter:
17+
18+
```bash npm2yarn
19+
npm install @opentelemetry/sdk-trace-base @opentelemetry/exporter-trace-otlp-proto
20+
```
21+
22+
## Setup
23+
24+
### Configure VoltAgent
25+
26+
In your application (e.g., `src/index.ts`) import the observability class and the OpenTelemetry packages:
27+
28+
```typescript
29+
import { Agent, VoltAgent, VoltAgentObservability } from "@voltagent/core";
30+
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
31+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
32+
```
33+
34+
Create a `VoltAgentObservability` instance and attach the MLflow exporter:
35+
36+
```typescript
37+
const mlflowExporter = new OTLPTraceExporter({
38+
url: `${process.env.MLFLOW_TRACKING_URI}/v1/traces`,
39+
headers: {
40+
"x-mlflow-experiment-id": process.env.MLFLOW_EXPERIMENT_ID ?? "0",
41+
},
42+
});
43+
44+
const observability = new VoltAgentObservability({
45+
spanProcessors: [new BatchSpanProcessor(mlflowExporter)],
46+
});
47+
48+
const agent = new Agent({
49+
name: "my-voltagent-app",
50+
instructions: "A helpful assistant",
51+
model: "openai/gpt-4o-mini",
52+
});
53+
54+
new VoltAgent({
55+
agents: { agent },
56+
observability,
57+
});
58+
```
59+
60+
Add the required environment variables to your `.env` file:
61+
62+
```bash
63+
OPENAI_API_KEY=your-api-key
64+
MLFLOW_TRACKING_URI=http://localhost:5000
65+
MLFLOW_EXPERIMENT_ID=0
66+
```
67+
68+
### Run and View Traces
69+
70+
Start the VoltAgent development server:
71+
72+
```bash
73+
npm run dev
74+
```
75+
76+
Interact with your agent via the [VoltAgent Console](https://console.voltagent.dev), then open the MLflow UI at `http://localhost:5000` to see your traces.
77+
78+
![VoltAgent Trace in MLflow](pathname:///img/mlflow-tracing.png)
79+
80+
## How it Works
81+
82+
- VoltAgent initializes a global OpenTelemetry tracer provider.
83+
- The standard `OTLPTraceExporter` sends spans to MLflow's `/v1/traces` endpoint via OTLP/HTTP (protobuf).
84+
- MLflow automatically translates VoltAgent's semantic conventions for optimal visualization — mapping agent, LLM, tool, and memory spans to dedicated span types, extracting token usage metrics, and rendering chat messages in a rich UI.
85+
- All agent and workflow spans flow through the observability pipeline, giving you end-to-end visibility into your agent's execution.
86+
87+
## Learn More
88+
89+
- [MLflow Tracing](https://mlflow.org/docs/latest/genai/tracing/index.html) — Full tracing guide including evaluation, prompt management, and more.
90+
- [MLflow OpenTelemetry Integration](https://mlflow.org/docs/latest/genai/tracing/opentelemetry.html) — Details on MLflow's OpenTelemetry support.
91+
- [MLflow VoltAgent Guide](https://mlflow.org/docs/latest/genai/tracing/integrations/listing/voltagent.html) — Step-by-step setup tutorial with screenshots.

website/sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ const sidebars: SidebarsConfig = {
311311
"observability/developer-console",
312312
"observability/logging",
313313
"observability/langfuse",
314+
"observability/mlflow",
314315
],
315316
},
316317
{
549 KB
Loading

0 commit comments

Comments
 (0)