Skip to content

Commit 8a1bf49

Browse files
authored
Revert "Revert "feat: Upgrade A2UI examples to v0.9 schema (#751)" (#758)"
This reverts commit ebad279.
1 parent ebad279 commit 8a1bf49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6157
-808
lines changed

.github/workflows/python_samples_build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ jobs:
5151
working-directory: samples/agent/adk
5252
run: uv run pyink --check .
5353

54+
- name: Validate Sample Examples
55+
run: |
56+
PYTHONPATH=agent_sdks/python/src uv run --project agent_sdks/python pytest -vv samples/agent/adk/tests/test_examples_validation.py
57+
5458
- name: Build contact_lookup
5559
working-directory: samples/agent/adk/contact_lookup
5660
run: uv build .

samples/agent/adk/contact_lookup/agent.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from google.genai import types
3333
from prompt_builder import get_text_prompt, ROLE_DESCRIPTION, WORKFLOW_DESCRIPTION, UI_DESCRIPTION
3434
from tools import get_contact_info
35-
from a2ui.core.schema.constants import VERSION_0_8
35+
from a2ui.core.schema.constants import VERSION_0_9
3636
from a2ui.core.schema.manager import A2uiSchemaManager
3737
from a2ui.basic_catalog.provider import BasicCatalog
3838
from a2ui.a2a import get_a2ui_agent_extension
@@ -48,11 +48,15 @@ class ContactAgent:
4848
def __init__(self, base_url: str, use_ui: bool = False):
4949
self.base_url = base_url
5050
self.use_ui = use_ui
51+
self.version = VERSION_0_9
5152
self._schema_manager = (
5253
A2uiSchemaManager(
53-
version=VERSION_0_8,
54+
version=self.version,
5455
catalogs=[
55-
BasicCatalog.get_config(version=VERSION_0_8, examples_path="examples")
56+
BasicCatalog.get_config(
57+
version=self.version,
58+
examples_path=f"examples/{self.version}",
59+
)
5660
],
5761
)
5862
if use_ui

samples/agent/adk/contact_lookup/examples/action_confirmation.json renamed to samples/agent/adk/contact_lookup/examples/0.8/action_confirmation.json

File renamed without changes.

samples/agent/adk/contact_lookup/examples/contact_card.json renamed to samples/agent/adk/contact_lookup/examples/0.8/contact_card.json

File renamed without changes.

samples/agent/adk/contact_lookup/examples/contact_list.json renamed to samples/agent/adk/contact_lookup/examples/0.8/contact_list.json

File renamed without changes.

samples/agent/adk/contact_lookup/examples/follow_success.json renamed to samples/agent/adk/contact_lookup/examples/0.8/follow_success.json

File renamed without changes.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
[
2+
{
3+
"version": "v0.9",
4+
"createSurface": {
5+
"surfaceId": "action-modal",
6+
"catalogId": "https://a2ui.org/specification/v0_9/basic_catalog.json",
7+
"theme": {
8+
"primaryColor": "#007BFF",
9+
"font": "Roboto"
10+
}
11+
}
12+
},
13+
{
14+
"version": "v0.9",
15+
"updateComponents": {
16+
"surfaceId": "action-modal",
17+
"components": [
18+
{
19+
"id": "root",
20+
"component": "Modal",
21+
"trigger": "hidden-entry-point",
22+
"content": "modal-content-column"
23+
},
24+
{
25+
"id": "hidden-entry-point",
26+
"component": "Text",
27+
"text": ""
28+
},
29+
{
30+
"id": "modal-content-column",
31+
"component": "Column",
32+
"children": [
33+
"modal-title",
34+
"modal-message",
35+
"dismiss-button"
36+
],
37+
"align": "center"
38+
},
39+
{
40+
"id": "modal-title",
41+
"component": "Text",
42+
"variant": "h2",
43+
"text": {
44+
"path": "/actionTitle"
45+
}
46+
},
47+
{
48+
"id": "modal-message",
49+
"component": "Text",
50+
"text": {
51+
"path": "/actionMessage"
52+
}
53+
},
54+
{
55+
"id": "dismiss-button-text",
56+
"component": "Text",
57+
"text": "Dismiss"
58+
},
59+
{
60+
"id": "dismiss-button",
61+
"component": "Button",
62+
"child": "dismiss-button-text",
63+
"variant": "primary",
64+
"action": {
65+
"event": {
66+
"name": "dismiss_modal"
67+
}
68+
}
69+
}
70+
]
71+
}
72+
},
73+
{
74+
"version": "v0.9",
75+
"updateDataModel": {
76+
"surfaceId": "action-modal",
77+
"path": "/",
78+
"value": {
79+
"actionTitle": "Action Confirmation",
80+
"actionMessage": "Your action has been processed."
81+
}
82+
}
83+
}
84+
]

0 commit comments

Comments
 (0)