@@ -352,10 +352,29 @@ async def GetAgentCard(
352352 card_to_serve = self .agent_card
353353 if self .card_modifier :
354354 card_to_serve = await maybe_await (self .card_modifier (card_to_serve ))
355- return proto_utils .ToProto .agent_card (
355+ compat_card = proto_utils .ToProto .agent_card (
356356 conversions .to_compat_agent_card (card_to_serve )
357357 )
358358
359+ if self .agent_card .capabilities .extended_agent_card :
360+
361+ async def _handler (
362+ server_context : ServerCallContext ,
363+ ) -> a2a_v0_3_pb2 .AgentCard :
364+ req_v03 = types_v03 .GetAuthenticatedExtendedCardRequest (id = 0 )
365+ res_v03 = await self .handler03 .on_get_extended_agent_card (
366+ req_v03 , server_context
367+ )
368+ if res_v03 :
369+ return proto_utils .ToProto .agent_card (res_v03 )
370+ return compat_card
371+
372+ return await self ._handle_unary (
373+ context , _handler , a2a_v0_3_pb2 .AgentCard ()
374+ )
375+
376+ return compat_card
377+
359378 async def DeleteTaskPushNotificationConfig (
360379 self ,
361380 request : a2a_v0_3_pb2 .DeleteTaskPushNotificationConfigRequest ,
@@ -379,23 +398,3 @@ async def _handler(
379398 return empty_pb2 .Empty ()
380399
381400 return await self ._handle_unary (context , _handler , empty_pb2 .Empty ())
382-
383- async def GetExtendedCard (
384- self ,
385- request : a2a_v0_3_pb2 .GetAgentCardRequest ,
386- context : grpc .aio .ServicerContext ,
387- ) -> a2a_v0_3_pb2 .AgentCard :
388- """Get the authenticated extended agent card (v0.3)."""
389-
390- async def _handler (
391- server_context : ServerCallContext ,
392- ) -> a2a_v0_3_pb2 .AgentCard :
393- req_v03 = types_v03 .GetAuthenticatedExtendedCardRequest (id = 0 )
394- res_v03 = await self .handler03 .on_get_extended_agent_card (
395- req_v03 , server_context
396- )
397- return proto_utils .ToProto .agent_card (res_v03 )
398-
399- return await self ._handle_unary (
400- context , _handler , a2a_v0_3_pb2 .AgentCard ()
401- )
0 commit comments