99
1010from a2a .server .agent_execution .agent_executor import AgentExecutor
1111from a2a .server .agent_execution .context import RequestContext
12- from a2a .server .apps import A2AStarletteApplication
12+ from a2a .server .apps import A2AStarletteApplication , A2ARESTFastAPIApplication
1313from a2a .server .events .event_queue import EventQueue
1414from a2a .server .request_handlers .default_request_handler import (
1515 DefaultRequestHandler ,
@@ -202,6 +202,10 @@ def main() -> None:
202202 'url' : f'http://localhost:{ http_port } { JSONRPC_URL } ' ,
203203 'transport' : 'JSONRPC' ,
204204 },
205+ {
206+ 'url' : f'http://localhost:{ http_port } /a2a/rest' ,
207+ 'transport' : 'REST' ,
208+ },
205209 ],
206210 )
207211
@@ -210,12 +214,18 @@ def main() -> None:
210214 task_store = InMemoryTaskStore (),
211215 )
212216
213- server = A2AStarletteApplication (
217+ jsonrpc_server = A2AStarletteApplication (
218+ agent_card = agent_card ,
219+ http_handler = request_handler ,
220+ )
221+
222+ rest_server = A2ARESTFastAPIApplication (
214223 agent_card = agent_card ,
215224 http_handler = request_handler ,
216225 )
217226
218- app = server .build (rpc_url = JSONRPC_URL )
227+ app = jsonrpc_server .build (rpc_url = JSONRPC_URL )
228+ app .mount ('/a2a/rest' , rest_server .build ())
219229
220230 logger .info ('Starting HTTP server on port %s...' , http_port )
221231 uvicorn .run (app , host = '127.0.0.1' , port = http_port , log_level = 'info' )
0 commit comments