From 6d3c6aec7c613ee7e688a5410e84334846b59fae Mon Sep 17 00:00:00 2001 From: arunpshankar <141447424+arunpshankar@users.noreply.github.com> Date: Mon, 10 Aug 2026 14:36:30 -0500 Subject: [PATCH] fix(a2a): declare a2a-sdk[http-server] so the a2a extra can serve The `a2a` extra installs `a2a-sdk` with no extras, which is enough to import the package but not to run the server. `sse-starlette` is only declared under a2a-sdk's `http-server`, `fastapi` and `all` extras, and every server dispatcher imports it at module level: a2a.server.routes.jsonrpc_dispatcher a2a.server.routes.rest_dispatcher a2a.compat.v0_3.jsonrpc_adapter `to_a2a()` builds an `A2AStarletteApplication`, which routes through the first of these, so a clean install of `google-adk[a2a]` raises ModuleNotFoundError: No module named 'sse_starlette' at startup. This is invisible during development because `mcp` requires sse-starlette, so any environment that has ever installed the `mcp` extra already satisfies it by accident. It surfaces on the first clean install - typically a container - and the runtime reports a failed startup probe on the port rather than the missing module. Repro, from an empty venv: pip install "a2a-sdk>=0.3.4,<2" # what the a2a extra installs python -c "import a2a.server.routes.jsonrpc_dispatcher" # ModuleNotFoundError: No module named 'sse_starlette' pip install "a2a-sdk[http-server]>=0.3.4,<2" python -c "import a2a.server.routes.jsonrpc_dispatcher" # ok `http-server` rather than a direct `sse-starlette` pin because it states the intent - ADK serves the A2A HTTP application - and leaves the transitive set to a2a-sdk. The extra exists at the pinned floor (0.3.4) and carries sse-starlette through the current 1.1.2, so it holds across the whole `>=0.3.4,<2` range. This is not the lazy-import case: the import is inside a2a-sdk, and it is needed to serve, not merely to import. It also leaves test_constructing_agent_defers_optional_mcp_server_stack unaffected - that asserts sse_starlette is not imported when constructing an Agent, which installing it does not change. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index da19c11bef..d14db5d0bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ dependencies = [ "websockets>=15.0.1,<16", ] optional-dependencies.a2a = [ - "a2a-sdk>=0.3.4,<2", + "a2a-sdk[http-server]>=0.3.4,<2", ] optional-dependencies.agent-identity = [ "google-cloud-agentidentitycredentials>=0.1,<0.2",