Appearance
Streaming answers
Set stream: true on POST /api/knowledge/respond to receive server-sent events while an answer is written.
bash
curl --fail-with-body --silent --show-error --no-buffer \
--header "Authorization: Bearer $LAB0_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"prompt":"How is the rollout run?","namespace":"quickstart","stream":true}' \
"$LAB0_BASE_URL/api/knowledge/respond"Upload plan.md and wait for ready using a walkthrough first. The reference has complete streaming client examples for curl, Python, TypeScript and Go under Ask a question → Code Examples.
Read the events
| Event | Meaning |
|---|---|
meta | Stream metadata, sent once at the start |
chunk | Text or a reset instruction |
tool | Document search and reading activity |
error | Answering failed; discard any text received |
done | Final result, or no answer after an error |
An SSE message ends with a blank line. Read its event: and data: fields together; lines starting with : are keep-alive comments.
Handle resets and errors
A chunk with reset: true means text sent since the last tool call was not part of the answer: discard it. Do not present interim text as a completed answer.
On error, discard the text received and surface the failure. A successful done carries the same body as the non-streamed JSON response, including answer and sources. After an error, done carries no answer.
If the connection ends without done, the response is incomplete. Do not save it as a successful answer. An HTTP error before the stream starts uses the usual JSON error response; a failure after it starts is an error event, even though the HTTP status was already 200.