Back to Langflow

About LFX

docs/docs/Lfx/lfx-overview.mdx

1.11.03.6 KB
Original Source

import Icon from "@site/src/components/icon";

LFX (Langflow Executor) is a lightweight CLI and Python library for running Langflow flows without the full Langflow application.

Flows are built in the Langflow visual builder, and then the flow JSON files are run with LFX. LFX executes flows statelessly from JSON files with minimal dependencies, no database, and no UI.

LFX is similar to running Langflow with --backend-only, but even more lightweight because the full Langflow package and its dependencies do not need to be installed.

If you're building flows in Langflow with a uv pip install langflow installation, you likely don't need to explore LFX, but if you're deploying and running flows from JSON files using other applications or environments, you'll find LFX is a powerful tool for executing flows.

If you have installed Langflow OSS version 1.6 or later, lfx is already included in your environment.

How LFX differs from Langflow

In Langflow, you build and test flows in the visual builder, and the full application stores flows, messages, and users in a database. The same Langflow server already uses LFX as its flow runtime. Installing LFX on its own decouples the runtime from the Langflow UI and database. lfx run executes a flow once from the command line and prints the result, and lfx serve exposes one or more flows as persistent HTTP endpoints. You still author flows in the Langflow visual builder, and export the flows as JSON files. Standalone LFX is for executing flow JSON files without starting the Langflow server or opening the visual editor.

Under the hood, LFX uses a no-op database interface (NoopSession) instead of a real database. There is no langflow.db file, and stateful operations such as saving flows, storing messages, and managing users do not persist. Operations that depend on langflow.db will not work as they do in the full Langflow application.

LFX commands

LFX provides two sets of commands:

Runtime commands, to run and serve flows locally:

CommandDescription
lfx serveServe one or more flows as FastAPI endpoints at /flows/{flow_id}/run
lfx runExecute a flow locally and stream results to stdout
lfx-mcpStart an MCP server that connects to a running Langflow instance

For the LFX runtime commands, see Run flows with LFX and Serve flows with LFX.

Flow DevOps SDK commands, to version, test, and deploy flows:

CommandDescription
lfx initScaffold a versioned flow project with CI templates
lfx loginValidate credentials against a remote Langflow instance
lfx createCreate a new flow JSON from a built-in or custom template
lfx validateValidate flow JSON before pushing
lfx requirementsGenerate requirements.txt from a flow's component dependencies
lfx statusCompare local flow files against a remote Langflow instance
lfx pushPush flows to a remote instance by stable ID
lfx pullPull flows from a remote instance to local files
lfx exportNormalize flow JSON for clean git diffs

For the Flow DevOps SDK commands, see Flow DevOps Toolkit SDK.

See also