Refa: follow-up expose agent structured outputs in non-stream completions (#13524)

### What problem does this PR solve?

Follow-up expose agent structured outputs in non-stream completions
#13389.

### Type of change

- [x] Documentation Update
- [x] Refactoring

---------

Co-authored-by: writinwaters <cai.keith@gmail.com>
This commit is contained in:
Yongteng Lei
2026-03-17 17:11:27 +08:00
committed by GitHub
parent ca182dc188
commit ca6c3218c3
3 changed files with 48 additions and 12 deletions

View File

@ -3914,16 +3914,16 @@ Asks a specified agent a question to start an AI-powered conversation.
- `"session_id"`: `string` (optional)
- `"inputs"`: `object` (optional)
- `"user_id"`: `string` (optional)
- `"return_trace"`: `boolean` (optional, default `false`) — include execution trace logs.
- `"return_trace"`: `boolean` (optional, default `false`) — whether to include execution trace logs. See the `node_finished` event.
- `"release"`: `boolean` (optional, default `false`) - whether to visit the latest published canvas.
#### Streaming events to handle
When `stream=true`, the server sends Server-Sent Events (SSE). Clients should handle these `event` types:
When `stream=true`, the server sends Server-Sent Events (SSE). A client should handle these events:
- `message`: streaming content from Message components.
- `message_end`: end of a Message component; may include `reference`/`attachment`.
- `node_finished`: a component finishes; `data.inputs/outputs/error/elapsed_time` describe the node result. If `return_trace=true`, the trace is attached inside the same `node_finished` event (`data.trace`).
- `message`: Streaming content from the **Message** components.
- `message_end`: End of a **Message** component, which may include `reference`/`attachment`.
- `node_finished`: A component finishes; `data.inputs/outputs/error/elapsed_time` describes the node result. If a component produces structured output, read it from that component's `data.outputs.structured`. If `return_trace=true`, the trace is attached inside the same `node_finished` event (`data.trace`).
The stream terminates with `[DONE]`.
@ -4203,6 +4203,8 @@ When `extra_body.reference_metadata.include` is `true`, each reference chunk may
Non-stream:
If one or more components produce structured output, ensure you set `return_trace=true` and check each component's structured output via `trace`. The top-level `data.structured` field is a shortcut aggregated by `component_id`.
```json
{
"code": 0,