4747from a2a .utils .constants import (
4848 AGENT_CARD_WELL_KNOWN_PATH ,
4949 DEFAULT_RPC_URL ,
50- EXTENDED_AGENT_CARD_PATH ,
51- PREV_AGENT_CARD_WELL_KNOWN_PATH ,
5250)
5351from a2a .utils .errors import (
54- A2AException ,
52+ A2AError ,
5553 MethodNotImplementedError ,
5654 UnsupportedOperationError ,
5755)
@@ -247,7 +245,7 @@ def __init__( # noqa: PLR0913
247245 def _generate_error_response (
248246 self ,
249247 request_id : str | int | None ,
250- error : Exception | JSONRPCError | A2AException ,
248+ error : Exception | JSONRPCError | A2AError ,
251249 ) -> JSONResponse :
252250 """Creates a Starlette JSONResponse for a JSON-RPC error.
253251
@@ -260,7 +258,7 @@ def _generate_error_response(
260258 Returns:
261259 A `JSONResponse` object formatted as a JSON-RPC error response.
262260 """
263- if not isinstance (error , A2AException | JSONRPCError ):
261+ if not isinstance (error , A2AError | JSONRPCError ):
264262 error = InternalError (message = str (error ))
265263
266264 response_data = build_error_response (request_id , error )
@@ -578,14 +576,6 @@ async def _handle_get_agent_card(self, request: Request) -> JSONResponse:
578576 Returns:
579577 A JSONResponse containing the agent card data.
580578 """
581- if request .url .path == PREV_AGENT_CARD_WELL_KNOWN_PATH :
582- logger .warning (
583- "Deprecated agent card endpoint '%s' accessed. "
584- "Please use '%s' instead. This endpoint will be removed in a future version." ,
585- PREV_AGENT_CARD_WELL_KNOWN_PATH ,
586- AGENT_CARD_WELL_KNOWN_PATH ,
587- )
588-
589579 card_to_serve = self .agent_card
590580 if self .card_modifier :
591581 card_to_serve = await maybe_await (self .card_modifier (card_to_serve ))
@@ -597,62 +587,18 @@ async def _handle_get_agent_card(self, request: Request) -> JSONResponse:
597587 )
598588 )
599589
600- async def _handle_get_authenticated_extended_agent_card (
601- self , request : Request
602- ) -> JSONResponse :
603- """Handles GET requests for the authenticated extended agent card."""
604- logger .warning (
605- 'HTTP GET for authenticated extended card has been called by a client. '
606- 'This endpoint is deprecated in favor of agent/authenticatedExtendedCard JSON-RPC method and will be removed in a future release.'
607- )
608- if not self .agent_card .capabilities .extended_agent_card :
609- return JSONResponse (
610- {'error' : 'Extended agent card not supported or not enabled.' },
611- status_code = 404 ,
612- )
613-
614- card_to_serve = self .extended_agent_card
615-
616- if self .extended_card_modifier :
617- context = self ._context_builder .build (request )
618- # If no base extended card is provided, pass the public card to the modifier
619- base_card = card_to_serve if card_to_serve else self .agent_card
620- card_to_serve = await maybe_await (
621- self .extended_card_modifier (base_card , context )
622- )
623-
624- if card_to_serve :
625- return JSONResponse (
626- MessageToDict (
627- card_to_serve ,
628- preserving_proto_field_name = False ,
629- )
630- )
631- # If capabilities.extended_agent_card is true, but no
632- # extended_agent_card was provided, and no modifier produced a card,
633- # return a 404.
634- return JSONResponse (
635- {
636- 'error' : 'Authenticated extended agent card is supported but not configured on the server.'
637- },
638- status_code = 404 ,
639- )
640-
641590 @abstractmethod
642591 def build (
643592 self ,
644593 agent_card_url : str = AGENT_CARD_WELL_KNOWN_PATH ,
645594 rpc_url : str = DEFAULT_RPC_URL ,
646- extended_agent_card_url : str = EXTENDED_AGENT_CARD_PATH ,
647595 ** kwargs : Any ,
648596 ) -> FastAPI | Starlette :
649597 """Builds and returns the JSONRPC application instance.
650598
651599 Args:
652600 agent_card_url: The URL for the agent card endpoint.
653601 rpc_url: The URL for the A2A JSON-RPC endpoint.
654- extended_agent_card_url: The URL for the authenticated extended
655- agent card endpoint.
656602 **kwargs: Additional keyword arguments to pass to the FastAPI constructor.
657603
658604 Returns:
0 commit comments