You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A2UI defines a sequence of JSON messages that describe the UI. When streamed, these messages are often formatted as **JSON Lines (JSONL)**, where each line is a complete JSON object.
Copy file name to clipboardExpand all lines: docs/guides/agent-development.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ root_agent = Agent(
76
76
)
77
77
```
78
78
79
-
Don't forget to set the `GOOGLE_API_KEY` environment variable to run this example.
79
+
Don't forget to set the `GOOGLE_API_KEY` environment variable to run this example.
80
80
81
81
```bash
82
82
echo'GOOGLE_API_KEY="YOUR_API_KEY"'> .env
@@ -92,7 +92,7 @@ Select `my_agent` from the list, and ask questions about restaurants in New York
92
92
93
93
## Generating A2UI Messages
94
94
95
-
Getting the LLM to generate A2UI messages requires some prompt engineering.
95
+
Getting the LLM to generate A2UI messages requires some prompt engineering.
96
96
97
97
> ⚠️ **Attention**
98
98
>
@@ -131,7 +131,7 @@ To generate the response, you MUST follow these rules:
131
131
4. The JSON part MUST validate against the A2UI JSON SCHEMA provided below.
132
132
133
133
--- UI TEMPLATE RULES ---
134
-
- If the query is for a list of restaurants, use the restaurant data you have already received from the `get_restaurants` tool to populate the `dataModelUpdate.contents` array (e.g., as a `valueMap` for the "items" key).
134
+
- If the query is for a list of restaurants, use the restaurant data you have already received from the `get_restaurants` tool to populate the `updateDataModel.contents` object (e.g., set the "items" key to the list of restaurants).
135
135
- If the number of restaurants is 5 or fewer, you MUST use the `SINGLE_COLUMN_LIST_EXAMPLE` template.
136
136
- If the number of restaurants is more than 5, you MUST use the `TWO_COLUMN_LIST_EXAMPLE` template.
137
137
- If the query is to book a restaurant (e.g., "USER_WANTS_TO_BOOK..."), you MUST use the `BOOKING_FORM_EXAMPLE` template.
@@ -159,8 +159,9 @@ Your agent will no longer strictly output text. Instead, it will output text and
159
159
160
160
The `A2UI_SCHEMA` that we imported is a standard JSON schema that defines valid operations like:
161
161
162
-
*`render` (displaying a UI)
163
-
*`update` (changing data in an existing UI)
162
+
*`createSurface` (displaying a UI)
163
+
*`updateComponents` (changing the UI structure)
164
+
*`updateDataModel` (changing data in an existing UI)
164
165
165
166
Because the output is structured JSON, you may parse and validate it before sending it to the client.
0 commit comments