Guidelines

Assynchronous Processing

Asynchronous Processing

Introduction

Starting from version 0.5, Langflow introduces a new feature to its API: the sync flag. This flag allows users to opt for asynchronous processing of their flows, freeing up resources and enabling better control over long-running tasks. This feature supports running tasks in a Celery worker queue and AnyIO task groups for now.

DANGER

This is an experimental feature. The default behavior of the API is still synchronous processing. The API may change in the future.

The sync Flag

The sync flag can be included in the payload of your POST request to the /api/v1/process/<your_flow_id> endpoint. When set to false, the API will initiate an asynchronous task instead of processing the flow synchronously.

API Request with sync flag

curl -X POST \
  http://localhost:3000/api/v1/process/<your_flow_id> \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: <your_api_key>' \
  -d '{"inputs": {"text": ""}, "tweaks": {}, "sync": false}'

response:

{
  "result": {
    "output": "..."
  },
  "task": {
    "id": "...",
    "href": "api/v1/task/<task_id>"
  },
  "session_id": "...",
  "backend": "..."

Checking Task Status

You can check the status of an asynchronous task by making a GET request to the /task/{task_id} endpoint.

curl -X GET \
  http://localhost:3000/api/v1/task/<task_id> \
  -H 'x-api-key: <your_api_key>'

Response

The endpoint will return the current status of the task and, if completed, the result of the task. Possible statuses include:

  • PENDING: The task is waiting for execution.

  • SUCCESS: The task has completed successfully.

  • FAILURE: The task has failed.

Example response for a completed task:

{
  "status": "SUCCESS",
  "result": {
    "output": "..."

Getting Started

👋 Welcome to Langflow
📦 How to install?
🤗 HuggingFace Spaces
🎨 Creating Flows

Guidelines

Sign up and Sign in
API Keys
Assynchronous Processing
Component
Features
Collection
Prompt Customization
Chat Interface
Chat Widget
Custom Components

Step-by-Step Guides

Async API
Integrating documents with prompt variables
Building chatbots with System Message
Integrating Langfuse with Langflow

Examples

FlowRunner Component
Conversation Chain
Buffer Memory
MidJourney Prompt Chain
CSV Loader
Serp API Tool
Multiple Vector Stores
Python Function
📚 How to Upload Examples?

Deployment

Deploy on Google Cloud Platform

Contributing

How to contribute?
GitHub Issues
Community

Search Docs…

Search Docs…