Langflow 1.10 just released!
gradient
  1. Home  /

  2. Blog  /

  3. Langflow Micro Tutorials — Transform Chain

Langflow Micro Tutorials — Transform Chain

Rodrigo Nader

Written by Rodrigo Nader

October 22, 2023

Welcome back to our Langflow micro tutorials series! In this article, we’ll continue exploring simple Langflow examples and the design of custom components.

You can download the flow mentioned in this article to modify and understand the components used.

Today, we’ll focus on reproducing a Langchain Transform Chain in Langflow. Hope you enjoy it!

Main Features

Transform Chain: A custom component with a special method called perform_action. This method allows for customization of its logic to meet specific requirements before being converted into a chain.

Objective

In Langchain, a Transform Chain is designed to modify input data before sending it to another chain. It uses input and output variables that are transformed by a function (hereby called perform_action).

This function takes a dictionary of input variables and returns a dictionary of output variables, allowing for arbitrary Python code to change the inputs. Transform Chains are useful for tasks like segmenting long text, translating language, or extracting metadata. More information is available here.

The goal is to bring this Transform Chain feature into Langflow, converting any Python function into a chain type. This allows us to utilize all the chain-related functionalities Langflow offers. For example, they can be used as input to the CombineDocs Chain or Sequential Chains and can work with prompt templates or even open up the chat interface.

To use it, just open the code of the custom component and play around with the perform_action method.

In this case, we're simplifying it and passing a single input variable to the perform_action, but the logic applied in lines 16-19 makes it so that any argument supplied to the build function automatically becomes a part of the class with self — meaning you can add new parameters to the build function and access them within perform_action. The foo argument serves as an example of this.

Once the chat interface is activated, just interact with your function as if it’s a chain.

Notice that this opens up possibilities for including diverse fields in the component. For example, foo could be set as a Document instead of a string, allowing it to accept outputs from other components.


Download Flow (gist)


Similar Posts

Langflow 1.10 released: Assistant flow building, Memory bases, DB Providers, internationalization, and more

Langflow 1.10 released: Assistant flow building, Memory bases, DB Providers, internationalization, and more

Langflow Dev Team

Written by Langflow Dev Team

June 9, 2026

Langflow 1.10 expands Langflow Assistant to build entire flows, introduces Memory bases for long-term semantic memory, adds configurable vector database backends, brings the interface to seven languages, and more.

Scaling Langflow: Unlocking Massive Memory Savings and Bulletproof Reliability

Scaling Langflow: Unlocking Massive Memory Savings and Bulletproof Reliability

Langflow Dev Team

Written by Langflow Dev Team

June 9, 2026

The Langflow engineering team breaks down a comprehensive package of memory and stability enhancements spanning v1.9.0 through v1.10.0—achieving an ~89% reduction in memory consumption through dependency pruning, worker lifecycle management, and advanced Linux Copy-on-Write techniques.

Langflow Policies: Turning Natural-Language Rules into Guarded Tools

Langflow Policies: Turning Natural-Language Rules into Guarded Tools

Langflow Dev Team

Written by Langflow Dev Team

May 20, 2026

Langflow's new Policies feature compiles natural-language business rules into deterministic guards around agent tools—so policy violations are caught before they happen, not after.

Langflow 1.9 Desktop is now available

Langflow 1.9 Desktop is now available

Langflow Dev Team

Written by Langflow Dev Team

April 24, 2026

Langflow 1.9 Desktop is now available. For the full list of new features and platform updates in 1.9, see the OSS release announcement.