ag-ui-protocol / ag-ui-protocol/ag-ui

[Bug]: A2UI generate_a2ui with intent create gets no data from the current turn (tool results and changes never reach the render subagent)

Ouverte
#2,669 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
15.9k
Forks
1.4k
Merge moyen
1 j 17 h
PR mergées (30 j)
163

Description

### Describe the Bug

With `injectA2UITool: true` the main agent calls a server tool and then `generate_a2ui` to render the result. The render subagent never sees that data:

- `toModelMessages` in `a2ui-tool.ts` keeps text content only. Tool-call parts and tool results map to an empty string and are filtered out, and the trailing assistant message carrying the `generate_a2ui` call is stripped entirely.
- `prepareA2UIRequest` in `@ag-ui/a2ui-toolkit` renders `changes` into the prompt only for `intent: 'update'`. For `create` the argument is ignored, so the planner has no channel to hand the data over either.

Only `input.state` reaches the subagent (via `buildContextPrompt`). The surface renders with an empty list, or the subagent invents rows.

### Steps to Reproduce

1. Mastra agent with a server tool `getBookedFlights` that returns a list; `injectA2UITool: true`.
2. Prompt: "show my booked flights as a table".
3. The agent calls `getBookedFlights`, then `generate_a2ui` with `intent: 'create'`. The rendered surface has no rows.

### Expected Behavior

Data the main agent produced in the same turn is available to the render subagent, at least when the planner passes it explicitly.

### Environment

```
@ag-ui/mastra 1.1.2, @ag-ui/a2ui-toolkit 0.0.4, @ag-ui/core 0.0.59
@mastra/core 1.63.2
Node 24.17.0, client @copilotkit/angular 0.5.1
```

### Additional Context

Options I see: render `changes` (or a new `content`/`data` argument) into the prompt for `create` as well; keep tool results as text in `toModelMessages`; or keep the text of the stripped assistant message. Related: #2661, #2662, #2663, #2664 from the same migration. Happy to send a PR once the preferred channel is decided.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.