Jesse A. Green / notebook

Langflow Administrator and Developer Guide

Generated May 2026 from langflow-ai/langflow at dc26d19

AI-generated documentation. The library is checked by sampling (three repositories so far); this guide was not individually reviewed. Verify against the project before relying on it.

This guide is the source-of-truth operational reference for Langflow — the visual flow-builder for LLM applications maintained by langflow-ai. It is written for the people who keep Langflow running and the people who extend it: self-hosters, platform engineers, SREs, security reviewers, and developers who write Custom Components or contribute to core. The companion User Guide covers everyday product use; this Admin Guide deliberately does NOT repeat tutorials, recipe walkthroughs, the Playground tour, or the editor canvas. It picks up where the User Guide leaves off.

The repository ships two distributions that share most code: langflow (the full server with React UI, multi-user database, auth, MCP, Store, deployment adapters, and a 400+ component catalog) and lfx (a slim runtime + DevOps CLI that runs flow JSON without a database or UI). Both are deployed from the same monorepo and built around the same graph engine. Where settings, behaviours, or operational concerns differ between them, this guide calls it out explicitly.

1. Executive Summary

Langflow is a Python (FastAPI/SQLModel) backend wrapped in a React 19 single-page application. Users compose flows on a canvas, the editor compiles the canvas into a typed DAG of components, and the backend executes the DAG either synchronously, with Server-Sent Events streaming, or in a fan-out polling mode. The server keeps state in SQLite by default (auto-migrated to an async driver) and is production-recommended on PostgreSQL 14+ via the [postgresql] optional extra. Authentication is JWT-based (HS256 by default; RS256/RS512 available) layered with a per-user database-stored API key system, and an opt-in SSO module that supports JWT, OIDC, SAML, and LDAP providers. Background work (Celery), object storage (local or S3), Prometheus + OpenTelemetry, Sentry, and a configurable cache (async, redis, memory, disk) round out the operational surface.


2. Architecture

