File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 2121 RESTHandler ,
2222)
2323from a2a .types import (
24+ A2AError ,
2425 AgentCard ,
2526 InternalError ,
2627 InvalidRequestError ,
@@ -62,8 +63,8 @@ def __init__(
6263 )
6364 self ._context_builder = context_builder or DefaultCallContextBuilder ()
6465
65- def _generate_error_response (self , error ) -> JSONResponse :
66- """Creates a JSONResponse for a errors .
66+ def _generate_error_response (self , error : A2AError ) -> JSONResponse :
67+ """Creates a JSONResponse for an error .
6768
6869 Logs the error based on its type.
6970
@@ -179,6 +180,16 @@ async def handle_authenticated_agent_card(
179180 )
180181
181182 def routes (self ) -> dict [tuple [str , str ], Callable [[Request ], Any ]]:
183+ """Constructs a dictionary of API routes and their corresponding handlers.
184+
185+ This method maps URL paths and HTTP methods to the appropriate handler
186+ functions from the RESTHandler. It can be used by a web framework
187+ (like Starlette or FastAPI) to set up the application's endpoints.
188+
189+ Returns:
190+ A dictionary where each key is a tuple of (path, http_method) and
191+ the value is the callable handler for that route.
192+ """
182193 routes = {
183194 ('/v1/message:send' , 'POST' ): functools .partial (
184195 self ._handle_request , self .handler .on_message_send
You can’t perform that action at this time.
0 commit comments