Skip to main content

Tracing n8n

n8n is a fair-code workflow automation platform that lets you connect services and build AI-powered workflows visually. MLflow integrates with n8n via the n8n-nodes-mlflow community node — an OpenAI-compatible chat model node with built-in MLflow tracing. Every LLM request and response is automatically logged as a trace, with multi-turn conversations grouped by session in the MLflow UI.

MLflow trace detail

Features

  • OpenAI-compatible — works with OpenAI, LiteLLM, LocalAI, Azure OpenAI, and any OpenAI-compatible endpoint
  • Automatic tracing — every LLM call is logged as an MLflow trace with inputs, outputs, and latency
  • Session grouping — traces are linked by sessionId for multi-turn conversation tracking
  • Custom metadata — attach sessionId, userId, and arbitrary JSON to every trace span
  • Databricks support — compatible with both self-hosted and Databricks-managed MLflow

Setup

1. Installation

  1. Go to Settings → Community Nodes
  2. Click Install
  3. Enter n8n-nodes-mlflow as the npm package name
  4. Agree to the risks of using community nodes and click Install

Option 2: Docker

A preconfigured Docker setup is available in the docker/ directory:

bash
# Build the image
docker build --progress=plain -f docker/Dockerfile -t n8n-nodes-mlflow .

# Run the container
docker run -it --rm \
--name n8n-mlflow \
-p 5678:5678 \
-e GENERIC_TIMEZONE="America/New_York" \
-e TZ="America/New_York" \
-e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
-e N8N_RUNNERS_ENABLED=true \
-v n8n_data:/home/node/.n8n \
n8n-nodes-mlflow:latest

Access n8n at http://localhost:5678.

Option 3: Manual Installation

bash
cd ~/.n8n
npm install n8n-nodes-mlflow
n8n start

2. Credentials

Configure credentials in n8n for both the LLM endpoint and MLflow.

OpenAI Settings

FieldRequiredDescriptionExample
OpenAI API KeyYesAPI key for your OpenAI-compatible endpointsk-abc123...
OpenAI Base URLNoOverride the default endpoint base URLhttps://api.openai.com/v1

MLflow Settings

FieldRequiredDescriptionExample
MLflow Tracking URIYesYour MLflow tracking server URIhttp://localhost:5000 or databricks
MLflow Experiment IDYesExperiment ID where traces will be logged1234567890

:::tip Databricks users Set the Tracking URI to databricks and provide your Databricks personal access token as the MLflow Tracking Token. :::

3. Node Configuration

Add the OpenAI MLflow node to your workflow and configure the MLflow tracing fields:

FieldTypeDescription
sessionIdstringGroups related traces into one chat session (mlflow.trace.session)
userIdstringIdentifies the end user making the request (mlflow.trace.user)
customMetadataobjectArbitrary JSON attached to the trace as span metadata
n8n OpenAI MLflow node configuration

Workflow Setup

A typical n8n workflow using this node:

n8n workflow with MLflow tracing node

Chat Example

Sending a chat message through n8n:

n8n chat interaction example

Viewing Traces in MLflow

After running a workflow, open the MLflow UI and navigate to the Traces tab. Each LLM call appears as a trace with full inputs, outputs, and latency:

MLflow trace overview

Enable "Group by session" to see all turns of a conversation grouped under one session:

MLflow chat session grouped view

Compatibility

  • n8n version 1.0.0 or later
  • Node.js >= 20.15
  • OpenAI official API, LiteLLM, LocalAI, Azure OpenAI, or any OpenAI-compatible endpoint
  • Self-hosted MLflow and Databricks-managed MLflow

Resources

Next steps