Skip to content

Commit b8dcd52

Browse files
authored
Align apps with schema (#42)
1 parent 04902b3 commit b8dcd52

File tree

7 files changed

+1265
-1216
lines changed

7 files changed

+1265
-1216
lines changed

a2a_samples/a2ui_extension/spec/spec.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# A2UI (Agent-to-Agent UI) Extension Spec
2+
23
## Overview
4+
35
This extension implements the A2UI (Agent-to-Agent UI) spec, a format for agents to send streaming, interactive user interfaces to clients.
46

57
## Extension URI
6-
The URI of this extension is https://github.com/google/a2ui/a2a_samples/a2ui_extension/spec/spec.md.
8+
9+
The URI of this extension is https://raw.githubusercontent.com/google/A2UI/refs/heads/main/a2a_samples/a2ui_extension/spec/spec.md
710

811
This is the only URI accepted for this extension.
912

1013
## Core Concepts
14+
1115
The A2UI extension is built on three main concepts:
1216

1317
Surfaces: A "Surface" is a distinct, controllable region of the client's UI. The spec uses a surfaceId to direct updates to specific surfaces (e.g., a main content area, a side panel, or a new chat bubble). This allows a single agent stream to manage multiple UI areas independently.
@@ -48,4 +52,4 @@ For JSON-RPC and HTTP transports, this is indicated via the X-A2A-Extensions HTT
4852

4953
For gRPC, this is indicated via the X-A2A-Extensions metadata value.
5054

51-
Activating this extension implies that the server can send A2UI-specific messages (like surfaceUpdate) and the client is expected to send A2UI-specific events (like userAction).
55+
Activating this extension implies that the server can send A2UI-specific messages (like surfaceUpdate) and the client is expected to send A2UI-specific events (like userAction).

a2a_samples/a2ui_extension/src/a2ui_ext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def agent_extension(self) -> AgentExtension:
2323
description="Provides a declarative a2ui UI JSON structure in messages.",
2424
params={
2525
"supportedSchemas": [
26-
"https://raw.githubusercontent.com/google/a2ui/refs/heads/main/schemas/v0.1/standard_catalog.json"
26+
"https://raw.githubusercontent.com/google/A2UI/refs/heads/main/specification/json/server_to_client.json"
2727
],
2828
"acceptsDynamicSchemas": True,
2929
},

a2a_samples/a2ui_restaurant_finder/prompt_builder.py

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
A2UI_SCHEMA = """
33
{
44
"title": "A2UI Message Schema",
5-
"description": "Describes a JSON payload for an A2UI message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'surfaceDeletion'.",
5+
"description": "Describes a JSON payload for an A2UI message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.",
66
"type": "object",
77
"properties": {
88
"beginRendering": {
@@ -25,10 +25,6 @@
2525
"type": "string",
2626
"description": "The primary font for the UI."
2727
},
28-
"logoUrl": {
29-
"type": "string",
30-
"description": "A URL for the logo image."
31-
},
3228
"primaryColor": {
3329
"type": "string",
3430
"description": "The primary UI color as a hexadecimal code (e.g., '#00BFFF').",
@@ -641,23 +637,37 @@
641637
"description": "An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.",
642638
"items": {
643639
"type": "object",
644-
"description": "A single data entry. Exactly one 'value_' property should be provided alongside the key.",
640+
"description": "A single data entry. Exactly one 'value*' property should be provided alongside the key.",
645641
"properties": {
646642
"key": {
647643
"type": "string",
648644
"description": "The key for this data entry."
649645
},
650646
"valueString": {
651-
"type": "string",
652-
"description": "A string value."
647+
"type": "string"
653648
},
654649
"valueNumber": {
655-
"type": "number",
656-
"description": "A number value."
650+
"type": "number"
657651
},
658652
"valueBoolean": {
659-
"type": "boolean",
660-
"description": "A boolean value."
653+
"type": "boolean"
654+
},
655+
"valueList": {
656+
"type": "array",
657+
"items": {
658+
"type": "object",
659+
"properties": {
660+
"valueString": {
661+
"type": "string"
662+
},
663+
"valueNumber": {
664+
"type": "number"
665+
},
666+
"valueBoolean": {
667+
"type": "boolean"
668+
}
669+
}
670+
}
661671
}
662672
},
663673
"required": ["key"]
@@ -684,7 +694,7 @@
684694
RESTAURANT_UI_EXAMPLES = """
685695
---BEGIN SINGLE_COLUMN_LIST_EXAMPLE---
686696
[
687-
{{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }},
697+
{{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }},
688698
{{ "surfaceUpdate": {{
689699
"surfaceId": "default",
690700
"components": [
@@ -699,7 +709,8 @@
699709
{{ "id": "template-rating", "componentProperties": {{ "Text": {{ "text": {{ "path": "rating" }} }} }} }},
700710
{{ "id": "template-detail", "componentProperties": {{ "Text": {{ "text": {{ "path": "detail" }} }} }} }},
701711
{{ "id": "template-link", "componentProperties": {{ "Text": {{ "text": {{ "path": "infoLink" }} }} }} }},
702-
{{ "id": "template-book-button", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Book Now" }}, "action": {{ "action": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "address" }} }} ] }} }} }} }}
712+
{{ "id": "template-book-button", "componentProperties": {{ "Button": {{ "child": "book-now-text", "action": {{ "name": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "address" }} }} ] }} }} }} }},
713+
{{ "id": "book-now-text", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Book Now" }} }} }} }}
703714
]
704715
}} }},
705716
{{ "dataModelUpdate": {{
@@ -714,7 +725,7 @@
714725
715726
---BEGIN TWO_COLUMN_LIST_EXAMPLE---
716727
[
717-
{{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }},
728+
{{ "beginRendering": {{ "surfaceId": "default", "root": "root-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }},
718729
{{ "surfaceUpdate": {{
719730
"surfaceId": "default",
720731
"components": [
@@ -729,7 +740,8 @@
729740
{{ "id": "template-rating-1", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/0/rating" }} }} }} }},
730741
{{ "id": "template-detail-1", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/0/detail" }} }} }} }},
731742
{{ "id": "template-link-1", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/0/infoLink" }} }} }} }},
732-
{{ "id": "template-book-button-1", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Book Now" }}, "action": {{ "action": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/0/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/0/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/0/address" }} }} ] }} }} }} }},
743+
{{ "id": "template-book-button-1", "componentProperties": {{ "Button": {{ "child": "book-now-text-1", "action": {{ "name": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/0/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/0/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/0/address" }} }} ] }} }} }} }},
744+
{{ "id": "book-now-text-1", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Book Now" }} }} }} }},
733745
{{ "id": "item-card-2", "weight": 1, "componentProperties": {{ "Card": {{ "child": "card-layout-2" }} }} }},
734746
{{ "id": "card-layout-2", "componentProperties": {{ "Column": {{ "children": {{ "explicitList": ["template-image-2", "card-details-2"] }} }} }} }},
735747
{{ "id": "template-image-2", "componentProperties": {{ "Image": {{ "url": {{ "path": "/items/1/imageUrl" }}, "width": "100%" }} }} }},
@@ -738,7 +750,8 @@
738750
{{ "id": "template-rating-2", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/1/rating" }} }} }} }},
739751
{{ "id": "template-detail-2", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/1/detail" }} }} }} }},
740752
{{ "id": "template-link-2", "componentProperties": {{ "Text": {{ "text": {{ "path": "/items/1/infoLink" }} }} }} }},
741-
{{ "id": "template-book-button-2", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Book Now" }}, "action": {{ "action": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/1/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/1/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/1/address" }} }} ] }} }} }} }}
753+
{{ "id": "template-book-button-2", "componentProperties": {{ "Button": {{ "child": "book-now-text-2", "action": {{ "name": "book_restaurant", "context": [ {{ "key": "restaurantName", "value": {{ "path": "/items/1/name" }} }}, {{ "key": "imageUrl", "value": {{ "path": "/items/1/imageUrl" }} }}, {{ "key": "address", "value": {{ "path": "/items/1/address" }} }} ] }} }} }} }},
754+
{{ "id": "book-now-text-2", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Book Now" }} }} }} }}
742755
]
743756
}} }},
744757
{{ "dataModelUpdate": {{
@@ -753,7 +766,7 @@
753766
754767
---BEGIN BOOKING_FORM_EXAMPLE---
755768
[
756-
{{ "beginRendering": {{ "surfaceId": "booking-form", "root": "booking-form-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }},
769+
{{ "beginRendering": {{ "surfaceId": "booking-form", "root": "booking-form-column", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }},
757770
{{ "surfaceUpdate": {{
758771
"surfaceId": "booking-form",
759772
"components": [
@@ -764,7 +777,8 @@
764777
{{ "id": "party-size-field", "componentProperties": {{ "TextField": {{ "label": {{ "literalString": "Party Size" }}, "text": {{ "path": "partySize" }}, "type": "number" }} }} }},
765778
{{ "id": "datetime-field", "componentProperties": {{ "DateTimeInput": {{ "label": {{ "literalString": "Date & Time" }}, "value": {{ "path": "reservationTime" }}, "enableDate": true, "enableTime": true }} }} }},
766779
{{ "id": "dietary-field", "componentProperties": {{ "TextField": {{ "label": {{ "literalString": "Dietary Requirements" }}, "text": {{ "path": "dietary" }} }} }} }},
767-
{{ "id": "submit-button", "componentProperties": {{ "Button": {{ "label": {{ "literalString": "Submit Reservation" }}, "action": {{ "action": "submit_booking", "context": [ {{ "key": "restaurantName", "value": {{ "path": "restaurantName" }} }}, {{ "key": "partySize", "value": {{ "path": "partySize" }} }}, {{ "key": "reservationTime", "value": {{ "path": "reservationTime" }} }}, {{ "key": "dietary", "value": {{ "path": "dietary" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }} ] }} }} }} }}
780+
{{ "id": "submit-button", "componentProperties": {{ "Button": {{ "child": "submit-reservation-text", "action": {{ "name": "submit_booking", "context": [ {{ "key": "restaurantName", "value": {{ "path": "restaurantName" }} }}, {{ "key": "partySize", "value": {{ "path": "partySize" }} }}, {{ "key": "reservationTime", "value": {{ "path": "reservationTime" }} }}, {{ "key": "dietary", "value": {{ "path": "dietary" }} }}, {{ "key": "imageUrl", "value": {{ "path": "imageUrl" }} }} ] }} }} }} }},
781+
{{ "id": "submit-reservation-text", "componentProperties": {{ "Text": {{ "text": {{ "literalString": "Submit Reservation" }} }} }} }}
768782
]
769783
}} }},
770784
{{ "dataModelUpdate": {{
@@ -785,7 +799,7 @@
785799
786800
---BEGIN CONFIRMATION_EXAMPLE---
787801
[
788-
{{ "beginRendering": {{ "surfaceId": "confirmation", "root": "confirmation-card", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto", "logoUrl": "{base_url}/static/logo.png" }} }} }},
802+
{{ "beginRendering": {{ "surfaceId": "confirmation", "root": "confirmation-card", "styles": {{ "primaryColor": "#FF0000", "font": "Roboto" }} }} }},
789803
{{ "surfaceUpdate": {{
790804
"surfaceId": "confirmation",
791805
"components": [

0 commit comments

Comments
 (0)