Skip to content

Conversation

@gspencergoog
Copy link
Collaborator

@gspencergoog gspencergoog commented Jan 8, 2026

This pull request introduces support for string interpolation within the A2UI v0.9 protocol and includes documentation and schema refinements to improve modularity and LLM generation quality.

Key Changes

1. String Interpolation Mechanism

Introduced a string interpolation feature for all DynamicString properties, allowing models to embed data-bound values and function results directly within strings.

  • Syntax: Uses the ${expression} format (e.g., "Hello, ${/user/name}!").
  • Data Model Binding: Supports both absolute paths (${/path/to/value}) and relative paths (${itemName}) resolved against the current collection scope.
  • Function Integration: Results from client-side functions can be interpolated using parentheses (e.g., "Time: ${now()}").
  • Nested Expressions: Supports recursive nesting of expressions within function arguments (e.g., ${formatDate(${/timestamp}, 'yyyy-MM-dd')}).
  • Consistency: Defined standard type conversion rules (numbers, booleans, and JSON-stringified objects/arrays) and escaping mechanisms (\${ for a literal ${).

2. Documentation and Schema Refactoring

  • Improved Protocol Guide: Added a dedicated "String Interpolation" section to a2ui_protocol.md.
  • Enhanced LLM Guidance: Expanded the description of DynamicString in common_types.json to provide a verbose description, providing explicit instructions to LLMs on how to utilize the new interpolation syntax effectively.

Impact on Client Implementations

While parsing "flat" interpolation can remain simple, supporting nested expressions will require client implementations to use either a basic recursive descent parser or a simple balanced-brace scanner. The grammar remains intentionally lightweight (avoiding logic/operators) to keep client-side overhead minimal.

Verification

  • Updated JSON schemas in common_types.json.
  • Verified documentation examples against the new interpolation syntax.
  • Updated a2ui_protocol.md to serve as the definitive reference for the new feature.

@gspencergoog gspencergoog changed the title String Interpolation and Protocol Refinements (v0.9) String Interpolation (v0.9) Jan 8, 2026
Copy link
Collaborator

@jacobsimionato jacobsimionato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It only adds a little more complexity than we already have and I can imagine this being super useful.

@gspencergoog gspencergoog merged commit b22fd59 into google:main Jan 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants