Flows
Flows in Langflow are fully serializable and can be saved and loaded from the file system. In this guide, we'll explore how to import and export flows.
Import Flow
If you've already got a Langflow JSON file, import it into Langflow by clicking on the project name and choosing Import Flow.
Once imported, your flow is ready to use.
You can drag and drop Langflow JSON files directly from your file system into the Langflow window to import a flow, even into the initial Langflow splash screen.
Export Flow
The option to export a flow is available in the same menu as shown above. Once exported as JSON, you can import your flow into another Langflow instance.
Langflow JSON file contents
Langflow JSON files contain nodes and edges that describe components and connections, and additional metadata that describe the flow.
For an example Langflow JSON file, examine the Basic Prompting.json file in the Langflow repository.
Nodes
Nodes represent the components that make up the flow.
The ChatInput
node is the entry point of the flow. It's the first node that will be executed.
ChatInput-jFwUm
is a unique identifier for the node.
_35{_35 "data": {_35 "description": "Get chat inputs from the Playground.",_35 "display_name": "Chat Input",_35 "id": "ChatInput-jFwUm",_35 "node": {_35 "base_classes": ["Message"],_35 "description": "Get chat inputs from the Playground.",_35 "display_name": "Chat Input",_35 "icon": "MessagesSquare",_35 "template": {_35 "input_value": {_35 "display_name": "Text",_35 "info": "Message to be passed as input.",_35 "value": "Hello"_35 },_35 "sender": {_35 "value": "User",_35 "options": ["Machine", "User"]_35 },_35 "sender_name": {_35 "value": "User"_35 },_35 "should_store_message": {_35 "value": true_35 }_35 }_35 },_35 "type": "ChatInput"_35 },_35 "position": {_35 "x": 689.5720422421635,_35 "y": 765.155834131403_35 }_35}
Edges
Edges represent the connections between nodes.
The connection between the ChatInput
node and the OpenAIModel
node is represented as an edge:
_22{_22 "className": "",_22 "data": {_22 "sourceHandle": {_22 "dataType": "ChatInput",_22 "id": "ChatInput-jFwUm",_22 "name": "message",_22 "output_types": ["Message"]_22 },_22 "targetHandle": {_22 "fieldName": "input_value",_22 "id": "OpenAIModel-OcXkl",_22 "inputTypes": ["Message"],_22 "type": "str"_22 }_22 },_22 "id": "reactflow__edge-ChatInput-jFwUm{œdataTypeœ:œChatInputœ,œidœ:œChatInput-jFwUmœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-OpenAIModel-OcXkl{œfieldNameœ:œinput_valueœ,œidœ:œOpenAIModel-OcXklœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",_22 "source": "ChatInput-jFwUm",_22 "sourceHandle": "{œdataTypeœ: œChatInputœ, œidœ: œChatInput-jFwUmœ, œnameœ: œmessageœ, œoutput_typesœ: [œMessageœ]}",_22 "target": "OpenAIModel-OcXkl",_22 "targetHandle": "{œfieldNameœ: œinput_valueœ, œidœ: œOpenAIModel-OcXklœ, œinputTypesœ: [œMessageœ], œtypeœ: œstrœ}"_22}
This edge shows that the ChatInput
component outputs a Message
type to the target
node, which is the OpenAIModel
node.
The OpenAIModel
component accepts the Message
type at the input_value
field.
Additional metadata and project information
Additional information about the flow is stored in the root data
object.
- Metadata and project information including the name, description, and
last_tested_version
of the flow.
_10{_10 "name": "Basic Prompting",_10 "description": "Perform basic prompting with an OpenAI model.",_10 "tags": ["chatbots"],_10 "id": "1511c230-d446-43a7-bfc3-539e69ce05b8",_10 "last_tested_version": "1.0.19.post2",_10 "gradient": "2",_10 "icon": "Braces"_10}
- Visual information about the flow defining the initial position of the flow in the workspace.
_10"viewport": {_10 "x": -37.61270157375441,_10 "y": -155.91266341888854,_10 "zoom": 0.7575251406952855_10}
Notes are like comments to help you understand the flow within the workspace.
They may contain links, code snippets, and other information.
Notes are written in Markdown and stored as node
objects.
_10{_10 "id": "undefined-kVLkG",_10 "node": {_10 "description": "## 📖 README\nPerform basic prompting with an OpenAI model.\n\n#### Quick Start\n- Add your **OpenAI API key** to the **OpenAI Model**\n- Open the **Playground** to chat with your bot.\n..."_10 }_10}