Skip to content

Prediction Endpoint Streaming Intermittently Returns No Content #5592

@EanMcDonaldWojciechowski

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.

Image

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
  }'
  1. create an agent flow
  2. make a post request with any question and streaming: true
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions