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

@@ -597,11 +597,12 @@ async def agent_completions(tenant_id, agent_id):
reference.update(ans["data"]["reference"])
if ans.get("event") == "node_finished":
node_out = ans.get("data", {}).get("outputs", {})
if node_out.get("structured"):
structured_output = node_out["structured"]
data = ans.get("data", {})
node_out = data.get("outputs", {})
component_id = data.get("component_id")
if component_id is not None and "structured" in node_out:
structured_output[component_id] = copy.deepcopy(node_out["structured"])
if return_trace:
data = ans.get("data", {})
trace_items.append(
{
"component_id": data.get("component_id"),