Skip to main content

Langflow components overview

A component is a single building block within a flow with inputs, outputs, functions, and parameters that define its functionality. A single component is like a class within a larger application.

To add a component to a flow, drag it from the Component menu to the Workspace.

Learn more about components and how they work on this page.

Component menu

Each component is unique, but all have a menu bar at the top that looks something like the following:

Open AI component

Use the component controls to do the following:

  • Code — Modify the component's Python code and save your changes.
  • Controls — Adjust all component parameters.
  • Freeze Path — After a component runs, lock its previous output state to prevent it from re-running.

Click  All to see additional options for a component.

To view a component’s output and logs, click the Visibility icon.

To run a single component, click Play.

A Checkmark indicates that the component ran successfully.

Running a single component with the Play button is different from running the entire flow. In a single component run, the build_vertex function is called, which builds and runs only the single component with direct inputs provided through the UI (the inputs_dict parameter). The VertexBuildResult data is passed to the build_and_run method, which calls the component's build method and runs it. Unlike running the full flow, running a single component does not automatically execute its upstream dependencies.

Component ports

Handles () on the side of a component indicate the types of inputs and outputs that can be connected at that port. Hover over a handle to see connection details.

Prompt component

Component port data type colors

The following table lists the handle colors and their corresponding data types:

Data typeHandle colorHex code
BaseLanguageModelFuchsia#c026d3
DataRed#dc2626
DocumentLime#65a30d
EmbeddingsEmerald#10b981
LanguageModelFuchsia#c026d3
MessageIndigo#4f46e5
PromptViolet#7c3aed
strIndigo#4F46E5
TextIndigo#4F46E5
unknownGray#9CA3AF

Component code

A component inherits from a base Component class that defines its interface and behavior.

For example, the Recursive character text splitter is a child of the LCTextSplitterComponent class.


_58
from typing import Any
_58
_58
from langchain_text_splitters import RecursiveCharacterTextSplitter, TextSplitter
_58
_58
from langflow.base.textsplitters.model import LCTextSplitterComponent
_58
from langflow.inputs.inputs import DataInput, IntInput, MessageTextInput
_58
from langflow.utils.util import unescape_string
_58
_58
class RecursiveCharacterTextSplitterComponent(LCTextSplitterComponent):
_58
display_name: str = "Recursive Character Text Splitter"
_58
description: str = "Split text trying to keep all related text together."
_58
documentation: str = "https://docs.langflow.org/components-processing"
_58
name = "RecursiveCharacterTextSplitter"
_58
icon = "LangChain"
_58
_58
inputs = [
_58
IntInput(
_58
name="chunk_size",
_58
display_name="Chunk Size",
_58
info="The maximum length of each chunk.",
_58
value=1000,
_58
),
_58
IntInput(
_58
name="chunk_overlap",
_58
display_name="Chunk Overlap",
_58
info="The amount of overlap between chunks.",
_58
value=200,
_58
),
_58
DataInput(
_58
name="data_input",
_58
display_name="Input",
_58
info="The texts to split.",
_58
input_types=["Document", "Data"],
_58
),
_58
MessageTextInput(
_58
name="separators",
_58
display_name="Separators",
_58
info='The characters to split on.\nIf left empty defaults to ["\\n\\n", "\\n", " ", ""].',
_58
is_list=True,
_58
),
_58
]
_58
_58
def get_data_input(self) -> Any:
_58
return self.data_input
_58
_58
def build_text_splitter(self) -> TextSplitter:
_58
if not self.separators:
_58
separators: list[str] | None = None
_58
else:
_58
# check if the separators list has escaped characters
_58
# if there are escaped characters, unescape them
_58
separators = [unescape_string(x) for x in self.separators]
_58
_58
return RecursiveCharacterTextSplitter(
_58
separators=separators,
_58
chunk_size=self.chunk_size,
_58
chunk_overlap=self.chunk_overlap,
_58
)

Components include definitions for inputs and outputs, which are represented in the UI with color-coded ports.

Input Definition: Each input (like IntInput or DataInput) specifies an input's type, name, and display properties, which appear as configurable fields in the component's UI panel.

