Skip to main content

Logic components in Langflow

Logic components provide functionalities for routing, conditional processing, and flow management.

Conditional router​

This component routes an input message to a corresponding output based on text comparison.

The ConditionalRouterComponent routes messages based on text comparison. It evaluates a condition by comparing two text inputs using a specified operator and routes the message accordingly.

Inputs​

NameTypeDescription
input_textStringThe primary text input for the operation.
match_textStringThe text input to compare against.
operatorDropdownThe operator to apply for comparing the texts.
case_sensitiveBooleanIf true, the comparison will be case sensitive.
messageMessageThe message to pass through either route.
max_iterationsIntegerThe maximum number of iterations for the conditional router.
default_routeDropdownThe default route to take when max iterations are reached.

Outputs​

NameTypeDescription
true_resultMessageThe output when the condition is true.
false_resultMessageThe output when the condition is false.

Data conditional router​

This component routes Data objects based on a condition applied to a specified key, including boolean validation.

This component is particularly useful in workflows that require conditional routing of complex data structures, enabling dynamic decision-making based on data content.

Inputs​

NameTypeDescription
data_inputDataThe data object or list of data objects to process.
key_nameStringThe name of the key in the data object to check.
operatorDropdownThe operator to apply for comparing the values.
compare_valueStringThe value to compare against (not used for boolean validator).

Outputs​

NameTypeDescription
true_outputData/ListOutput when the condition is met.
false_outputData/ListOutput when the condition is not met.

Flow as Tool​

This component constructs a tool from a function that runs a loaded flow.

Inputs​

NameTypeDescription
flow_nameDropdownThe name of the flow to run.
tool_nameStringThe name of the tool.
tool_descriptionStringThe description of the tool.
return_directBooleanIf true, returns the result directly from the tool.

Outputs​

NameTypeDescription
api_build_toolToolThe constructed tool from the flow.

Listen​

This component listens for a notification and retrieves its associated state.

Inputs​

NameTypeDescription
nameStringThe name of the notification to listen for.

Outputs​

NameTypeDescription
outputDataThe state associated with the notification.

Notify​

This component generates a notification for the Listen component to use.

Inputs​

NameTypeDescription
nameStringThe name of the notification.
dataDataThe data to store in the notification.
appendBooleanIf true, the record will be appended to the existing notification.

Outputs​

NameTypeDescription
outputDataThe data stored in the notification.

Run flow​

This component allows you to run a specified flow with given inputs and tweaks.

The RunFlowComponent executes a specified flow within a larger workflow. It provides the ability to run a flow with custom inputs and apply tweaks to modify its behavior.

Inputs​

NameTypeDescription
input_valueStringThe input value for the flow to process.
flow_nameDropdownThe name of the flow to run.
tweaksNested DictTweaks to apply to the flow.

Outputs​

NameTypeDescription
run_outputsList[Data]The results generated from running the flow.

Sub Flow​

This SubFlowComponent generates a component from a flow with all of its inputs and outputs.

This component can integrate entire flows as components within a larger workflow. It dynamically generates inputs based on the selected flow and executes the flow with provided parameters.

Inputs​

NameTypeDescription
flow_nameDropdownThe name of the flow to run.

Outputs​

NameTypeDescription
flow_outputsList[Data]The outputs generated from the flow.

Hi, how can I help you?