1- import logging
2-
31from collections .abc import Awaitable , Callable
42from typing import TYPE_CHECKING , Any
53
64
75if TYPE_CHECKING :
8- from starlette .middleware import Middleware
9- from starlette .routing import Route , Router
6+ from starlette .routing import Route
107
118 _package_starlette_installed = True
129else :
1310 try :
14- from starlette .middleware import Middleware
15- from starlette .routing import Route , Router
11+ from starlette .routing import Route
1612
1713 _package_starlette_installed = True
1814 except ImportError :
19- Middleware = Any
2015 Route = Any
21- Router = Any
2216
2317 _package_starlette_installed = False
2418
3024 JsonRpcDispatcher ,
3125)
3226from a2a .types .a2a_pb2 import AgentCard
33- from a2a .utils .constants import DEFAULT_RPC_URL
34-
35-
36- logger = logging .getLogger (__name__ )
3727
3828
3929def create_jsonrpc_routes ( # noqa: PLR0913
4030 agent_card : AgentCard ,
4131 request_handler : RequestHandler ,
32+ rpc_url : str ,
4233 extended_agent_card : AgentCard | None = None ,
4334 context_builder : CallContextBuilder | None = None ,
4435 card_modifier : Callable [[AgentCard ], Awaitable [AgentCard ] | AgentCard ]
@@ -48,7 +39,6 @@ def create_jsonrpc_routes( # noqa: PLR0913
4839 ]
4940 | None = None ,
5041 enable_v0_3_compat : bool = False ,
51- rpc_url : str = DEFAULT_RPC_URL ,
5242) -> list ['Route' ]:
5343 """Creates the Starlette Route for the A2A protocol JSON-RPC endpoint.
5444
@@ -60,6 +50,7 @@ def create_jsonrpc_routes( # noqa: PLR0913
6050 agent_card: The AgentCard describing the agent's capabilities.
6151 request_handler: The handler instance responsible for processing A2A
6252 requests via http.
53+ rpc_url: The URL prefix for the RPC endpoints.
6354 extended_agent_card: An optional, distinct AgentCard to be served
6455 at the authenticated extended card endpoint.
6556 context_builder: The CallContextBuilder used to construct the
@@ -71,7 +62,6 @@ def create_jsonrpc_routes( # noqa: PLR0913
7162 the extended agent card before it is served. It receives the
7263 call context.
7364 enable_v0_3_compat: Whether to enable v0.3 backward compatibility on the same endpoint.
74- rpc_url: The URL prefix for the RPC endpoints.
7565 """
7666 if not _package_starlette_installed :
7767 raise ImportError (
0 commit comments