Skip to content

Commit c9812a2

Browse files
Add agent card as a route in rest adapter
1 parent dec4b48 commit c9812a2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/a2a/server/apps/rest/rest_adapter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ async def handle_get_agent_card(self, request: Request) -> JSONResponse:
9393
Returns:
9494
A JSONResponse containing the agent card data.
9595
"""
96+
if self.agent_card.supports_authenticated_extended_card:
97+
return await self.handle_authenticated_agent_card(request)
98+
9699
# The public agent card is a direct serialization of the agent_card
97100
# provided at initialization.
98101
return JSONResponse(
@@ -174,8 +177,7 @@ def routes(self) -> dict[tuple[str, str], Callable[[Request], Any]]:
174177
('/v1/tasks', 'GET'): functools.partial(
175178
self._handle_request, self.handler.list_tasks
176179
),
180+
('/v1/card', 'GET') : self.handle_get_agent_card,
177181
}
178-
if self.agent_card.supports_authenticated_extended_card:
179-
routes[('/v1/card', 'GET')] = self.handle_authenticated_agent_card
180182

181183
return routes

0 commit comments

Comments
 (0)