Skip to content

Feature/template schema 721#1276

Open
hrithik18k wants to merge 3 commits intogoogle:mainfrom
hrithik18k:feature/template-schema-721
Open

Feature/template schema 721#1276
hrithik18k wants to merge 3 commits intogoogle:mainfrom
hrithik18k:feature/template-schema-721

Conversation

@hrithik18k
Copy link
Copy Markdown

What this PR does:
Implements Issue #721 — the formal template schema and data-binding specification for template-based inference (parent: #657).
Changes:

schema.json — JSON Schema 2020-12 defining the A2UI template format, including catalogId, dataSchema, dataModel, surfaceId, and {{}} component structure
template_schema.md — Full specification for {{}} placeholder syntax: path resolution, type preservation vs string coercion, error behaviour, and distinction from client-side {"path":"..."} data binding
5 reference templates: restaurant-card, contact-card, product-detail, weather-summary, booking-form
agent_development.md — Added "Template-based Inference" section

All templates validated against schema.json via jsonschema.
Part of #657. Closes #721.

…tax (google#721)

- Add JSON Schema (schema.json) for the A2UI template format
  - Defines required fields: name, version, catalogId, components
  - Defines optional fields: description, surfaceId, theme, dataSchema, dataModel
  - Uses JSON Schema draft 2020-12 consistent with the v0.9 spec

- Add placeholder syntax specification (template_schema.md)
  - Formalizes {{path.to.field}} expression syntax and resolution rules
  - Documents type preservation (whole-string) vs string coercion (inline)
  - Specifies error behavior: KeyError on missing keys, no silent fallbacks
  - Clarifies relationship between {{}} (server-side inflation) and
    {"path": "..."} (client-side data binding)
  - Documents LLM response format (templateName + data)
  - Shows inflated output example (createSurface + updateComponents + updateDataModel)

- Add 5 reference template examples:
  - restaurant-card: restaurant display with booking button
  - contact-card: contact info with icons and message button
  - product-detail: product with image and add-to-cart button
  - weather-summary: weather conditions card
  - booking-form: interactive form demonstrating {{}} + data binding coexistence

- Add Template-based Inference section to agent_development.md

All templates validated against schema.json via jsonschema.

Part of google#657. Closes google#721.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a template-based inference system for the A2UI SDK, featuring a formal JSON schema, comprehensive documentation, and five reference templates for common UI layouts. The review feedback focuses on enhancing the JSON schema with stricter validation for URI formats, component IDs, and naming patterns, while also recommending improvements to type consistency and the removal of redundant properties in the example templates.

Comment thread agent_sdks/python/src/a2ui/template/schema.json
Comment thread agent_sdks/python/src/a2ui/template/schema.json
Comment thread agent_sdks/python/src/a2ui/template/examples/booking_form.json Outdated
Comment thread agent_sdks/python/src/a2ui/template/examples/booking_form.json Outdated
Comment thread agent_sdks/python/src/a2ui/template/template_schema.md
Comment thread agent_sdks/python/src/a2ui/template/schema.json
- Add format: uri to catalogId in schema.json
- Add prefixItems to enforce root as first component
- Fix defaultPartySize type: string -> number in booking_form.json
- Remove redundant dataModel fields from booking_form.json
- Clarify dot-key limitation in template_schema.md
- Add kebab-case pattern to surfaceId in schema.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Finalize A2UI template schema and data-binding syntax

1 participant