Skip to content
Merged
16 changes: 10 additions & 6 deletions samples/hello_world_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
from a2a.compat.v0_3.grpc_handler import CompatGrpcHandler
from a2a.server.agent_execution.agent_executor import AgentExecutor
from a2a.server.agent_execution.context import RequestContext
from a2a.server.apps import A2AFastAPIApplication, A2ARESTFastAPIApplication
from a2a.server.apps import A2ARESTFastAPIApplication
from a2a.server.events.event_queue import EventQueue
from a2a.server.request_handlers import GrpcHandler
from a2a.server.request_handlers.default_request_handler import (
DefaultRequestHandler,
)
from a2a.server.routes import AgentCardRoutes, JsonRpcRoutes
from a2a.server.tasks.inmemory_task_store import InMemoryTaskStore
from a2a.server.tasks.task_updater import TaskUpdater
from a2a.types import (
Expand Down Expand Up @@ -197,14 +198,17 @@ async def serve(
)
rest_app = rest_app_builder.build()

jsonrpc_app_builder = A2AFastAPIApplication(
jsonrpc_routes = JsonRpcRoutes(
agent_card=agent_card,
request_handler=request_handler,
rpc_url='/a2a/jsonrpc/',
)
agent_card_routes = AgentCardRoutes(
agent_card=agent_card,
http_handler=request_handler,
enable_v0_3_compat=True,
)

app = FastAPI()
jsonrpc_app_builder.add_routes_to_app(app, rpc_url='/a2a/jsonrpc/')
app.routes.extend(jsonrpc_routes.routes)
app.routes.extend(agent_card_routes.routes)
app.mount('/a2a/rest', rest_app)

grpc_server = grpc.aio.server()
Expand Down
2 changes: 1 addition & 1 deletion src/a2a/compat/v0_3/jsonrpc_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
if TYPE_CHECKING:
from starlette.requests import Request

from a2a.server.apps.jsonrpc.jsonrpc_app import CallContextBuilder
from a2a.server.request_handlers.request_handler import RequestHandler
from a2a.server.routes import CallContextBuilder
from a2a.types.a2a_pb2 import AgentCard

_package_starlette_installed = True
Expand Down
5 changes: 1 addition & 4 deletions src/a2a/compat/v0_3/rest_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@

from a2a.compat.v0_3 import conversions
from a2a.compat.v0_3.rest_handler import REST03Handler
from a2a.server.apps.jsonrpc.jsonrpc_app import (
CallContextBuilder,
DefaultCallContextBuilder,
)
from a2a.server.apps.rest.rest_adapter import RESTAdapterInterface
from a2a.server.context import ServerCallContext
from a2a.server.routes import CallContextBuilder, DefaultCallContextBuilder
from a2a.utils.error_handlers import (
rest_error_handler,
rest_stream_error_handler,
Expand Down
10 changes: 0 additions & 10 deletions src/a2a/server/apps/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
"""HTTP application components for the A2A server."""

from a2a.server.apps.jsonrpc import (
A2AFastAPIApplication,
A2AStarletteApplication,
CallContextBuilder,
JSONRPCApplication,
)
from a2a.server.apps.rest import A2ARESTFastAPIApplication


__all__ = [
'A2AFastAPIApplication',
'A2ARESTFastAPIApplication',
'A2AStarletteApplication',
'CallContextBuilder',
'JSONRPCApplication',
]
20 changes: 0 additions & 20 deletions src/a2a/server/apps/jsonrpc/__init__.py

This file was deleted.

148 changes: 0 additions & 148 deletions src/a2a/server/apps/jsonrpc/fastapi_app.py

This file was deleted.

Loading
Loading