|
2 | 2 |
|
3 | 3 | from typing import TYPE_CHECKING, Any |
4 | 4 |
|
5 | | - |
6 | 5 | if TYPE_CHECKING: |
7 | | - from fastapi import FastAPI, Request, Response |
| 6 | + from fastapi import FastAPI |
8 | 7 |
|
9 | 8 | _package_fastapi_installed = True |
10 | 9 | else: |
11 | 10 | try: |
12 | | - from fastapi import FastAPI, Request, Response |
| 11 | + from fastapi import FastAPI |
13 | 12 |
|
14 | 13 | _package_fastapi_installed = True |
15 | 14 | except ImportError: |
16 | 15 | FastAPI = Any |
17 | | - Request = Any |
18 | | - Response = Any |
19 | 16 |
|
20 | 17 | _package_fastapi_installed = False |
21 | 18 |
|
@@ -90,22 +87,13 @@ def add_routes_to_app( |
90 | 87 | rpc_url: The URL for the A2A JSON-RPC endpoint. |
91 | 88 | extended_agent_card_url: The URL for the authenticated extended agent card endpoint. |
92 | 89 | """ |
93 | | - |
94 | | - @app.post(rpc_url) |
95 | | - async def handle_a2a_request(request: Request) -> Response: |
96 | | - return await self._handle_requests(request) |
97 | | - |
98 | | - @app.get(agent_card_url) |
99 | | - async def get_agent_card(request: Request) -> Response: |
100 | | - return await self._handle_get_agent_card(request) |
| 90 | + app.post(rpc_url)(self._handle_requests) |
| 91 | + app.get(agent_card_url)(self._handle_get_agent_card) |
101 | 92 |
|
102 | 93 | if self.agent_card.supportsAuthenticatedExtendedCard: |
103 | | - |
104 | | - @app.get(extended_agent_card_url) |
105 | | - async def get_extended_agent_card(request: Request) -> Response: |
106 | | - return await self._handle_get_authenticated_extended_agent_card( |
107 | | - request |
108 | | - ) |
| 94 | + app.get(extended_agent_card_url)( |
| 95 | + self._handle_get_authenticated_extended_agent_card |
| 96 | + ) |
109 | 97 |
|
110 | 98 | def build( |
111 | 99 | self, |
|
0 commit comments