Skip to content

Commit 7c2dfcf

Browse files
committed
Rename RESTApplication to RestAdapter since its purpose is to connect app frameworks to request handlers
- This avoids confusion between frameworks like fast api app and the rest application (which does not have any server hosting)
1 parent 44ffd7f commit 7c2dfcf

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

src/a2a/server/apps/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
CallContextBuilder,
77
JSONRPCApplication,
88
)
9-
from a2a.server.apps.rest import (
10-
A2ARESTFastAPIApplication,
11-
RESTApplication,
12-
)
9+
from a2a.server.apps.rest import A2ARESTFastAPIApplication
1310

1411

1512
__all__ = [
@@ -18,5 +15,4 @@
1815
'A2AStarletteApplication',
1916
'CallContextBuilder',
2017
'JSONRPCApplication',
21-
'RESTApplication',
2218
]
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"""A2A REST Applications."""
22

33
from a2a.server.apps.rest.fastapi_app import A2ARESTFastAPIApplication
4-
from a2a.server.apps.rest.rest_app import RESTApplication
54

65

76
__all__ = [
87
'A2ARESTFastAPIApplication',
9-
'RESTApplication',
108
]

src/a2a/server/apps/rest/fastapi_app.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from a2a.server.apps.jsonrpc.jsonrpc_app import (
88
CallContextBuilder,
99
)
10-
from a2a.server.apps.rest.rest_app import (
11-
RESTApplication,
10+
from a2a.server.apps.rest.rest_adapter import (
11+
RESTAdapter,
1212
)
1313
from a2a.server.request_handlers.request_handler import RequestHandler
1414
from a2a.types import AgentCard
@@ -44,7 +44,7 @@ def __init__(
4444
ServerCallContext passed to the http_handler. If None, no
4545
ServerCallContext is passed.
4646
"""
47-
self._handler = RESTApplication(
47+
self._adapter = RESTAdapter(
4848
agent_card=agent_card,
4949
http_handler=http_handler,
5050
context_builder=context_builder,
@@ -69,14 +69,14 @@ def build(
6969
"""
7070
app = FastAPI(**kwargs)
7171
router = APIRouter()
72-
for route, callback in self._handler.routes().items():
72+
for route, callback in self._adapter.routes().items():
7373
router.add_api_route(
7474
f'{rpc_url}{route[0]}', callback, methods=[route[1]]
7575
)
7676

7777
@router.get(f'{rpc_url}{agent_card_url}')
7878
async def get_agent_card(request: Request) -> Response:
79-
return await self._handler._handle_get_agent_card(request) # noqa: SLF001
79+
return await self._adapter._handle_get_agent_card(request) # noqa: SLF001
8080

8181
app.include_router(router)
8282
return app
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
logger = logging.getLogger(__name__)
2727

2828

29-
class RESTApplication:
30-
"""Base class for A2A REST applications.
29+
class RESTAdapter:
30+
"""Adapter to make RequestHandler work with RESTful API.
3131
3232
Defines REST requests processors and the routes to attach them too, as well as
3333
manages response generation including Server-Sent Events (SSE).

0 commit comments

Comments
 (0)