Back to Mlflow

Tracing Open WebUI

docs/docs/genai/tracing/integrations/listing/open-webui.mdx

3.15.15.7 KB
Original Source

import ImageBox from "@site/src/components/ImageBox"; import TilesGrid from "@site/src/components/TilesGrid"; import TileCard from "@site/src/components/TileCard"; import { Users, BookOpen, Scale } from "lucide-react";

Tracing Open WebUI

Open WebUI is a self-hosted web interface for running LLMs locally or via remote APIs. MLflow integrates with Open WebUI through its Pipelines system — a lightweight filter mechanism that intercepts every chat request and response. This page shows how to install and configure an MLflow filter pipeline that logs a trace for every conversation turn, grouped by session in the MLflow UI.

How It Works

Open WebUI's Pipelines system supports filter pipelines with two hooks:

  • inlet — runs before each request; captures the user message and session context
  • outlet — runs after each response; logs a complete MLflow trace with user input, assistant response, model name, and token usage

All turns of the same conversation are linked via mlflow.trace.session, so you can select "Group by session" in the MLflow UI to see the full conversation flow.

Step 1: Start the MLflow Server

bash
mlflow server --disable-security-middleware

Step 2: Start Open WebUI

bash
open-webui serve

Step 3: Launch the Pipeline Service via Docker

Build a custom Docker image with MLflow installed:

bash
cat > Dockerfile.mlflow <<'EOF'
FROM ghcr.io/open-webui/pipelines:main
RUN pip install --no-cache-dir mlflow
EOF

docker build -f Dockerfile.mlflow -t pipelines-mlflow .

docker run -p 9099:9099 \
  --add-host=host.docker.internal:host-gateway \
  -v pipelines:/app/pipelines \
  --name pipelines \
  --restart always \
  -e MLFLOW_TRACKING_URI=http://host.docker.internal:5000/ \
  -e DEBUG_MODE=true \
  pipelines-mlflow

Step 4: Connect Open WebUI to the Pipeline Server

In Open WebUI, go to Admin Panel → Settings → Connections and add a new OpenAI API connection:

  • URL: http://localhost:9099/
  • Password: 0p3n-w3bu! (default credential)
<ImageBox src="/images/llms/tracing/open-webui/openwebui_settings.png" alt="Open WebUI connections settings" />

Step 5: Upload the Pipeline

Go to Admin Panel → Settings → Pipelines. Set the Pipelines listener address to http://host.docker.internal:9099, then upload the pipeline file using the file upload button. Then configure the MLflow tracking URI and experiment name in the pipeline's valve settings:

<ImageBox src="/images/llms/tracing/open-webui/pipeline_config.png" alt="Open WebUI pipeline valve configuration" />

You can find the pipeline file at examples/open_webui/mlflow_filter_pipeline.py in the MLflow repository.

Step 6: Chat and Observe Traces

Start a conversation in Open WebUI:

<ImageBox src="/images/llms/tracing/open-webui/chat_session.png" alt="Open WebUI chat session" />

Open the MLflow UI and navigate to the Traces tab. Each conversation turn appears as a separate trace:

<ImageBox src="/images/llms/tracing/open-webui/trace_single_1.png" alt="MLflow single trace view" /> <ImageBox src="/images/llms/tracing/open-webui/trace_single_2.png" alt="MLflow trace detail" />

Enable "Group by session" to see the full conversation grouped under one session:

<ImageBox src="/images/llms/tracing/open-webui/trace_session.png" alt="MLflow session grouped view" />

What Gets Traced

FieldDescription
InputsLast user message per turn
OutputsAssistant response
modelModel name reported by Open WebUI
mlflow.trace.sessionChat ID — groups all turns of a conversation
mlflow.trace.userAuthenticated user's email
Token usageInput/output/total tokens when provided by the backend

Configuration

The pipeline exposes the following valves configurable from the Open WebUI admin UI:

ValveDefaultDescription
mlflow_tracking_urihttp://localhost:5000MLflow tracking server URI
mlflow_experiment_nameopen-webuiExperiment name in MLflow
debugfalseEnable debug logging

Full Example

A complete, runnable example including the pipeline source and setup instructions is available in the MLflow repository:

👉 examples/open_webui/

Next steps

<TilesGrid> <TileCard icon={Users} iconSize={48} title="Track User Feedback" description="Record user feedback on traces for tracking user satisfaction." href="/genai/tracing/collect-user-feedback" linkText="Learn about feedback →" containerHeight={64} /> <TileCard icon={BookOpen} iconSize={48} title="Manage Prompts" description="Learn how to manage prompts with MLflow's prompt registry." href="/genai/prompt-registry" linkText="Manage prompts →" containerHeight={64} /> <TileCard icon={Scale} iconSize={48} title="Evaluate Traces" description="Evaluate traces with LLM judges to understand and improve your AI application's behavior." href="/genai/eval-monitor/running-evaluation/traces" linkText="Evaluate traces →" containerHeight={64} /> </TilesGrid>