File tree Expand file tree Collapse file tree 2 files changed +25
-37
lines changed
src/a2a/server/apps/jsonrpc Expand file tree Collapse file tree 2 files changed +25
-37
lines changed Original file line number Diff line number Diff line change @@ -434,39 +434,6 @@ async def _handle_get_authenticated_extended_agent_card(
434
434
status_code = 404 ,
435
435
)
436
436
437
- def _get_route_definitions (
438
- self ,
439
- agent_card_url : str ,
440
- rpc_url : str ,
441
- extended_agent_card_url : str ,
442
- ) -> list [dict [str , Any ]]:
443
- """Generates a list of route definitions for the application."""
444
- routes = [
445
- {
446
- 'path' : rpc_url ,
447
- 'endpoint' : self ._handle_requests ,
448
- 'methods' : ['POST' ],
449
- 'name' : 'a2a_handler' ,
450
- },
451
- {
452
- 'path' : agent_card_url ,
453
- 'endpoint' : self ._handle_get_agent_card ,
454
- 'methods' : ['GET' ],
455
- 'name' : 'agent_card' ,
456
- },
457
- ]
458
-
459
- if self .agent_card .supportsAuthenticatedExtendedCard :
460
- routes .append (
461
- {
462
- 'path' : extended_agent_card_url ,
463
- 'endpoint' : self ._handle_get_authenticated_extended_agent_card ,
464
- 'methods' : ['GET' ],
465
- 'name' : 'authenticated_extended_agent_card' ,
466
- }
467
- )
468
- return routes
469
-
470
437
@abstractmethod
471
438
def build (
472
439
self ,
Original file line number Diff line number Diff line change @@ -42,10 +42,31 @@ def routes(
42
42
Returns:
43
43
A list of Starlette Route objects.
44
44
"""
45
- route_definitions = self ._get_route_definitions (
46
- agent_card_url , rpc_url , extended_agent_card_url
47
- )
48
- return [Route (** route_def ) for route_def in route_definitions ]
45
+ app_routes = [
46
+ Route (
47
+ rpc_url ,
48
+ self ._handle_requests ,
49
+ methods = ['POST' ],
50
+ name = 'a2a_handler' ,
51
+ ),
52
+ Route (
53
+ agent_card_url ,
54
+ self ._handle_get_agent_card ,
55
+ methods = ['GET' ],
56
+ name = 'agent_card' ,
57
+ ),
58
+ ]
59
+
60
+ if self .agent_card .supportsAuthenticatedExtendedCard :
61
+ app_routes .append (
62
+ Route (
63
+ extended_agent_card_url ,
64
+ self ._handle_get_authenticated_extended_agent_card ,
65
+ methods = ['GET' ],
66
+ name = 'authenticated_extended_agent_card' ,
67
+ )
68
+ )
69
+ return app_routes
49
70
50
71
def add_routes_to_app (
51
72
self ,
You can’t perform that action at this time.
0 commit comments