From 36fd115637af2233f671818f65fbcfaf89271dd1 Mon Sep 17 00:00:00 2001 From: RobinsonBeato Date: Mon, 22 Dec 2025 18:38:24 -0300 Subject: [PATCH 1/2] Trim UI prompt by removing embedded schema --- samples/agent/adk/restaurant_finder/prompt_builder.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/samples/agent/adk/restaurant_finder/prompt_builder.py b/samples/agent/adk/restaurant_finder/prompt_builder.py index 1cc8445e..f72e2e6f 100644 --- a/samples/agent/adk/restaurant_finder/prompt_builder.py +++ b/samples/agent/adk/restaurant_finder/prompt_builder.py @@ -809,7 +809,7 @@ def get_ui_prompt(base_url: str, examples: str) -> str: 1. Your response MUST be in two parts, separated by the delimiter: `---a2ui_JSON---`. 2. The first part is your conversational text response. 3. The second part is a single, raw JSON object which is a list of A2UI messages. - 4. The JSON part MUST validate against the A2UI JSON SCHEMA provided below. + 4. The JSON part MUST validate against the A2UI JSON schema. --- UI TEMPLATE RULES --- - 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). @@ -819,10 +819,6 @@ def get_ui_prompt(base_url: str, examples: str) -> str: - If the query is a booking submission (e.g., "User submitted a booking..."), you MUST use the `CONFIRMATION_EXAMPLE` template. {formatted_examples} - - ---BEGIN A2UI JSON SCHEMA--- - {A2UI_SCHEMA} - ---END A2UI JSON SCHEMA--- """ From 9247cff1f71f351ecaa864f206149ed60e53470d Mon Sep 17 00:00:00 2001 From: RobinsonBeato Date: Mon, 22 Dec 2025 19:14:31 -0300 Subject: [PATCH 2/2] Reduce restaurant UI prompt with minimal A2UI contract --- samples/agent/adk/restaurant_finder/prompt_builder.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/samples/agent/adk/restaurant_finder/prompt_builder.py b/samples/agent/adk/restaurant_finder/prompt_builder.py index f72e2e6f..ca52a2c2 100644 --- a/samples/agent/adk/restaurant_finder/prompt_builder.py +++ b/samples/agent/adk/restaurant_finder/prompt_builder.py @@ -809,7 +809,7 @@ def get_ui_prompt(base_url: str, examples: str) -> str: 1. Your response MUST be in two parts, separated by the delimiter: `---a2ui_JSON---`. 2. The first part is your conversational text response. 3. The second part is a single, raw JSON object which is a list of A2UI messages. - 4. The JSON part MUST validate against the A2UI JSON schema. + 4. The JSON part MUST follow the A2UI JSON contract below. --- UI TEMPLATE RULES --- - 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). @@ -819,6 +819,15 @@ def get_ui_prompt(base_url: str, examples: str) -> str: - If the query is a booking submission (e.g., "User submitted a booking..."), you MUST use the `CONFIRMATION_EXAMPLE` template. {formatted_examples} + + ---BEGIN A2UI JSON CONTRACT--- + - The JSON MUST be a list of message objects. + - Each message object MUST contain exactly one of: `beginRendering`, `surfaceUpdate`, `dataModelUpdate`, `deleteSurface`. + - `beginRendering` MUST include: `surfaceId`, `root`. + - `surfaceUpdate` MUST include: `surfaceId`, `components` (array of objects with `id` and `component`). + - `dataModelUpdate` MUST include: `surfaceId`, `contents`. + - `deleteSurface` MUST include: `surfaceId`. + ---END A2UI JSON CONTRACT--- """