Methods: Components have methods or functions that handle their functionality. This component has two methods. get_data_input retrieves the text data to be split from the component's input. This makes the data available to the class. build_text_splitter creates a RecursiveCharacterTextSplitter object by calling its parent class's build method. The text is split with the created splitter and passed to the next component. When used in a flow, this component:

  1. Displays its configuration options in the UI.
  2. Validates user inputs based on the input types.
  3. Processes data using the configured parameters.
  4. Passes results to the next component.

Freeze path

After a component runs, Freeze Path locks the component's previous output state to prevent it from re-running.

If you’re expecting consistent output from a component and don’t need to re-run it, click Freeze Path.

Enabling Freeze Path freezes all components upstream of the selected component.

If you only want to freeze a single component, select Freeze instead.

A icon appears on all frozen components.

Additional component options

Click  All to see additional options for a component.

To modify a component's name or description, double-click in the Name or Description fields. Component descriptions accept Markdown syntax.

Component shortcuts

The following keyboard shortcuts are available when a component is selected.

Menu itemWindows shortcutMac shortcutDescription
CodeSpaceSpaceOpens the code editor for the component.
Advanced SettingsCtrl + Shift + A⌘ + Shift + AOpens advanced settings for the component.
Save ChangesCtrl + S⌘ + SSaves changes to the current flow.
Save ComponentCtrl + Alt + S⌘ + Alt + SSaves the current component to Saved components.
DuplicateCtrl + D⌘ + DCreates a duplicate of the component.
CopyCtrl + C⌘ + CCopies the selected component.
CutCtrl + X⌘ + XCuts the selected component.
PasteCtrl + V⌘ + VPastes the copied/cut component.
DocsCtrl + Shift + D⌘ + Shift + DOpens related documentation.
MinimizeCtrl + .⌘ + .Minimizes the current component.
FreezeCtrl + F⌘ + FFreezes the current component state.
Freeze PathCtrl + Shift + F⌘ + Shift + FFreezes component state and upstream components.
DownloadCtrl + J⌘ + JDownloads the component as JSON.
DeleteBackspaceBackspaceDeletes the component.
GroupCtrl + G⌘ + GGroups selected components.
UndoCtrl + Z⌘ + ZUndoes the last action.
RedoCtrl + Y⌘ + YRedoes the last undone action.
Redo (alternative)Ctrl + Shift + Z⌘ + Shift + ZAlternative shortcut for redo.
Share ComponentCtrl + Shift + S⌘ + Shift + SShares the component.
Share FlowCtrl + Shift + B⌘ + Shift + BShares the entire flow.
Toggle SidebarCtrl + B⌘ + BShows/hides the sidebar.
Search Components//Focuses the component search bar.
Tool ModeCtrl + Shift + M⌘ + Shift + MToggles tool mode.
UpdateCtrl + U⌘ + UUpdates the component.
Open PlaygroundCtrl + K⌘ + KOpens the playground.
Output InspectionOOOpens output inspection.
PlayPPPlays/executes the flow.
APIRROpens the API view.

Group components in the workspace

Multiple components can be grouped into a single component for reuse. This is useful when combining large flows into single components, for example RAG with a vector database, and saving space.

  1. Hold Shift and drag to select components.
  2. Select Group. The components merge into a single component.
  3. Double-click the name and description to change them.
  4. Save your grouped component to the sidebar for later use.

Component version

A component's initial state is stored in a database. As soon as you drag a component from the sidebar to the workspace, the two components are no longer in parity.

A component keeps the version number it is initialized to the workspace with. If a component is at version 1.0 when it is dragged to the workspace, it will stay at version 1.0 until you update it.

Langflow notifies you when a component's workspace version is behind the database version and an update is available. Click the Update Component icon to update the component to the latest version. This will change the code of the component in place so you can validate that the component was updated by checking its Python code before and after updating it.

Components sidebar

Components are listed in the sidebar by component type.

Component bundles are components grouped by provider. For example, Langchain modules like RunnableExecutor and CharacterTextSplitter are grouped under the Langchain bundle.

The sidebar includes a component Search bar, and includes flags for showing or hiding Beta and Legacy components.

Beta components are still being tested and are not suitable for production workloads.

Legacy components are available to use but no longer supported.

Hi, how can I help you?