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
response:
Checking Task Status
You can check the status of an asynchronous task by making a GET request to the /task/{task_id}
endpoint.
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: