-
-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Description
Describe the bug
Streaming is inconsistently broken on the /prediction/{id} endpoint. Typically, Flowise will stream "event" => "metadata", "event" => "agentFlowEvent", "event" => "token" events, and a final {"data" => "[DONE]", "event" => "end"} indicating the response is complete.
Intermittently, Flowise returns only the metadata and the {"data" => "[DONE]", "event" => "end"} events. No content is streamed back. The agent's response does exist in the https://cloud.flowiseai.com/v2/agentcanvas/{id} View Messages modal.
Request:
curl -L \
--request POST \
--url 'https://cloud.flowiseai.com/api/v1/prediction/{flow id}' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"question": "hello",
"streaming": true
}'
Bugged Response:
message:
data:{"event":"metadata","data":{"chatId":"redacted","chatMessageId":"redacted","question":"hello","sessionId":"cfaf8d8d-0079-4d90-8299-857006742201"}}
message
data:{"event":"end","data":"[DONE]"}
Screenshot from the View Messages modal. The agent did respond, but the API did not return the content of the agent's response.
To Reproduce
curl -L \
--request POST \
--url 'https://cloud.flowiseai.com/api/v1/prediction/{flow id}' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"question": "hello",
"streaming": true
}'
- create an agent flow
- make a post request with any question and
streaming: true - repeat until you experience the bug
Expected behavior
Flowise should respond with the content of the agent's response. Below is the expected streamed response.
curl -L \
--request POST \
--url 'https://cloud.flowiseai.com/api/v1/prediction/{flow id}' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"question": "hello",
"streaming": true
}'
message:
data:{"event":"agentFlowEvent","data":"INPROGRESS"}
message:
data:{"event":"nextAgentFlow","data":{"nodeId":"startAgentflow_0","nodeLabel":"Start","status":"INPROGRESS"}}
...
message:
data:{"event":"token","data":""}
message:
data:{"event":"token","data":""}
message:
data:{"event":"token","data":"#"}
message:
data:{"event":"token","data":" Hello\n\nHello"}
message:
data:{"event":"token","data":", a"}
message:
data:{"event":"token","data":" wor"}
message:
data:{"event":"token","data":"d that"}
message:
data:{"event":"token","data":" opens"}
message:
data:{"event":"token","data":" doors and bridges"}
message:
data:{"event":"token","data":" distant"}
message:
data:{"event":"token","data":" souls"}
message:
data:{"event":"token","data":" with"}
...
message:
data:{"event":"agentFlowEvent","data":"FINISHED"}
message:
data:{"event":"metadata","data":{"chatId": redacted, "chatMessageId": redacted,"question":"hello","sessionId": redacted}}
message
data:{"event":"end","data":"[DONE]"}
Screenshots
No response
Flow
No response
Use Method
Flowise Cloud
Flowise Version
No response
Operating System
None
Browser
None
Additional context
No response