Langflow Extension quickstart
Build, validate, and run a Langflow Extension bundle to create a single-component extension you can pip-install or load using lfx extension dev.
Prerequisites
- Python 3.11 or greater
langflowinstalled withuv pip install langflow. ThelfxCLI provides every command in this guide. For more information, see Install the Langflow OSS package.
Create an extension
-
Scaffold a new extension:
_10lfx extension init my-extension_10cd my-extensionThis creates the canonical layout the loader expects:
_11my-extension/_11├── extension.json # the v0 manifest_11├── pyproject.toml # so the bundle is pip-installable_11└── src/_11└── lfx_my_extension/_11├── __init__.py_11├── extension.json # symlink/copy used by importlib at runtime_11└── components/_11└── my_bundle/_11├── __init__.py_11└── my_component.pyFor more information, see Manifest reference.
-
To edit the component, open
src/lfx_my_extension/components/my_bundle/my_component.py. The scaffold ships a workingComponentsubclass that prints"Hello, {name}!"_13from lfx.custom.custom_component.component import Component_13from lfx.io import MessageTextInput, Output_13from lfx.schema.message import Message_13_13class HelloComponent(Component):_13display_name = "Hello"_13description = "Greets the caller."_13_13inputs = [MessageTextInput(name="who", display_name="Who?", value="world")]_13outputs = [Output(display_name="Greeting", name="greeting", method="build_message")]_13_13def build_message(self) -> Message:_13return Message(text=f"Hello, {self.who}!")The full surface available to bundle code is enumerated in
BUNDLE_API.md. Anything outside ofBUNDLE_API.mdis not part of the API contract, and may move or break between releases. -
Before launching Langflow, run the static extension checker.
_10lfx extension validate .The validator parses the manifest and reports typed errors. It does not execute imports by default, so it is safe to run against an extension you just downloaded. Use
--execute-importsonly when you trust the source — it runs the import probe in a subprocess. -
Run Langflow with the extension loaded.
_10lfx extension dev .This launches a Langflow dev server with
my-extensionregistered at the@officialslot. The Hello component appears in the Langflow UI component list under the bundle name inextension.json.To see what the loader picked up:
_10lfx extension list --format json -
Iterate with reload. Edit the component, save, then click the Reload action in the palette's bundle header (or run
lfx extension reload --bundle my_bundle). The atomic-swap reload pipeline replaces the component in place; in-flight flows keep the pre-swap class so a running execution is never interrupted.Reload only works in Mode A (local dev). Production deployments rebuild the Docker image.
-
Ship the extension.
Once the extension works locally, publish the package to PyPI:
_10python -m build # builds the wheel + sdist_10twine upload dist/* # publish to PyPITo install the extension into a Langflow environment with a regular
pip install:_10pip install lfx-my-extension_10langflow runDiscovery happens at server startup. The bundle appears in the palette without further configuration.