2.1 High-Level Component Diagram

                         ┌─────────────────────────────────────────────┐
                         │              Reverse Proxy                   │
                         │         (Traefik / nginx / etc.)            │
                         └──────────┬──────────────┬───────────────────┘
                                    │              │
                         ┌──────────▼──────┐ ┌─────▼──────────────────┐
                         │  React 19 SPA   │ │   FastAPI Backend      │
                         │  (XY Flow       │ │   (uvicorn :7860)      │
                         │   canvas,       │ │                        │
                         │   TypeScript)   │ │  /api/v1/*  /api/v2/* │
                         └────────────────┘ │  /health  /health_check│
                                            │  /logs    /logs-stream │
                                            └──────┬─────┬───────────┘
                                                   │     │
                         ┌─────────────────────────▼┐  ┌─▼──────────────┐
                         │  SQLite (default)         │  │  Cache Layer    │
                         │  or PostgreSQL 14+        │  │  async/redis/   │
                         │  (SQLAlchemy + Alembic)   │  │  memory/disk    │
                         └──────────────────────────┘  └────────────────┘
                                                             │
                         ┌───────────────────────────────────▼──────────┐
                         │  Optional Services                           │
                         │  • Celery workers (Redis/RabbitMQ broker)    │
                         │  • S3 object storage                        │
                         │  • Prometheus metrics (:9090)               │
                         │  • Sentry error tracking                    │
                         │  • MCP Composer (uvx-managed)               │
                         └─────────────────────────────────────────────┘

2.2 Backend Stack

Layer Technology Notes
Web framework FastAPI (async) Mounted at /api/v1 and /api/v2
ASGI server uvicorn uvicorn --factory langflow.main:create_app
ORM / migrations SQLAlchemy 2 + SQLModel + Alembic Async drivers: sqlite+aiosqlite, postgresql+psycopg
Graph engine lfx.graph.graph.base.Graph Shared between langflow and lfx
Task queue Celery (optional) Broker: Redis or RabbitMQ; enable via LANGFLOW_CELERY_ENABLED=true
Cache async (default), redis, memory, disk Controlled by LANGFLOW_CACHE_TYPE
Telemetry Prometheus + OpenTelemetry + Sentry Prometheus on port 9090 when enabled
Auth JWT (HS256/RS256/RS512) + database API keys + SSO See Section 6

2.3 Frontend Stack

Layer Technology
Framework React 19 with TypeScript
Canvas XY Flow (React Flow successor)
Build Vite
State React Context + custom hooks

2.4 Service Manager Architecture

Langflow uses a dependency-injection service manager pattern. All backend services are registered as factories with a central ServiceManager singleton. Services are lazily instantiated on first access and torn down cleanly on shutdown.

18 registered service types (from ServiceType enum):

Service Purpose
AUTH_SERVICE JWT issuance, password hashing (bcrypt), superuser management
CACHE_SERVICE Flow execution cache (async/redis/memory/disk)
SHARED_COMPONENT_CACHE_SERVICE Component template cache for security validation
SETTINGS_SERVICE Configuration (env vars → Pydantic models)
DATABASE_SERVICE SQLAlchemy engine, session factory, Alembic migrations
CHAT_SERVICE Graph caching during flow execution
SESSION_SERVICE User session management
TASK_SERVICE Background task coordination
STORE_SERVICE Langflow Store integration (community components)
VARIABLE_SERVICE Global Variables (encrypted in DB or Kubernetes secrets)
STORAGE_SERVICE File storage abstraction (local filesystem or S3)
STATE_SERVICE Component state persistence across executions
TRACING_SERVICE Distributed tracing (LangSmith, LangWatch, Arize Phoenix)
TELEMETRY_SERVICE Anonymous usage telemetry
JOB_QUEUE_SERVICE In-process job queue for flow builds
MCP_COMPOSER_SERVICE MCP tool aggregation (runs via uvx)
JOB_SERVICE Job lifecycle management
FLOW_EVENTS_SERVICE SSE event broadcasting for flow builds

Each service has a corresponding ServiceFactory subclass. The factory's create() method type hints declare dependencies on other services, which the manager resolves automatically via reflection (infer_service_types()).

2.5 Flow Execution Model

  1. Canvas → DAG: The React editor serializes a flow as JSON (nodes + edges). The backend deserializes this into a Graph object.
  2. Topological sort: graph.sort_vertices() produces an execution order respecting data dependencies. Optional start_component_id / stop_component_id prune the DAG.
  3. Parallel build: Independent vertices in the same layer execute concurrently via asyncio.gather().
  4. Event delivery: Three modes controlled by LANGFLOW_EVENT_DELIVERY:
    • streaming (default): SSE via DisconnectHandlerStreamingResponse, NDJSON format
    • polling: Client polls; server returns buffered NDJSON events
    • direct: Required when workers > 1 (multi-process); auto-selected
  5. Webhook forwarding: WebhookEventManager broadcasts build events to SSE-connected UI clients when flows are triggered externally.

2.6 API Surface

Core API (v1)

25+ route groups mounted on /api/v1:

Router Prefix Purpose
chat_router /chat Flow execution, build events
endpoints_router /endpoints Component type registry
flows_router /flows CRUD for flows
folders_router /folders Flow organization
projects_router /projects Project management
login_router /login Authentication (JWT + refresh)
users_router /users User management
api_key_router /api_key API key CRUD
variables_router /variables Global Variables
files_router /files File upload/download
monitor_router /monitor Vertex build history
traces_router /traces Tracing integration
store_router /store Langflow Store
mcp_router /mcp MCP server configuration
mcp_projects_router /mcp-projects Project-level MCP
knowledge_bases_router /knowledge-bases Knowledge base management
voice_mode_router /voice Voice mode (WebRTC VAD)
starter_projects_router /starter-projects Built-in templates
flow_events_router /flow-events SSE event streaming
flow_version_router /flow-versions Flow version history
agentic_router /assist, /execute Agentic flow execution
models_router /models Model provider listing
openai_responses_router /openai-responses OpenAI-compatible API

API v2

Router Prefix Purpose
files_router_v2 /files Enhanced file operations
mcp_router_v2 /mcp Updated MCP protocol
registration_router_v2 /registration User registration
workflow_router_v2 /workflow Workflow execution

lfx Serve Endpoints

When running lfx serve, a lightweight FastAPI app exposes:

Method Path Purpose
GET /flows List loaded flows
GET /health Health check
POST /run Execute a flow synchronously
POST /stream Execute with SSE streaming
GET /info Flow metadata

Health Endpoints

Endpoint Auth Checks
GET /health None Returns {"status": "ok"} (uvicorn-level, available before full init)
GET /health_check None Validates database connectivity + cache service; returns 500 on failure

Warning

/health returns 200 even before Langflow is fully initialized (it is served by uvicorn). Use /health_check for readiness probes in Kubernetes or load balancer health checks.


3. Component Inventory

3.1 Monorepo Layout

langflow/
├── src/
│   ├── backend/
│   │   └── base/
│   │       └── langflow/           # Full-server Python package
│   │           ├── api/            # FastAPI routers (v1 + v2)
│   │           ├── agentic/        # Agentic flow execution
│   │           ├── services/       # 18 service implementations
│   │           ├── components/     # 400+ built-in component catalog
│   │           └── core/           # Celery config, graph utilities
│   ├── frontend/                   # React 19 + TypeScript SPA
│   │   ├── src/
│   │   │   ├── components/         # UI components
│   │   │   ├── pages/              # Route pages
│   │   │   └── utils/              # Helpers, cookie manager
│   │   └── tests/                  # Playwright e2e tests
│   └── lfx/                        # Lightweight runtime + CLI
│       └── src/lfx/
│           ├── cli/                # 11 CLI commands (Typer)
│           ├── graph/              # Graph engine (shared)
│           ├── services/           # Settings, auth base, MCP composer
│           └── events/             # EventManager
├── deploy/                         # Docker Compose, Traefik, Prometheus
├── docker/                         # Dev Dockerfiles
├── docker_example/                 # Quick-start Compose files
├── docs/                           # Docusaurus documentation site
├── scripts/                        # CI, translations, GP client
└── tests/                          # Backend test suites

3.2 Codebase Statistics

Metric Value
Total files 6,105
Total source characters 10,264,813
Complexity tier Massive
HIGH-priority modules 121
LOW-priority modules 1,354
Extracted classes 614
Extracted functions 3,117
API endpoints (extracted) 13 core
CLI commands 16
Error message patterns 286

4. Requirements

4.1 Runtime Requirements

Requirement Minimum Recommended
Python 3.10 3.12+
Python (max) < 3.14 —
Node.js 18 (frontend builds) 22.x (per Volta config)
Database SQLite 3 (bundled) PostgreSQL 14+
OS Linux, macOS, Windows Linux (production)

4.2 Hardware Sizing

Deployment CPU RAM Disk
Development / evaluation 2 cores 4 GB 10 GB
Small production (< 10 users) 4 cores 8 GB 50 GB
Medium production (10-100 users) 8 cores 16 GB 100 GB+
Large production (100+ users) 16+ cores 32+ GB SSD recommended

Note

Memory usage scales with flow complexity and concurrent executions. Each running flow holds its entire graph in memory during execution.

4.3 Python Package Extras

The langflow package provides 80+ optional extras for LLM providers, vector stores, and integrations. Key extras:

Extra Installs
[postgresql] psycopg[binary] + psycopg[pool] for async PostgreSQL
[redis] Redis client for cache and Celery broker
[deploy] Celery + Flower + deployment dependencies
[openai] OpenAI SDK
[anthropic] Anthropic SDK
[google] Google AI / Vertex AI SDKs
[ollama] Ollama local LLM integration
[chroma] ChromaDB vector store
[pinecone] Pinecone vector store
[aws] AWS Bedrock + S3
[all] All optional extras

Install with specific extras:

pip install "langflow[postgresql,redis,openai,anthropic]"

5. Configuration Reference

All settings are controlled via environment variables with the LANGFLOW_ prefix. The configuration is backed by two Pydantic BaseSettings models: Settings (general) and AuthSettings (authentication).

5.1 Core Settings

Variable Type Default Description
LANGFLOW_HOST str localhost Bind address
LANGFLOW_PORT int 7860 Bind port
LANGFLOW_WORKERS int 1 Uvicorn worker count. >1 forces event_delivery=direct
LANGFLOW_LOG_LEVEL str critical Log level (debug/info/warning/error/critical)
LANGFLOW_LOG_FILE str logs/langflow.log Log file path
LANGFLOW_ROOT_PATH str "" ASGI root path for reverse-proxy prefix stripping
LANGFLOW_BACKEND_ONLY bool false If true, do not serve the frontend
LANGFLOW_DEV bool false Development mode
LANGFLOW_OPEN_BROWSER bool false Open browser on startup

5.2 Database Settings

Variable Type Default Description
LANGFLOW_DATABASE_URL str sqlite:///... (auto) Database connection URL. Drivers auto-converted to async (sqlite+aiosqlite, postgresql+psycopg)
LANGFLOW_SAVE_DB_IN_CONFIG_DIR bool false Store SQLite DB in config dir instead of package dir
LANGFLOW_CONFIG_DIR str (platform cache dir) Config directory for secrets, keys, DB
LANGFLOW_POOL_SIZE int 20 Connection pool size
LANGFLOW_MAX_OVERFLOW int 30 Extra connections beyond pool size
LANGFLOW_DB_CONNECT_TIMEOUT int 30 Connection timeout (seconds)
LANGFLOW_DATABASE_CONNECTION_RETRY bool false Retry on connection failure
LANGFLOW_MIGRATION_LOCK_NAMESPACE str (auto) PostgreSQL advisory lock namespace for migrations
LANGFLOW_USE_NOOP_DATABASE bool false Disable all DB operations (testing)

SQLite pragmas (defaults):

{"synchronous": "NORMAL", "journal_mode": "WAL", "busy_timeout": 30000}

Important

For production with multiple users, migrate to PostgreSQL. SQLite has limited concurrent write capability even with WAL mode. Set LANGFLOW_DATABASE_URL=postgresql://user:pass@host:5432/langflow and install with pip install "langflow[postgresql]".

5.3 Cache Settings

Variable Type Default Description
LANGFLOW_CACHE_TYPE str async Cache backend: async, redis, memory, disk
LANGFLOW_CACHE_EXPIRE int 3600 Cache TTL (seconds)
LANGFLOW_REDIS_HOST str localhost Redis host
LANGFLOW_REDIS_PORT int 6379 Redis port
LANGFLOW_REDIS_DB int 0 Redis database number
LANGFLOW_REDIS_URL str (none) Full Redis URL (overrides host/port/db)
LANGFLOW_REDIS_CACHE_EXPIRE int 3600 Redis-specific cache TTL

5.4 Storage Settings

Variable Type Default Description
LANGFLOW_STORAGE_TYPE str local local or s3
LANGFLOW_OBJECT_STORAGE_BUCKET_NAME str langflow-bucket S3 bucket name
LANGFLOW_OBJECT_STORAGE_PREFIX str files S3 key prefix
LANGFLOW_MAX_FILE_SIZE_UPLOAD int 1024 Max upload size (MB)
LANGFLOW_KNOWLEDGE_BASES_DIR str ~/.langflow/knowledge_bases Knowledge base storage

5.5 MCP Settings

Variable Type Default Description
LANGFLOW_MCP_SERVER_ENABLED bool true Enable MCP server
LANGFLOW_MCP_COMPOSER_ENABLED bool true Enable MCP Composer service
LANGFLOW_MCP_COMPOSER_VERSION str ==0.1.0.8.10 mcp-composer version constraint for uvx
LANGFLOW_MCP_BASE_URL str "" External base URL for MCP server URLs
LANGFLOW_MCP_SERVER_TIMEOUT int 20 MCP connection timeout (seconds)
LANGFLOW_MCP_MAX_SESSIONS_PER_SERVER int 10 Max sessions per MCP server
LANGFLOW_MCP_SESSION_IDLE_TIMEOUT int 400 Idle session reap timeout (seconds)
LANGFLOW_MCP_SESSION_CLEANUP_INTERVAL int 120 Cleanup sweep frequency (seconds)
LANGFLOW_ADD_PROJECTS_TO_MCP_SERVERS bool true Auto-add new projects to MCP config

5.6 Performance and Limits

Variable Type Default Description
LANGFLOW_WORKER_TIMEOUT int 300 API call timeout (seconds)
LANGFLOW_FRONTEND_TIMEOUT int 0 Frontend API call timeout (0 = unlimited)
LANGFLOW_MAX_TRANSACTIONS_TO_KEEP int 3000 Transaction history limit
LANGFLOW_MAX_VERTEX_BUILDS_TO_KEEP int 3000 Vertex build history limit
LANGFLOW_MAX_VERTEX_BUILDS_PER_VERTEX int 50 Builds per vertex limit
LANGFLOW_MAX_FLOW_VERSION_ENTRIES_PER_FLOW int 50 Version history per flow
LANGFLOW_MAX_TEXT_LENGTH int (default) Max text display length in UI
LANGFLOW_MAX_ITEMS_LENGTH int (default) Max list display length in UI
LANGFLOW_AUTO_SAVING bool true Auto-save flows
LANGFLOW_AUTO_SAVING_INTERVAL int 1000 Auto-save interval (ms)
LANGFLOW_LAZY_LOAD_COMPONENTS bool false Lazy-load components to speed startup
LANGFLOW_EVENT_DELIVERY str streaming Event delivery mode: streaming, polling, direct

5.7 Telemetry and Monitoring

Variable Type Default Description
LANGFLOW_PROMETHEUS_ENABLED bool false Expose Prometheus metrics
LANGFLOW_PROMETHEUS_PORT int 9090 Prometheus metrics port
LANGFLOW_SENTRY_DSN str (none) Sentry error tracking DSN
LANGFLOW_SENTRY_TRACES_SAMPLE_RATE float 1.0 Sentry trace sample rate
LANGFLOW_SENTRY_PROFILES_SAMPLE_RATE float 1.0 Sentry profile sample rate
LANGFLOW_DO_NOT_TRACK bool false Disable anonymous telemetry
LANGFLOW_DEACTIVATE_TRACING bool false Disable distributed tracing
LANGFLOW_TRANSACTIONS_STORAGE_ENABLED bool true Track inter-flow transactions
LANGFLOW_VERTEX_BUILDS_STORAGE_ENABLED bool true Track vertex build outputs

5.8 Feature Flags

Variable Type Default Description
LANGFLOW_AGENTIC_EXPERIENCE bool false Enable agentic MCP tools for flow/component operations
LANGFLOW_DEVELOPER_API_ENABLED bool false Enable developer debugging endpoints
LANGFLOW_FEATURE_WXO_DEPLOYMENTS bool false Enable Watsonx Orchestrate deployment adapters
LANGFLOW_FEATURE_MVP_COMPONENTS bool false Enable MVP component set
LANGFLOW_CREATE_STARTER_PROJECTS bool true Create starter project templates on startup
LANGFLOW_UPDATE_STARTER_PROJECTS bool true Update existing starter projects

5.9 Public Flow Settings

Variable Type Default Description
LANGFLOW_PUBLIC_FLOW_CLEANUP_INTERVAL int 3600 Cleanup interval for temporary public flows (seconds, min 600)
LANGFLOW_PUBLIC_FLOW_EXPIRATION int 86400 Public flow expiration time (seconds, min 600)
LANGFLOW_WEBHOOK_POLLING_INTERVAL int 0 Webhook polling interval (ms, 0 = disabled; SSE provides real-time)

6. Security

6.1 Authentication Architecture

Langflow implements a layered authentication system:

Request → JWT Bearer Token OR API Key (X-API-Key header)
           │                         │
           ▼                         ▼
      JWT Validation            Key Lookup
      (HS256/RS256/RS512)       (DB or env)
           │                         │
           └─────────┬───────────────┘
                     ▼
              User Context
              (superuser / active / inactive)

JWT Configuration

Variable Type Default Description
LANGFLOW_SECRET_KEY SecretStr (auto-generated) HS256 signing key. Persisted to CONFIG_DIR/secret_key
LANGFLOW_ALGORITHM enum HS256 JWT algorithm: HS256, RS256, RS512
LANGFLOW_PRIVATE_KEY SecretStr (auto-generated) RSA private key for RS256/RS512
LANGFLOW_PUBLIC_KEY str (derived) RSA public key (derived from private key)
LANGFLOW_ACCESS_TOKEN_EXPIRE_SECONDS int 3600 Access token TTL (1 hour)
LANGFLOW_REFRESH_TOKEN_EXPIRE_SECONDS int 604800 Refresh token TTL (7 days)

Important

For production, switch to RS256 or RS512. Asymmetric keys allow token verification without exposing the signing key. Keys are auto-generated on first start and persisted to CONFIG_DIR/private_key.pem and CONFIG_DIR/public_key.pem with restricted file permissions (0600 on Unix).

API Key Source

Variable Default Behavior
LANGFLOW_API_KEY_SOURCE=db Default Validates against per-user database-stored API keys
LANGFLOW_API_KEY_SOURCE=env — Validates against LANGFLOW_API_KEY environment variable
Variable Default Description
LANGFLOW_REFRESH_SAME_SITE none Refresh token SameSite attribute
LANGFLOW_REFRESH_SECURE true Refresh token Secure flag
LANGFLOW_REFRESH_HTTPONLY true Refresh token HttpOnly flag
LANGFLOW_ACCESS_SAME_SITE lax Access token SameSite attribute
LANGFLOW_ACCESS_SECURE false Access token Secure flag
LANGFLOW_ACCESS_HTTPONLY false Access token HttpOnly flag
LANGFLOW_COOKIE_DOMAIN (none) Cookie domain attribute

6.2 Auto-Login Mode

Variable Default Description
LANGFLOW_AUTO_LOGIN true SECURITY WARNING: Bypasses authentication entirely. Default superuser credentials: langflow / langflow

Caution

AUTO_LOGIN=true is the default. This creates a superuser with default credentials and skips authentication checks. Set LANGFLOW_AUTO_LOGIN=false in any network-accessible deployment. When disabled, configure LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD for initial admin access. Credentials are scrubbed from in-memory settings after superuser setup.

6.3 SSO Configuration

Variable Default Description
LANGFLOW_SSO_ENABLED false Enable SSO authentication
LANGFLOW_SSO_PROVIDER jwt Provider type: jwt, oidc, saml, ldap
LANGFLOW_SSO_CONFIG_FILE (none) Path to YAML SSO configuration file

SSO requires SSO_ENABLED=true and a valid SSO_CONFIG_FILE pointing to a YAML file with provider-specific settings.

6.4 CORS Configuration

Variable Default Description
LANGFLOW_CORS_ORIGINS * Allowed origins (comma-separated list or *)
LANGFLOW_CORS_ALLOW_CREDENTIALS true Allow credentials in CORS
LANGFLOW_CORS_ALLOW_METHODS * Allowed HTTP methods
LANGFLOW_CORS_ALLOW_HEADERS * Allowed headers

Warning

The default CORS_ORIGINS=* with CORS_ALLOW_CREDENTIALS=true is insecure. In production, set specific origins. The v2.0 release plans to change the credentials default to false when using wildcard origins.

6.5 SSRF Protection

Variable Default Description
LANGFLOW_SSRF_PROTECTION_ENABLED false Block requests to private IP ranges, localhost, cloud metadata
LANGFLOW_SSRF_ALLOWED_HOSTS [] Allow-list: hostnames, wildcard domains (*.example.com), IPs, CIDR ranges

Important

SSRF protection is disabled by default. When disabled, components can make requests to internal services, private networks, and cloud metadata endpoints (e.g., 169.254.169.254). Enable in production, especially in multi-tenant deployments. The v2.0 release plans to enable this by default.

6.6 Custom Component Security

Variable Default Description
LANGFLOW_ALLOW_CUSTOM_COMPONENTS true When false, blocks execution of components whose code does not match a known server template
LANGFLOW_COMPONENTS_PATH [] Allow-list of custom component directories (permitted even when allow_custom_components=false)

Note

The component security feature is in beta. For true multi-tenant isolation, use hardware-level separation.

6.7 Webhook Authentication

Variable Default Description
LANGFLOW_WEBHOOK_AUTH_ENABLE false When true, webhook endpoints require API key authentication. When false, webhooks run as flow owner without auth

6.8 Superuser CLI

Variable Default Description
LANGFLOW_ENABLE_SUPERUSER_CLI true Allow langflow superuser CLI command. Set to false in production to prevent unauthorized superuser creation

6.9 Security Hardening Checklist

  • [ ] Set LANGFLOW_AUTO_LOGIN=false
  • [ ] Configure LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD with strong credentials
  • [ ] Switch LANGFLOW_ALGORITHM to RS256 or RS512
  • [ ] Set LANGFLOW_CORS_ORIGINS to specific allowed origins
  • [ ] Enable LANGFLOW_SSRF_PROTECTION_ENABLED=true
  • [ ] Set LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false in multi-tenant environments
  • [ ] Set LANGFLOW_ENABLE_SUPERUSER_CLI=false
  • [ ] Enable LANGFLOW_WEBHOOK_AUTH_ENABLE=true
  • [ ] Set LANGFLOW_NEW_USER_IS_ACTIVE=false (require admin approval for new accounts)
  • [ ] Use TLS termination at reverse proxy (Traefik, nginx)
  • [ ] Restrict LANGFLOW_CONFIG_DIR filesystem permissions
  • [ ] For RSA keys: verify private_key.pem has 0600 permissions

7. Deployment

7.1 Docker Compose (Production)

The deploy/ directory provides a production-ready Docker Compose configuration with Traefik reverse proxy:

# Key environment variables for deploy/.env
DOMAIN=langflow.example.com
TRAEFIK_TAG=langflow
STACK_NAME=langflow

Architecture:

Internet → Traefik (:80/:443)
             ├── /api/*  → backend (:7860)
             ├── /*      → frontend (:80)
             └── /flower → flower (:5555)

Internal:
  backend (:7860) → PostgreSQL (:5432)
                  → Redis (:6379)
  celeryworker    → Redis (:6379)
  pgadmin (:5050)
  prometheus (:9090) → flower (:5555)

Traefik routing labels (from deploy/docker-compose.override.yml):

# Backend
traefik.http.routers.langflow-backend-http.rule=PathPrefix(`/api/v1`) || PathPrefix(`/api/v2`) || PathPrefix(`/docs`) || PathPrefix(`/health`)

# Frontend
traefik.http.routers.langflow-frontend-http.rule=PathPrefix(`/`)

7.2 Quick-Start Docker Compose

For evaluation or small deployments, use the simplified compose file:

# docker_example/pre.docker-compose.yml
services:
  langflow:
    image: langflowai/langflow:1.0-alpha
    ports:
      - "7860:7860"
    depends_on:
      - postgres
    environment:
      - LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@postgres:5432/langflow
      - LANGFLOW_CONFIG_DIR=app/langflow
    volumes:
      - langflow-data:/app/langflow

  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: langflow
      POSTGRES_PASSWORD: langflow
      POSTGRES_DB: langflow
    volumes:
      - langflow-postgres:/var/lib/postgresql/data

7.3 Development Docker Compose

# docker/dev.docker-compose.yml
services:
  langflow:
    build:
      context: ..
      dockerfile: docker/dev.Dockerfile
    ports:
      - "7860:7860"
      - "3000:3000"
    environment:
      - LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@postgres:5432/langflow
      - LANGFLOW_SUPERUSER=langflow
      - LANGFLOW_SUPERUSER_PASSWORD=langflow
      - LANGFLOW_CONFIG_DIR=/var/lib/langflow

Backend command:

uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --loop asyncio

7.4 Kubernetes Considerations

  • Readiness probe: Use GET /health_check (not /health). The /health endpoint returns 200 before the application is fully initialized.
  • Port environment variable: Kubernetes auto-creates LANGFLOW_RUNTIME_PORT=tcp://<ip>:<port> for services. Langflow's settings validator automatically parses URL-format port values.
  • Multi-worker: When running multiple replicas, set LANGFLOW_EVENT_DELIVERY=direct (auto-detected when workers > 1).
  • Database migrations: Use LANGFLOW_MIGRATION_LOCK_NAMESPACE for coordinated advisory locking when multiple instances share a PostgreSQL database.
  • Variable store: Set LANGFLOW_VARIABLE_STORE=kubernetes to use Kubernetes secrets for Global Variables instead of the database.

7.5 Reverse Proxy Configuration

When deploying behind a reverse proxy that strips a URL prefix:

LANGFLOW_ROOT_PATH=/langflow

This sets the ASGI root_path, ensuring MCP SSE transport includes the correct prefix in POST-back URLs.

7.6 SSL/TLS

For direct TLS termination (without a reverse proxy):

LANGFLOW_SSL_CERT_FILE=/path/to/cert.pem
LANGFLOW_SSL_KEY_FILE=/path/to/key.pem

Tip

In most production deployments, TLS is terminated at the reverse proxy (Traefik, nginx, cloud load balancer). Use these settings only when Langflow is directly exposed.

7.7 Celery Workers

Enable background task processing with Celery:

LANGFLOW_CELERY_ENABLED=true
LANGFLOW_REDIS_HOST=redis
LANGFLOW_REDIS_PORT=6379

Celery configuration supports both Redis and RabbitMQ brokers:

Variable Default Description
LANGFLOW_REDIS_HOST (none) Redis host for Celery broker
LANGFLOW_REDIS_PORT (none) Redis port
BROKER_URL (none) Full broker URL (overrides Redis settings)
RESULT_BACKEND redis://localhost:6379/0 Celery result backend
RABBITMQ_DEFAULT_USER langflow RabbitMQ user
RABBITMQ_DEFAULT_PASS langflow RabbitMQ password

8. Operations

8.1 Startup Sequence

  1. create_app() factory initializes FastAPI
  2. register_all_service_factories() registers all 18 service factories
  3. register_builtin_adapters() loads deployment adapters (conditionally)
  4. External cache connection test (if redis/external cache configured)
  5. initialize_database() runs Alembic migrations
  6. setup_superuser() creates or validates superuser account
  7. assign_orphaned_flows_to_superuser() cleans up unassigned flows
  8. clean_transactions() + clean_vertex_builds() prune old records
  9. All services marked ready

8.2 Database Migrations

Alembic migrations run automatically on startup. For PostgreSQL multi-instance deployments, migrations use advisory locks to prevent concurrent migration execution.

# Check migration log
LANGFLOW_ALEMBIC_LOG_FILE=alembic/alembic.log
LANGFLOW_ALEMBIC_LOG_TO_STDOUT=true  # Log to stdout instead

8.3 Monitoring

Prometheus Metrics

Enable with LANGFLOW_PROMETHEUS_ENABLED=true. Metrics are served on port 9090 (configurable via LANGFLOW_PROMETHEUS_PORT).

Prometheus scrape config (from deploy/prometheus.yml):

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ["prometheus:9090"]
  - job_name: flower
    static_configs:
      - targets: ["flower:5555"]

Log Streaming

Authenticated endpoints for real-time log access:

Endpoint Description
GET /logs-stream SSE endpoint for real-time log streaming
GET /logs?lines_before=N Retrieve last N log lines
GET /logs?timestamp=T&lines_after=N Retrieve N lines after timestamp

Note

Log endpoints require authentication. Logs may contain sensitive information. Log streaming uses an in-memory ring buffer (log_buffer) and requires the log buffer to be enabled.

Sentry Integration

LANGFLOW_SENTRY_DSN=https://[email removed]/0
LANGFLOW_SENTRY_TRACES_SAMPLE_RATE=0.1   # Sample 10% of transactions
LANGFLOW_SENTRY_PROFILES_SAMPLE_RATE=0.1

8.4 Backup and Recovery

SQLite:

# Stop Langflow, copy the database file
cp $(LANGFLOW_CONFIG_DIR)/langflow.db langflow.db.backup

PostgreSQL:

pg_dump -h host -U langflow langflow > langflow_backup.sql

File storage:

  • Local: back up the directory specified by LANGFLOW_CONFIG_DIR and LANGFLOW_KNOWLEDGE_BASES_DIR
  • S3: standard S3 bucket backup/versioning

Critical files to preserve:

  • CONFIG_DIR/secret_key — JWT signing key (HS256)
  • CONFIG_DIR/private_key.pem — RSA private key (RS256/RS512)
  • CONFIG_DIR/public_key.pem — RSA public key
  • The database (flows, users, API keys, Global Variables)
  • Knowledge base files

8.5 Data Retention

Langflow automatically prunes old data based on configurable limits:

Data type Limit setting Default
Transaction records max_transactions_to_keep 3,000
Vertex build records max_vertex_builds_to_keep 3,000
Builds per vertex max_vertex_builds_per_vertex 50
Flow version entries max_flow_version_entries_per_flow 50
Public temporary flows public_flow_expiration 24 hours

Pruning runs during startup (clean_transactions(), clean_vertex_builds()) and periodically for public flows.


9. Troubleshooting

9.1 Startup Failures

Symptom Cause Resolution
Cache service failed to connect to external database Redis/external cache unreachable Verify LANGFLOW_REDIS_HOST/LANGFLOW_REDIS_PORT or set LANGFLOW_CACHE_TYPE=async
Could not initialize services Service factory import failure Check Python environment has all required packages installed
Could not create superuser Database migration or credential issue Check database connectivity; verify LANGFLOW_SUPERUSER / LANGFLOW_SUPERUSER_PASSWORD
config_dir not set Missing configuration directory Set LANGFLOW_CONFIG_DIR explicitly
Port already in use Another process on port 7860 Change LANGFLOW_PORT or stop the conflicting process

9.2 Database Issues

Symptom Cause Resolution
sqlite3.OperationalError: database is locked Concurrent SQLite writes Migrate to PostgreSQL for multi-user production deployments
Migration failures on startup Schema version mismatch Check Alembic log file; may need --fix-migration flag
Invalid database_url provided Malformed connection string Verify URL format: postgresql://user:pass@host:5432/dbname

9.3 MCP Issues

Symptom Issue Resolution
MCP Tools fails in lfx serve mode Known bug (#12759) Use full Langflow server instead of lfx serve for MCP
MCP x-api-key not propagated to nested calls Known bug (#12529) Set API keys directly in each MCP server config
MCP servers disappear in containers Known bug (#9524) Verify container has access to MCP binary paths; check volume mounts
MCP tab fails in Kubernetes with separate frontend pod Known bug (#10172) Ensure frontend pod can reach backend MCP endpoints; check LANGFLOW_MCP_BASE_URL
MCP tools cannot handle number inputs Known bug (#9424) Cast number inputs to strings in the flow before passing to MCP tools

9.4 Performance Issues

Symptom Cause Resolution
Slow startup Large component catalog loading Enable LANGFLOW_LAZY_LOAD_COMPONENTS=true
Memory growth during execution Graph held in memory per flow run Monitor concurrent executions; increase RAM or reduce parallelism
SSE connections dropping Proxy timeout Increase reverse proxy read timeout; use polling event delivery
Multi-worker event loss SSE not supported multi-process Set LANGFLOW_EVENT_DELIVERY=direct (auto-detected)

9.5 Authentication Issues

Symptom Cause Resolution
Default credentials accepted in production AUTO_LOGIN=true (default) Set LANGFLOW_AUTO_LOGIN=false
JWT signature verification failed Key rotation or mismatch Ensure CONFIG_DIR/secret_key or private_key.pem is consistent across restarts/replicas
SSO login fails Missing or invalid config Verify LANGFLOW_SSO_CONFIG_FILE path and YAML structure
API key rejected Wrong source configuration Check LANGFLOW_API_KEY_SOURCE matches your setup (db vs env)

10. Quick Reference

10.1 CLI Commands (lfx)

Command Purpose
lfx init Scaffold a new project directory
lfx create Create a new flow from templates
lfx validate Validate flow JSON (levels 1-4)
lfx status Check flow/environment status
lfx push Push flows to a remote Langflow server
lfx pull Pull flows from remote
lfx export Export/normalize flow JSON
lfx run Execute a flow locally
lfx serve Serve flows via lightweight API
lfx login Authenticate with a remote server
lfx requirements Generate Python requirements for a flow

10.2 Default Credentials

Credential Value Notes
Superuser username langflow When AUTO_LOGIN=true
Superuser password langflow When AUTO_LOGIN=true
PostgreSQL (dev compose) langflow / langflow Database: langflow

Caution

Change all default credentials before any network-accessible deployment.

10.3 Key File Locations

File Location Purpose
JWT secret key CONFIG_DIR/secret_key HS256 signing key (auto-generated, persisted)
RSA private key CONFIG_DIR/private_key.pem RS256/RS512 signing key (0600 perms)
RSA public key CONFIG_DIR/public_key.pem RS256/RS512 verification key (0644 perms)
SQLite database CONFIG_DIR/langflow.db or package dir Default database
Alembic log alembic/alembic.log Migration log
Application log logs/langflow.log Application log
Knowledge bases ~/.langflow/knowledge_bases Default KB storage

10.4 Port Reference

Port Service Notes
7860 Langflow backend + frontend Main application port
3000 Frontend dev server Development only
5432 PostgreSQL Database
6379 Redis Cache / Celery broker
9090 Prometheus Metrics (when enabled)
5555 Flower Celery monitoring
5050 pgAdmin Database admin
80/443 Traefik Reverse proxy

11. Internals

11.1 Module Reference

langflow.main

Entry point. create_app() factory produces the FastAPI application, calls initialize_services().

langflow.services.utils

Orchestrates startup: initialize_services() registers all factories, validates external caches, runs database migrations, creates superuser, and prunes stale records.

Key functions:

  • register_all_service_factories() — registers 18 service factories + MCP composer
  • register_builtin_adapters() — loads Watsonx Orchestrate adapter (feature-flagged)
  • setup_superuser() — creates/validates superuser, scrubs credentials from memory after
  • teardown_superuser() — removes default superuser when AUTO_LOGIN is disabled
  • clean_transactions() / clean_vertex_builds() — bulk-delete old records beyond configured limits

langflow.api.build

Core flow execution engine:

  • start_flow_build() — creates job queue, starts build coroutine
  • generate_flow_events() — builds graph, sorts vertices, executes DAG with event emission
  • build_vertices() — recursive vertex builder with concurrent asyncio.gather()
  • cancel_flow_build() — cancels running build jobs

langflow.services.event_manager

WebhookEventManager — in-memory SSE broadcast system for webhook-triggered builds. Uses asyncio.Queue per subscriber (max 100 items), 1-second emit timeout, automatic dead-queue cleanup.

langflow.api.router

Mounts all v1 and v2 routers. Conditionally includes deployment router (Watsonx Orchestrate) based on FEATURE_FLAGS.wxo_deployments.

langflow.services.factory

ServiceFactory base class with automatic dependency inference via infer_service_types(). Uses cachetools.LRUCache to memoize factory introspection results.

lfx.services.settings

Two Pydantic BaseSettings models:

  • Settings — general configuration (100+ fields, all prefixed LANGFLOW_)
  • AuthSettings — authentication configuration (JWT, SSO, cookies, superuser)

Custom EnvSettingsSource supports comma-separated list parsing for list-type fields.

11.2 Security Analysis

Password hashing: bcrypt via passlib.CryptContext

Key management:

  • HS256: Secret key auto-generated with secrets.token_urlsafe(32), persisted to filesystem with restricted permissions
  • RS256/RS512: 2048-bit RSA key pairs auto-generated via cryptography library. Private keys stored with 0600 permissions (Unix) or equivalent ACL (Windows)
  • Credentials scrubbed from in-memory settings after superuser setup (reset_credentials())

Known security defaults to address:

  • AUTO_LOGIN=true — bypasses all authentication
  • CORS_ORIGINS=* with CORS_ALLOW_CREDENTIALS=true — overly permissive
  • SSRF_PROTECTION_ENABLED=false — allows internal network access
  • ALLOW_CUSTOM_COMPONENTS=true — permits arbitrary code execution
  • WEBHOOK_AUTH_ENABLE=false — unauthenticated webhook access
  • ENABLE_SUPERUSER_CLI=true — allows CLI superuser creation

11.3 Code Patterns

Service manager pattern: All services implement the abstract Service base class with name, ready, get_schema(), teardown(), and set_ready(). Factories declare dependencies through type hints on create().

Dependency injection: FastAPI dependency functions (get_settings_service(), get_db_service(), etc.) retrieve service instances from the global ServiceManager. Lazy initialization with factory fallbacks.

Async sessions: session_scope() context manager wraps SQLAlchemy async sessions with auto-commit/rollback. The legacy get_session() is deprecated (NotImplementedError).

Event-driven execution: EventManager registers named events (on_token, on_end_vertex, on_build_start, etc.) and delivers them via asyncio.Queue. WebhookForwardingQueue adapts the interface for SSE broadcast.

Adapter registry: Generic AdapterRegistry[T] with decorator-based registration (@register_adapter). Used for deployment providers (Watsonx Orchestrate). Feature-flagged and import-guarded.

11.4 Testing

The codebase has extensive test coverage across multiple layers:

Test type Location Framework
Backend unit tests tests/, src/lfx/tests/unit/ pytest
Integration tests src/lfx/tests/integration/ pytest
Frontend e2e tests src/frontend/tests/ Playwright
GP client tests scripts/gp/tests/ pytest

CLI commands have thorough unit test coverage (120+ test classes for lfx CLI alone), testing command-line argument parsing, file operations, error handling, and edge cases.

11.5 Known Issues

Based on community-reported bugs (GitHub Issues):

Issue Status Impact
MCP Tools fails in lfx serve (#12759) Open MCP components non-functional in standalone mode
MCP x-api-key not propagated (#12529) Open Nested MCP calls fail authentication
MCP tools cannot handle number inputs (#9424) Open Type coercion errors
MCP servers gone in containers (#9524) Open MCP unavailable in containerized deployments
Shareable Playground strips spaces (#12731) Open Input data corruption in v1.9.0
MCP tab fails in K8s split-pod (#10172) Open MCP configuration inaccessible
Inconsistent MCP behavior with dual agents (#9860) Open Flow failures with shared MCP tools
Missing ru and ko locales (#12740) Open i18n gaps

11.6 Internationalization

Langflow uses Globalization Pipeline (GP) for translations. The scripts/gp/ directory contains HMAC-authenticated API clients for uploading English source strings and downloading translated bundles. Target languages are managed via the GP service, with tests verifying upload/download integrity.


12. Environment Variable Quick Reference

Complete alphabetical reference of all LANGFLOW_ environment variables documented in this guide:

Variable Section
LANGFLOW_ACCESS_HTTPONLY 6.1
LANGFLOW_ACCESS_SAME_SITE 6.1
LANGFLOW_ACCESS_SECURE 6.1
LANGFLOW_ACCESS_TOKEN_EXPIRE_SECONDS 6.1
LANGFLOW_AGENTIC_EXPERIENCE 5.8
LANGFLOW_ALGORITHM 6.1
LANGFLOW_ALLOW_CUSTOM_COMPONENTS 6.6
LANGFLOW_AUTO_LOGIN 6.2
LANGFLOW_AUTO_SAVING 5.6
LANGFLOW_AUTO_SAVING_INTERVAL 5.6
LANGFLOW_BACKEND_ONLY 5.1
LANGFLOW_CACHE_EXPIRE 5.3
LANGFLOW_CACHE_TYPE 5.3
LANGFLOW_CELERY_ENABLED 7.7
LANGFLOW_COMPONENTS_PATH 6.6
LANGFLOW_CONFIG_DIR 5.2
LANGFLOW_COOKIE_DOMAIN 6.1
LANGFLOW_CORS_ALLOW_CREDENTIALS 6.4
LANGFLOW_CORS_ALLOW_HEADERS 6.4
LANGFLOW_CORS_ALLOW_METHODS 6.4
LANGFLOW_CORS_ORIGINS 6.4
LANGFLOW_CREATE_STARTER_PROJECTS 5.8
LANGFLOW_DATABASE_CONNECTION_RETRY 5.2
LANGFLOW_DATABASE_URL 5.2
LANGFLOW_DB_CONNECT_TIMEOUT 5.2
LANGFLOW_DEACTIVATE_TRACING 5.7
LANGFLOW_DEV 5.1
LANGFLOW_DEVELOPER_API_ENABLED 5.8
LANGFLOW_DO_NOT_TRACK 5.7
LANGFLOW_ENABLE_SUPERUSER_CLI 6.8
LANGFLOW_EVENT_DELIVERY 5.6
LANGFLOW_FRONTEND_TIMEOUT 5.6
LANGFLOW_HOST 5.1
LANGFLOW_KNOWLEDGE_BASES_DIR 5.4
LANGFLOW_LAZY_LOAD_COMPONENTS 5.6
LANGFLOW_LOG_FILE 5.1
LANGFLOW_LOG_LEVEL 5.1
LANGFLOW_MAX_FILE_SIZE_UPLOAD 5.4
LANGFLOW_MAX_FLOW_VERSION_ENTRIES_PER_FLOW 5.6
LANGFLOW_MAX_OVERFLOW 5.2
LANGFLOW_MAX_TRANSACTIONS_TO_KEEP 5.6
LANGFLOW_MAX_VERTEX_BUILDS_PER_VERTEX 5.6
LANGFLOW_MAX_VERTEX_BUILDS_TO_KEEP 5.6
LANGFLOW_MCP_BASE_URL 5.5
LANGFLOW_MCP_COMPOSER_ENABLED 5.5
LANGFLOW_MCP_COMPOSER_VERSION 5.5
LANGFLOW_MCP_MAX_SESSIONS_PER_SERVER 5.5
LANGFLOW_MCP_SERVER_ENABLED 5.5
LANGFLOW_MCP_SERVER_TIMEOUT 5.5
LANGFLOW_MCP_SESSION_CLEANUP_INTERVAL 5.5
LANGFLOW_MCP_SESSION_IDLE_TIMEOUT 5.5
LANGFLOW_MIGRATION_LOCK_NAMESPACE 5.2
LANGFLOW_NEW_USER_IS_ACTIVE 6.9
LANGFLOW_OPEN_BROWSER 5.1
LANGFLOW_POOL_SIZE 5.2
LANGFLOW_PORT 5.1
LANGFLOW_PRIVATE_KEY 6.1
LANGFLOW_PROMETHEUS_ENABLED 5.7
LANGFLOW_PROMETHEUS_PORT 5.7
LANGFLOW_PUBLIC_FLOW_CLEANUP_INTERVAL 5.9
LANGFLOW_PUBLIC_FLOW_EXPIRATION 5.9
LANGFLOW_PUBLIC_KEY 6.1
LANGFLOW_REDIS_CACHE_EXPIRE 5.3
LANGFLOW_REDIS_DB 5.3
LANGFLOW_REDIS_HOST 5.3
LANGFLOW_REDIS_PORT 5.3
LANGFLOW_REDIS_URL 5.3
LANGFLOW_REFRESH_HTTPONLY 6.1
LANGFLOW_REFRESH_SAME_SITE 6.1
LANGFLOW_REFRESH_SECURE 6.1
LANGFLOW_REFRESH_TOKEN_EXPIRE_SECONDS 6.1
LANGFLOW_ROOT_PATH 5.1
LANGFLOW_SAVE_DB_IN_CONFIG_DIR 5.2
LANGFLOW_SECRET_KEY 6.1
LANGFLOW_SENTRY_DSN 5.7
LANGFLOW_SENTRY_PROFILES_SAMPLE_RATE 5.7
LANGFLOW_SENTRY_TRACES_SAMPLE_RATE 5.7
LANGFLOW_SSO_CONFIG_FILE 6.3
LANGFLOW_SSO_ENABLED 6.3
LANGFLOW_SSO_PROVIDER 6.3
LANGFLOW_SSRF_ALLOWED_HOSTS 6.5
LANGFLOW_SSRF_PROTECTION_ENABLED 6.5
LANGFLOW_SSL_CERT_FILE 7.6
LANGFLOW_SSL_KEY_FILE 7.6
LANGFLOW_STORAGE_TYPE 5.4
LANGFLOW_SUPERUSER 6.2
LANGFLOW_SUPERUSER_PASSWORD 6.2
LANGFLOW_UPDATE_STARTER_PROJECTS 5.8
LANGFLOW_USE_NOOP_DATABASE 5.2
LANGFLOW_WEBHOOK_AUTH_ENABLE 6.7
LANGFLOW_WEBHOOK_POLLING_INTERVAL 5.9
LANGFLOW_WORKER_TIMEOUT 5.6
LANGFLOW_WORKERS 5.1