Skip to main content
Version: 1.10.x

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
  • langflow installed with uv pip install langflow. The lfx CLI provides every command in this guide. For more information, see Install the Langflow OSS package.

Create an extension

  1. Scaffold a new extension:


    _10
    lfx extension init my-extension
    _10
    cd my-extension

    This creates the canonical layout the loader expects:


    _11
    my-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.py

    For more information, see Manifest reference.

  2. To edit the component, open src/lfx_my_extension/components/my_bundle/my_component.py. The scaffold ships a working Component subclass that prints "Hello, {name}!"


    _13
    from lfx.custom.custom_component.component import Component
    _13
    from lfx.io import MessageTextInput, Output
    _13
    from lfx.schema.message import Message
    _13
    _13
    class HelloComponent(Component):
    _13
    display_name = "Hello"
    _13
    description = "Greets the caller."
    _13
    _13
    inputs = [MessageTextInput(name="who", display_name="Who?", value="world")]
    _13
    outputs = [Output(display_name="Greeting", name="greeting", method="build_message")]
    _13
    _13
    def build_message(self) -> Message:
    _13
    return Message(text=f"Hello, {self.who}!")

    The full surface available to bundle code is enumerated in BUNDLE_API.md. Anything outside of BUNDLE_API.md is not part of the API contract, and may move or break between releases.

  3. Before launching Langflow, run the static extension checker.


    _10
    lfx 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-imports only when you trust the source — it runs the import probe in a subprocess.

  4. Run Langflow with the extension loaded.


    _10
    lfx extension dev .

    This launches a Langflow dev server with my-extension registered at the @official slot. The Hello component appears in the Langflow UI component list under the bundle name in extension.json.

    To see what the loader picked up:


    _10
    lfx extension list --format json

  5. 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.

  6. Ship the extension.

    Once the extension works locally, publish the package to PyPI:


    _10
    python -m build # builds the wheel + sdist
    _10
    twine upload dist/* # publish to PyPI

    To install the extension into a Langflow environment with a regular pip install:


    _10
    pip install lfx-my-extension
    _10
    langflow run

    Discovery happens at server startup. The bundle appears in the palette without further configuration.

See also

Search