Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(a2ui): fix package path issue in pyproject.toml & improve performance (#1167)
Osier-Yi88fe290e23c3
diff --git a/examples/agent/a2ui_agent/samples/client/lit/shell/.vite/deps/_metadata.json b/examples/agent/a2ui_agent/samples/client/lit/shell/.vite/deps/_metadata.jsondeleted file mode 100644index 97fc992bd..000000000--- a/examples/agent/a2ui_agent/samples/client/lit/shell/.vite/deps/_metadata.json+++ /dev/null@@ -1,8 +0,0 @@-{- "hash": "b676c12b",- "configHash": "2fd5a0c6",- "lockfileHash": "e3b0c442",- "browserHash": "17bb8bb5",- "optimized": {},- "chunks": {}-}\ No newline at end of filediff --git a/examples/agent/a2ui_agent/samples/client/lit/shell/.vite/deps/package.json b/examples/agent/a2ui_agent/samples/client/lit/shell/.vite/deps/package.jsondeleted file mode 100644index 3dbc1ca59..000000000--- a/examples/agent/a2ui_agent/samples/client/lit/shell/.vite/deps/package.json+++ /dev/null@@ -1,3 +0,0 @@-{- "type": "module"-}diff --git a/examples/agent/a2ui_agent/samples/general_agent/a2ui_utils.py b/examples/agent/a2ui_agent/samples/general_agent/a2ui_utils.pyindex da1eda7ec..faa07b848 100644--- a/examples/agent/a2ui_agent/samples/general_agent/a2ui_utils.py+++ b/examples/agent/a2ui_agent/samples/general_agent/a2ui_utils.py@@ -104,7 +104,11 @@ def transfer_ui_event_to_query(ui_event_part: dict) -> str:f"The image URL is {image_url}")else:- query = f"User submitted an event: {action} with data: {ctx}"+ # Note: The A2UI original example uses `ctx` as the data source.+ # However, in generated UI components, the `ctx` field may be empty+ # when the databinding path cannot be resolved. To ensure we capture+ # all available event data, we use the entire `ui_event_part` instead.+ query = f"User submitted an event: {action} with data: {ui_event_part}"return querydiff --git a/examples/agent/a2ui_agent/samples/general_agent/prompt_builder.py b/examples/agent/a2ui_agent/samples/general_agent/prompt_builder.pyindex c3cfec8b6..924b4dd58 100644--- a/examples/agent/a2ui_agent/samples/general_agent/prompt_builder.py+++ b/examples/agent/a2ui_agent/samples/general_agent/prompt_builder.py@@ -34,7 +34,7 @@ def get_ui_prompt() -> str:- Read the SKILL.md file from the skill directory using `view_text_file`- Execute the Python command in the skill directory using `execute_shell_command` to load the schema and examples- DO NOT assume you know the A2UI format - you MUST load it from the skill- **If you skip using the skill, your response will be incorrect and invalid.**+2. When you plan to generate the A2UI JSON response, you MUST output text directly. The text output MUST contain two parts, separated by the delimiter: `---a2ui_JSON---`. The first part is your conversational text response, and the second part is a single, raw JSON object which is a list of A2UI messages.### CRITICAL REQUIREMENTS:@@ -42,10 +42,10 @@ def get_ui_prompt() -> str:2. You MUST ONLY use `execute_shell_command` tool to execute the Python command in the skill directory. DO NOT use `execute_python_code` to execute the command.3. **You MUST directly generate the A2UI JSON based on the task content. DO NOT ask the user about their preference regarding UI type (list, form, confirmation, detail view). You should automatically determine the most appropriate UI type based on the context and generate the response accordingly.**4. **ALWAYS remember the user's task and objective. Your UI responses should be directly aligned with helping the user accomplish their specific goal. Never lose sight of what the user is trying to achieve.**- 5. **CRITICAL FORMAT REQUIREMENT**: When generating A2UI JSON responses, you MUST output text directly (). The text MUST contain two parts separated by `---a2ui_JSON---`: your conversational response first, followed by the A2UI JSON array that best describes the inferface that you want to display to the user.- 6. **WHEN ASKING QUESTIONS**: When you need to ask the user task-related questions, you MUST include `---a2ui_JSON---` followed by the appropriate UI JSON (such as forms, selection cards, or input fields) that allows the user to provide their answer. The question text should come first, then the delimiter, then the UI JSON for collecting the user's response.- 7. **WHEN PROVIDING INFORMATION IN TEXT FORMAT**: When you need to provide information to the user in text format, you MUST include `---a2ui_JSON---` followed by the appropriate UI JSON that allows the user to view the information. The information text should come first, then the delimiter, then the UI JSON for displaying the information.- 8. The Most Important Rule: You MUST always include `---a2ui_JSON---` in your response.-+ 5. **WHEN ASKING QUESTIONS**: When you need to ask the user task-related questions, you MUST include `---a2ui_JSON---` followed by the appropriate UI JSON (such as forms, selection cards, or input fields) that allows the user to provide their answer. The question text should come first, then the delimiter, then the UI JSON for collecting the user's response.+ 6. **WHEN PROVIDING INFORMATION IN TEXT FORMAT**: When you need to provide information to the user in text format, you MUST include `---a2ui_JSON---` followed by the appropriate UI JSON that allows the user to view the information. The information text should come first, then the delimiter, then the UI JSON for displaying the information.+ 7. **The Most Important Rule**: You MUST always include `---a2ui_JSON---` in your response.+ 8. **CRITICAL FORMAT REQUIREMENT**: When generating A2UI JSON responses, you MUST output text directly. The text MUST contain two parts separated by `---a2ui_JSON---`: your conversational response first, followed by the A2UI JSON array that best describes the inferface that you want to display to the user.+ 9. **If you skip using the `A2UI_response_generator` skill, your response will be incorrect and invalid.**"""diff --git a/examples/agent/a2ui_agent/samples/general_agent/pyproject.toml b/examples/agent/a2ui_agent/samples/general_agent/pyproject.tomlindex 7e4c176d9..e7608e27a 100644--- a/examples/agent/a2ui_agent/samples/general_agent/pyproject.toml+++ b/examples/agent/a2ui_agent/samples/general_agent/pyproject.toml@@ -9,7 +9,7 @@ dependencies = ["starlette","fastapi","shortuuid",- "a2ui-agent @ file:///Users/liuyi/Documents/Research/LLM-research/clarify_tool/github_project/A2UI/a2a_agents/python/a2ui_agent"+ "a2ui-agent"][build-system]diff --git a/examples/agent/a2ui_agent/samples/general_agent/setup_a2ui_server.py b/examples/agent/a2ui_agent/samples/general_agent/setup_a2ui_server.pyindex 715417783..3d894802f 100644--- a/examples/agent/a2ui_agent/samples/general_agent/setup_a2ui_server.py+++ b/examples/agent/a2ui_agent/samples/general_agent/setup_a2ui_server.py@@ -197,7 +197,7 @@ class SimpleStreamHandler:name="Friday",sys_prompt=get_ui_prompt(),model=DashScopeChatModel(- model_name="qwen-plus",+ model_name="qwen3-max",api_key=os.getenv("DASHSCOPE_API_KEY"),),formatter=DashScopeChatFormatter(),diff --git a/examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/simple_column_list_without_image.py b/examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/simple_column_list_without_image.pyindex 306f81359..476d8e615 100644--- a/examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/simple_column_list_without_image.py+++ b/examples/agent/a2ui_agent/samples/general_agent/skills/A2UI_response_generator/UI_templete_examples/simple_column_list_without_image.py@@ -14,7 +14,14 @@ Use this template for compact lists without images.{{ "id": "root-column", "component": {{ "Column": {{ "children": {{ "explicitList": ["title-heading", "item-list"] }} }} }} }},{{ "id": "title-heading", "component": {{ "Text": {{ "usageHint": "h1", "text": {{ "path": "title" }} }} }} }},{{ "id": "item-list", "component": {{ "List": {{ "direction": "vertical", "children": {{ "template": {{ "componentId": "list-item-template", "dataBinding": "/items" }} }} }} }} }},- {{ "id": "list-item-template", "component": {{ "Row": {{ "children": {{ "explicitList": ["item-icon", "item-content", "item-action"] }} }} }} }},++ # Change Row to Button to make the entire row clickable+ {{ "id": "list-item-template", "component": {{ "Button": {{+ "usageHint": "listItem",+ "action": {{ "path": "action" }},+ "children": {{ "explicitList": ["item-icon", "item-content", "item-action"] }}+ }} }} }},+{{ "id": "item-icon", "component": {{ "Icon": {{ "name": {{ "path": "icon" }} }} }} }},{{ "id": "item-content", "weight": 1, "component": {{ "Column": {{ "children": {{ "explicitList": ["item-title", "item-subtitle"] }} }} }} }},{{ "id": "item-title", "component": {{ "Text": {{ "usageHint": "h4", "text": {{ "path": "title" }} }} }} }},@@ -31,7 +38,8 @@ Use this template for compact lists without images.{{ "key": "item1", "valueMap": [{{ "key": "icon", "valueString": "folder" }},{{ "key": "title", "valueString": "[Item Title]" }},- {{ "key": "subtitle", "valueString": "[Item Subtitle]" }}+ {{ "key": "subtitle", "valueString": "[Item Subtitle]" }},+ {{ "key": "action", "valueString": "view_details" }}] }}] }}]