> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Langflow

> Automatically trace and monitor your Langflow workflows with Openlayer

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-44/6wy2nbiB-LsAQ_66/images/integrations/langflow_hero.png?fit=max&auto=format&n=6wy2nbiB-LsAQ_66&q=85&s=a03d70346a5b2a12340ccaa62de5c17d" alt="Langflow integration with Openlayer" data-path="images/integrations/langflow_hero.png" />

Langflow is a visual framework for building multi-agent and RAG applications. Openlayer's native integration with Langflow enables automatic tracing and monitoring of your Langflow workflows, providing real-time observability, performance tracking, and quality evaluation.

The integration captures comprehensive trace data including LLM calls, tool executions, agent reasoning steps, retrieval operations, and full execution hierarchies.

## Benefits

The Openlayer integration for Langflow provides:

* **Automatic tracing** - No code changes required; traces are captured automatically when you run your flows
* **Real-time monitoring** - Track performance, latency, and costs across different flows
* **Quality evaluation** - Run tests on production traces to ensure your flows meet quality standards
* **Debugging** - Detailed trace hierarchies help identify issues in complex multi-step workflows
* **Multi-flow support** - Configure different inference pipelines for different flows or environments

## Prerequisites

Before you begin, you need:

1. **Openlayer account** - Sign up at [openlayer.com](https://www.openlayer.com/)
2. **Openlayer project** - Create a project in your Openlayer dashboard
3. **Openlayer API key** - Get your API key from Settings → API Keys
4. **Inference pipeline(s)** - Create one or more inference pipelines in your Openlayer project for LLM monitoring
5. **Openlayer Python SDK** - Install with `pip install openlayer`

## Quick start

### Step 1: Set environment variables

At minimum, you need to set your Openlayer API key and a default inference pipeline ID:

```bash theme={null}
export OPENLAYER_API_KEY="your_api_key_here"
export OPENLAYER_INFERENCE_PIPELINE_ID="your_pipeline_id_here"
```

### Step 2: Run Langflow

```bash theme={null}
langflow run
```

### Step 3: Execute your flow

When you run any flow in Langflow, traces will automatically be sent to Openlayer.

### Step 4: View traces in Openlayer

1. Navigate to your Openlayer project → Inference Pipeline
2. See your traces appear in real-time with detailed execution information

## Configuration

### Environment variables

The integration uses environment variables for configuration:

| Variable                          | Required | Description                           |
| --------------------------------- | -------- | ------------------------------------- |
| `OPENLAYER_API_KEY`               | Yes      | Your Openlayer API key                |
| `OPENLAYER_INFERENCE_PIPELINE_ID` | Yes\*    | Default pipeline ID for all flows     |
| `OPENLAYER_PIPELINE_<FLOW_NAME>`  | No       | Pipeline ID for a specific flow       |
| `OPENLAYER_LANGFLOW_MAPPING`      | No       | JSON mapping of flows to pipeline IDs |

\*Required unless using flow-specific configuration

### Single flow configuration

If you have one flow or want all flows to use the same pipeline:

```bash theme={null}
export OPENLAYER_API_KEY="your_api_key"
export OPENLAYER_INFERENCE_PIPELINE_ID="pipeline_default_123"
```

### Multiple flows with flow-specific variables

For multiple flows with explicit control over each one:

```bash theme={null}
export OPENLAYER_API_KEY="your_api_key"

# For a flow named "Customer Support"
export OPENLAYER_PIPELINE_CUSTOMER_SUPPORT="pipeline_support_456"

# For a flow named "Sales Assistant"
export OPENLAYER_PIPELINE_SALES_ASSISTANT="pipeline_sales_789"

# Fallback for any other flows
export OPENLAYER_INFERENCE_PIPELINE_ID="pipeline_default_123"
```

#### Flow name mapping

Flow names in Langflow are automatically converted to environment variable names:

1. Convert to uppercase
2. Replace spaces and special characters with underscores
3. Add `OPENLAYER_PIPELINE_` prefix

**Examples:**

| Flow Name in Langflow | Environment Variable                   |
| --------------------- | -------------------------------------- |
| `Customer Support`    | `OPENLAYER_PIPELINE_CUSTOMER_SUPPORT`  |
| `My-Production-Bot`   | `OPENLAYER_PIPELINE_MY_PRODUCTION_BOT` |
| `Sales v2.0`          | `OPENLAYER_PIPELINE_SALES_V2_0`        |

### Multiple flows with JSON mapping

For centralized configuration of many flows:

```bash theme={null}
export OPENLAYER_API_KEY="your_api_key"

export OPENLAYER_LANGFLOW_MAPPING='{
  "Customer Support": "pipeline_support_456",
  "Sales Assistant": "pipeline_sales_789",
  "Data Analysis": "pipeline_analytics_012"
}'

# Fallback for unmapped flows
export OPENLAYER_INFERENCE_PIPELINE_ID="pipeline_default_123"
```

<Warning>
  Flow names in the JSON mapping must match exactly (case-sensitive, including
  spaces) with your flow names in Langflow.
</Warning>

### Configuration priority

When a flow runs, the system checks for pipeline IDs in this order:

1. `OPENLAYER_PIPELINE_<FLOW_NAME>` (highest priority)
2. `OPENLAYER_LANGFLOW_MAPPING`
3. `OPENLAYER_INFERENCE_PIPELINE_ID` (fallback)
