Skip to content

Commit 4bd12e5

Browse files
committed
Update the restaurant finder sample
It updates the sample to use the A2uiSchemaManager from the a2ui-agent python SDK. Tested: - [x] The `restaurant` angular client successfully connected to the `restaurant_finder` agent and rendered the response correctly.
1 parent 09e6b06 commit 4bd12e5

9 files changed

Lines changed: 231 additions & 1073 deletions

File tree

samples/agent/adk/restaurant_finder/__main__.py

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
from a2a.server.apps import A2AStarletteApplication
2020
from a2a.server.request_handlers import DefaultRequestHandler
2121
from a2a.server.tasks import InMemoryTaskStore
22-
from a2a.types import AgentCapabilities, AgentCard, AgentSkill
23-
from a2ui.extension.a2ui_extension import get_a2ui_agent_extension
2422
from agent import RestaurantAgent
2523
from agent_executor import RestaurantAgentExecutor
2624
from dotenv import load_dotenv
@@ -49,39 +47,19 @@ def main(host, port):
4947
"GEMINI_API_KEY environment variable not set and GOOGLE_GENAI_USE_VERTEXAI is not TRUE."
5048
)
5149

52-
capabilities = AgentCapabilities(
53-
streaming=True,
54-
extensions=[get_a2ui_agent_extension()],
55-
)
56-
skill = AgentSkill(
57-
id="find_restaurants",
58-
name="Find Restaurants Tool",
59-
description="Helps find restaurants based on user criteria (e.g., cuisine, location).",
60-
tags=["restaurant", "finder"],
61-
examples=["Find me the top 10 chinese restaurants in the US"],
62-
)
63-
6450
base_url = f"http://{host}:{port}"
6551

66-
agent_card = AgentCard(
67-
name="Restaurant Agent",
68-
description="This agent helps find restaurants based on user criteria.",
69-
url=base_url, # <-- Use base_url here
70-
version="1.0.0",
71-
default_input_modes=RestaurantAgent.SUPPORTED_CONTENT_TYPES,
72-
default_output_modes=RestaurantAgent.SUPPORTED_CONTENT_TYPES,
73-
capabilities=capabilities,
74-
skills=[skill],
75-
)
52+
ui_agent = RestaurantAgent(base_url=base_url, use_ui=True)
53+
text_agent = RestaurantAgent(base_url=base_url, use_ui=False)
7654

77-
agent_executor = RestaurantAgentExecutor(base_url=base_url)
55+
agent_executor = RestaurantAgentExecutor(ui_agent, text_agent)
7856

7957
request_handler = DefaultRequestHandler(
8058
agent_executor=agent_executor,
8159
task_store=InMemoryTaskStore(),
8260
)
8361
server = A2AStarletteApplication(
84-
agent_card=agent_card, http_handler=request_handler
62+
agent_card=ui_agent.get_agent_card(), http_handler=request_handler
8563
)
8664
import uvicorn
8765

samples/agent/adk/restaurant_finder/a2ui_examples.py

Lines changed: 0 additions & 186 deletions
This file was deleted.

0 commit comments

Comments
 (0)