CTCaliberTek
Cheat Sheets

Langflow Cheat Sheet: Install, Components, API Calls, and Custom Components

Published October 15, 2026·Updated October 29, 2026·7 min read
Like SaveLog in to like, save, and track progress.

Introduction

Langflow is a visual builder for AI agents and workflows. This cheat sheet collects the commands, settings, and API calls you need most. Langflow changes quickly, so confirm names and settings against the documentation for your version.

Prerequisites

  • Python or Docker
  • An API key for an LLM provider

Step-by-Step Guide

Step 1: Install and run

Run Langflow with uv or Docker, then open the interface on port 7860.

uv pip install langflow
uv run langflow run                 # open http://127.0.0.1:7860

docker run -p 7860:7860 \
  -e LANGFLOW_AUTO_LOGIN=false \
  -e LANGFLOW_SUPERUSER_PASSWORD=choose-a-strong-password \
  langflowai/langflow:latest

uv pip install "langflow[bundles]"  # extra integrations (for example some vector stores)

Step 2: Know the interface

Flows live inside projects. You build on the canvas, test in the Playground, and share through the API panel.

Projects      group and organize your flows
Canvas        drag components in and connect output to input ports
Playground    chat with the flow to test it
Share         API access, embed code, and MCP server options
Settings      global variables, API keys, and model providers

Step 3: Core components to recognize

Most flows connect an input, a prompt or agent, a model, and an output. Check the components menu in your version for exact names.

Chat Input / Chat Output     entry and exit of a conversation
Prompt                       template with {variables}
Language Model               choose provider and model
Agent                        model + tools + system instructions
Embedding Model              turns text into vectors
Vector Store                 store and search embeddings (for RAG)
Parser / Data components     reshape and format data between steps
Tools / MCP                  give agents abilities and external servers

Step 4: Call a flow over the API

Send a POST request to the flow's run endpoint with your key in the x-api-key header. Reuse the same session_id to continue a conversation.

export LANGFLOW_SERVER_URL="http://localhost:7860"
export FLOW_ID="your-flow-id"
export LANGFLOW_API_KEY="your-langflow-api-key"

curl -X POST "$LANGFLOW_SERVER_URL/api/v1/run/$FLOW_ID" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $LANGFLOW_API_KEY" \
  -d '{"input_value": "Hello!", "input_type": "chat", "output_type": "chat", "session_id": "user-1"}'

Step 5: The same call in Python

Keep the API key on the server, never in browser code.

import os
import requests

base = os.environ["LANGFLOW_SERVER_URL"]
flow_id = os.environ["FLOW_ID"]

response = requests.post(
    base + "/api/v1/run/" + flow_id,
    headers={"x-api-key": os.environ["LANGFLOW_API_KEY"]},
    json={
        "input_value": "Hello!",
        "input_type": "chat",
        "output_type": "chat",
        "session_id": "user-1",
    },
    timeout=60,
)
response.raise_for_status()
print(response.json())

Step 6: Useful environment settings

Set these when running in a container or on a server. Always disable auto-login and set a strong password and secret key for anything reachable by other people.

LANGFLOW_HOST=0.0.0.0
LANGFLOW_PORT=7860
LANGFLOW_AUTO_LOGIN=False
LANGFLOW_SUPERUSER=admin
LANGFLOW_SUPERUSER_PASSWORD=use-a-long-random-password
LANGFLOW_SECRET_KEY=generate-a-random-secret
LANGFLOW_COMPONENTS_PATH=/app/custom_components
LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=MY_SERVICE_TOKEN

Step 7: A custom component skeleton

A component extends Component, declares inputs and outputs, and implements the output method. Avoid input names that clash with Component methods such as run or log. Confirm the imports in a built-in component's Code view for your version.

from lfx.custom.custom_component.component import Component
from lfx.io import StrInput, Output
from lfx.schema.message import Message


class WordCounter(Component):
    display_name = "Word Counter"
    description = "Counts the words in a piece of text."
    name = "word_counter"

    inputs = [StrInput(name="text_to_count", display_name="Text")]
    outputs = [Output(name="count", display_name="Word Count", method="count_words")]

    def count_words(self) -> Message:
        words = len(self.text_to_count.split())
        return Message(text=str(words))

FAQs

Is it safe to expose Langflow to the internet?
Only with authentication enabled and a strong superuser password and secret key, and ideally behind HTTPS. Custom components run Python on the server, so restrict who can create them.

Summary

Run Langflow with uv or Docker on port 7860, build with Chat Input, Prompt or Agent, Language Model, and Chat Output, call flows with POST /api/v1/run and an x-api-key header, and secure your server settings.

Related tutorials

Comments

Log in or create a free account to join the discussion.

  • No comments yet. Be the first to comment.