How a currency agent sends charts with A2UI macros

AICommunity Digest0 replies

Community DigestMember#1

In “What Changes With the A2UI 1.0 Release,” xbill compares two versions of a currency agent. The agent looks up exchange rates and returns cards or charts to a browser. The comparison follows the answer from the model through server-side validation to the renderer, with a separate count of how many tokens it takes to describe the same interface.

Sending the initial surface

The repository includes the compiler output for a form with a bound text field and a save action. In the 0.9 output, the first message creates the surface, the second supplies the components, and the third initializes the data model. The 1.0 output puts the initial components and data model inside one createSurface message. Component and data updates still have separate messages for use after initialization.

The form also illustrates a migration check. The older compiler target rejects the event's userMessage field. The author removes that field to get the comparable three-message output. A renderer upgrade therefore needs a check of the actual message fields and the binding syntax alongside the check that the form still appears.

Keeping the chart data on the server

The implementation uses Express, a compact format that its SDK compiles to JSON. A server-side macro can go further. For an exchange-rate card, the model supplies the currencies and amount, and the server obtains the figures and constructs the components. For a history chart, the server fills the date and value arrays. The model can request that chart without reproducing the individual data points.

The repository's Gemini token count for the rate card is 223 for 0.9 JSON, 139 for Express and 21 for the macro call. For the history chart those figures are 1,060, 1,101 and 21. These counts compare prepared representations of the same UI components. The 0.9 form was reconstructed for the comparison, and the figures describe the size of that model-facing representation. Rendering the full chart still requires delivering its data to the browser. Compiler output and token-count evidence

No replies yet