Skip to content

Conversation

@dmandar
Copy link
Collaborator

@dmandar dmandar commented Dec 12, 2025

No description provided.

Copy link
Collaborator

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

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

I didn't really review the web parts of this very closely.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the same image as profile2.png. Is that expected?

Copy link
Collaborator Author

@dmandar dmandar Dec 15, 2025

Choose a reason for hiding this comment

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

let me fix

Comment on lines +41 to +58
{{ "key": "contacts", "valueMap": [
{{ "key": "contact1", "valueMap": [
{{ "key": "name", "valueString": "Alice Wonderland" }},
{{ "key": "phone", "valueString": "+1-555-123-4567" }},
{{ "key": "email", "valueString": "alice@example.com" }},
{{ "key": "imageUrl", "valueString": "https://example.com/alice.jpg" }},
{{ "key": "title", "valueString": "Mad Hatter" }},
{{ "key": "department", "valueString": "Wonderland" }}
] }},
{{ "key": "contact2", "valueMap": [
{{ "key": "name", "valueString": "Bob The Builder" }},
{{ "key": "phone", "valueString": "+1-555-765-4321" }},
{{ "key": "email", "valueString": "bob@example.com" }},
{{ "key": "imageUrl", "valueString": "https://example.com/bob.jpg" }},
{{ "key": "title", "valueString": "Construction" }},
{{ "key": "department", "valueString": "Building" }}
] }}
] }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This section uses "{{" and "}}". I'm pretty sure that's invalid in this context. They should probably just be single braces. If they somehow are correct, then the other examples are broken.

{ "surfaceUpdate": {
"surfaceId": "action-modal",
"components": [
{ "id": "modal-wrapper", "component": { "Modal": { "entryPointChild": "hidden-entry-point", "contentChild": "modal-content-column", "open": true } } },
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no "open" property on Modal in the specification. Either the spec is out of date, or the properties here are.

{ "id": "description_text_1", "component": { "Text": { "text": { "path": "title"} } } } ,
{ "id": "description_text_2", "component": { "Text": { "text": { "path": "team"} } } } ,
{ "id": "description_column", "component": { "Column": { "children": { "explicitList": ["user_heading", "description_text_1", "description_text_2"]} , "alignment": "center"} } } ,
{ "id": "calendar_icon", "component": { "Icon": { "name": { "literalString": "calendar_today"} } } } ,
Copy link
Collaborator

Choose a reason for hiding this comment

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

calendar_today isn't a valid icon name from the enum. It should be calendarToday.

{ "id": "calendar_secondary_text", "component": { "Text": { "text": { "literalString": "Calendar"} } } } ,
{ "id": "calendar_text_column", "component": { "Column": { "children": { "explicitList": ["calendar_primary_text", "calendar_secondary_text"]} , "distribution": "start", "alignment": "start"} } } ,
{ "id": "info_row_1", "component": { "Row": { "children": { "explicitList": ["calendar_icon", "calendar_text_column"]} , "distribution": "start", "alignment": "start"} } } ,
{ "id": "location_icon", "component": { "Icon": { "name": { "literalString": "location_on"} } } } ,
Copy link
Collaborator

Choose a reason for hiding this comment

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

location_on isn't a valid Icon name from the enum. It should be locationOn.


# a2ui_schema.py

A2UI_SCHEMA = r'''
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be referencing the schema available in specification/0.8/json so that it doesn't get out of sync.

Copy link
Collaborator

Choose a reason for hiding this comment

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

"calendar": "Out of office",
"imageUrl": "http://localhost:10004/static/profile3.png"
}
] No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add trailing newline.

{formatted_examples}
---BEGIN A2UI JSON SCHEMA---
{A2UI_SCHEMA}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could load the file from specification/0.8/json directly instead (but maybe cache it in memory).

# Check for inline catalog
if "metadata" in part.root.data and "inlineCatalog" in part.root.data["metadata"]:
logger.info(f" Part {i}: Found 'inlineCatalog' in DataPart.")
inline_catalog = part.root.data["metadata"]["inlineCatalog"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

agent_card = AgentCard(
name="Contact Lookup Agent",
description="This agent helps find contact info for people in your organization.",
url=base_url, # <-- Use base_url here
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need # <-- use base_url here?


# a2ui_schema.py

A2UI_SCHEMA = r'''
Copy link
Collaborator

Choose a reason for hiding this comment

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


# a2ui_examples.py

CONTACT_UI_EXAMPLES = """
Copy link
Collaborator

Choose a reason for hiding this comment

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

try loading examples from json files, here is how i did it in rizzcharts

https://github.com/google/A2UI/blob/main/samples/agent/adk/rizzcharts/agent.py#L50

the nice thing is it validates all your examples so you know you won't confuse the llm with invalid json

"--- AGENT_EXECUTOR: A2UI extension is active. Using UI agent. ---"
)
else:
agent = self.text_agent
Copy link
Collaborator

Choose a reason for hiding this comment

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

or just error here

"""


def get_ui_prompt(base_url: str, examples: str) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

i found the llmagent instructions lambda handled all this on the fly prompt generation nicely

heres example from rizzcharts
https://github.com/google/A2UI/blob/main/samples/agent/adk/rizzcharts/agent.py#L143

}

#onMessage = (event: MessageEvent) => {
// In production, verify event.origin matches this.src origin (if not opaque).
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe implement this for the demo? its kinda a security hole. i imagine people will copy+paste the samples

// Trusted
// Always allow same-origin for trusted domains to avoid issues with local assets or CORS checks
if (this.interactionMode === 'interactive') {
return "allow-scripts allow-forms allow-popups allow-modals allow-same-origin";
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe get rid of allow-popups? these are annoying and u have modals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants