Stream a run
The run's events as server-sent events, as they happen: an id: line and a data: line of JSON with its type for each, closing after done. A pause keeps the stream open until the run is answered. If the connection drops, reconnect with the last id: you saw as Last-Event-ID, or as after, and it picks up where it left off.
The events are the Orchestrations API's, plus worker_picked_up when a worker takes the run. Read it with fetch and the Authorization header; a browser EventSource cannot send the header, and a key in the URL is refused.
apiKeyAuthorizationBearer <token>An API key, sk-syn- and 32 characters. On SynapseOrch Cloud an owner or admin makes it under Settings → Developer; on a self-hosted install, under Settings → API Keys.
run_id*stringThe run, from the start's answer.
after?|An event id to start after.
Last-Event-ID?|The last event id you saw, to pick up where a dropped connection left off.
A stream of server-sent events.
response?stringtext/event-streamcurl -X GET "https://api.synapseorch.com/api/v2/orchestrations/runs/run_01a10a1553d57036bae3d17421a4ba16/stream" \ -H "Authorization: Bearer sk-syn-..."id: 1790249607455-0data: {"type": "worker_picked_up", "worker_id": "w-1bac81fcfb63-35985d6e", "run_id": "run_01a111a910667216b459f4b6e770eec6"}id: 1790249607461-0data: {"type": "orchestration_start", "run_id": "run_01a111a910667216b459f4b6e770eec6", "orchestration_id": "orch_01a1115b16d5706bab9f274f1b7646c0", "orchestration_name": "Echo"}id: 1790249607470-0data: {"type": "step_start", "orch_step_id": "p", "step_name": "P", "step_type": "print"}id: 1790249607482-0data: {"type": "step_complete", "orch_step_id": "p", "step_name": "P", "duration_seconds": 0.01}id: 1790249607490-0data: {"type": "orchestration_complete", "run_id": "run_01a111a910667216b459f4b6e770eec6", "status": "completed", "final_state": {"n": 9, "echo": "n=9"}}id: 1790249607491-0data: {"type": "final", "response": "n=9", "intent": "orchestration", "data": {"run_id": "run_01a111a910667216b459f4b6e770eec6", "status": "completed"}}id: 1790249607492-0data: {"type": "done"}