POST
/
embed
/
api
/
workflows
/
{workflowName}
/
run
/
stream
公开入口流式运行 workflow
curl --request POST \
  --url https://wfapi.yuhe.space/embed/api/workflows/{workflowName}/run/stream \
  --header 'Content-Type: application/json' \
  --header 'x-workflow-embed-token: <api-key>' \
  --data '
{
  "token": "wfembed_xxx",
  "inputs": {
    "message": "hello"
  },
  "conversation_id": "browser-thread",
  "user": "visitor-1",
  "toolPermissionPolicies": {
    "search": {
      "enabled": true,
      "autoApprove": false
    }
  }
}
'
"{\"type\":\"workflow_started\",\"runId\":\"20260513-abc\",\"workflowName\":\"smoke\",\"startedAt\":\"2026-05-26T00:00:00.000Z\"}\n{\"type\":\"timer_started\",\"runId\":\"20260513-abc\",\"workflowName\":\"smoke\",\"timer\":{\"errCode\":0,\"errMessage\":\"\",\"timerId\":\"api-call\",\"title\":\"外部接口调用\",\"startedAt\":\"2026-05-26T00:00:00.100Z\",\"status\":\"running\"}}\n{\"type\":\"node_chunk\",\"runId\":\"20260513-abc\",\"workflowName\":\"smoke\",\"executionId\":\"exec-output\",\"nodeName\":\"output\",\"kind\":\"stream-node\",\"chunk\":\"hello\",\"chunkOrder\":1,\"timestamp\":\"2026-05-26T00:00:00.500Z\"}\n{\"type\":\"node_chunk\",\"runId\":\"20260513-abc\",\"workflowName\":\"smoke\",\"executionId\":\"exec-output\",\"nodeName\":\"output\",\"kind\":\"stream-node\",\"chunk\":{\"type\":\"output_item_delta\",\"itemId\":\"tool-result\",\"delta\":{\"ok\":true}},\"chunkOrder\":2,\"timestamp\":\"2026-05-26T00:00:00.600Z\"}\n{\"type\":\"timer_finished\",\"runId\":\"20260513-abc\",\"workflowName\":\"smoke\",\"timer\":{\"errCode\":0,\"errMessage\":\"\",\"timerId\":\"api-call\",\"title\":\"外部接口调用\",\"startedAt\":\"2026-05-26T00:00:00.100Z\",\"status\":\"success\",\"endedAt\":\"2026-05-26T00:00:01.000Z\",\"durationMs\":900}}\n{\"type\":\"run_result\",\"data\":{\"runId\":\"20260513-abc\",\"status\":\"success\"}}\n"

Authorizations

x-workflow-embed-token
string
header
required

Embed token;也可通过 query/body 的 token 传入。

Path Parameters

workflowName
string
required

Body

application/json
token
string
required
inputs
object
args
string[]
conversation_id
string
user
string
toolPermissionPolicies
object
Example:
{
"search": { "enabled": true, "autoApprove": false }
}

Response

200 - application/x-ndjson

NDJSON 流,每行是 runtime event、run_result 或 error;runtime event 包含 timer_started / timer_finished,用于展示业务计时卡片。

The response is of type string.