{"slug": "updating-google-s-multi-agent-codelab-for-adk-2-0-and-a2a-1-x", "title": "Updating Google's Multi-Agent Codelab for ADK 2.0 and A2A 1.x", "summary": "A developer updated Google's \"Building a Multi-Agent System\" codelab to google-adk 2.15 and a2a-sdk 1.3, running on current Python and deployed to Cloud Run. The agent code itself was unchanged; the work centered on A2A serving and packaging, including ADK 2.0's new per-folder route mounting (which moves agent cards to /a2a/<name>/.well-known/agent-card.json), a2a-sdk 1.x's new agent-card shape and extra serving package, and fastapi's Python 3.11 requirement. The revised codelab ran end to end in Cloud Shell, locally and on Cloud Run.", "body_md": "This article provides a step by step guide to updating Google's \"Building a Multi-Agent System\" codelab for ADK 2.0 and later. Four agents research a topic, judge the research and write a course, and the orchestrator reaches the other three over A2A. The update moves them to google-adk 2.15 and a2a-sdk 1.3, runs them on the latest Python, and deploys them to Cloud Run.\n\n[https://github.com/xbill9/multi-agent-loop](https://github.com/xbill9/multi-agent-loop)\n\n**The agent code moved to ADK 2.0 unchanged; every change sits in the code that serves the agents over A2A, and in packaging.** ADK 2.0 mounts an agent's A2A routes under its folder name, a2a-sdk 1.x sends agent cards in a new shape and needs an extra package to serve them, and current fastapi needs Python 3.11. With those handled, the whole codelab ran end to end in Cloud Shell, locally and on Cloud Run.\n\nThe updated codelab: [https://xbill9.github.io/multi-agent-loop/building-a-multi-agent-system-adk2/](https://xbill9.github.io/multi-agent-loop/building-a-multi-agent-system-adk2/)\n\n| Agent | Built with | Role | Local port | \n|---|---|---|---|\n| Researcher | ADK `Agent` | Gathers information on the topic with Google Search | 8001 | \n| Judge | ADK `Agent` with`output_schema` | Returns `pass` or`fail` and feedback as a Pydantic model | 8002 | \n| Content builder | ADK `Agent` | Writes the course module from approved research | 8003 | \n| Orchestrator | `SequentialAgent` ,`LoopAgent` ,`RemoteA2aAgent` | Loops researcher and judge up to three times, then calls the content builder | 8004 | \n| Course creator | FastAPI web app | Streams the orchestrator's progress and shows the course | 8000 | \n\nEach agent is its own service. The orchestrator reads each remote agent's card from `/a2a/agent/.well-known/agent-card.json` and sends it messages over A2A. A custom `BaseAgent`, the escalation checker, ends the loop when the judge passes.\n\nThe repository holds two copies of the code: `codelab-starter/`, where the agent files carry `TODO` comments for attendees, and `codelab-complete/`, the finished version.\n\nOne `requirements.txt` covers all four agents and the web app:\n\n```\ncd multi-agent-loop/codelab-starter\npython3 -m pip install -r requirements.txt\nadk --version\nadk, version 2.15.0\n```\n\nThe pins are lower bounds at the newest releases, with no upper caps:\n\n```\na2a-sdk[http-server]>=1.3.1\nfastapi>=0.165.0\ngoogle-adk>=2.15.0\ngoogle-cloud-logging>=3.17.1\ngoogle-genai>=2.34.0\nhttpx>=0.28.1\nhttpx_sse>=0.4.3\nopentelemetry-exporter-gcp-trace>=1.15.0\nuvicorn>=0.54.0\n```\n\ngoogle-adk 2.15.0 declares `google-genai>=2.34,<3`, so `google-genai>=2.34.0` lets pip pick the newest release ADK accepts.\n\nIn Cloud Shell, which runs Python 3.12.3, pip installs into `~/.local` because Cloud Shell's pip configuration sets `break-system-packages`. pip then lists conflicts with tools Cloud Shell has preinstalled; the codelab uses none of them. The same install runs on the workstation's Python 3.14.7.\n\n`/a2a/agent`\nADK 2.0 treats a folder that contains `agent.py` as a single agent and takes the agent's name from the folder:\n\n```\n242:  is_single_agent = is_single_agent_directory(agents_path)\n247:    single_agent_name = agents_path.name\n248:    agents_dir = str(agents_path.parent)\n503:              prefix=f\"/a2a/{app_name}\",\n```\n\nEach agent starts from its own folder with `adk_app.py ... --a2a .`, so with `get_fast_api_app(a2a=True)` the researcher's card moves to `/a2a/researcher/.well-known/agent-card.json` and `/a2a/agent/...` answers 404. The orchestrator, the deploy script and the codelab all address `/a2a/agent`.\n\n`shared/adk_app.py` now builds the agent card and mounts the A2A routes itself, at a fixed prefix:\n\n``` php\nA2A_PREFIX = \"/a2a/agent\"\n\ndef _mount_a2a(app: typing.Any, agents_dir: str) -> None:\n    sys.path.insert(0, os.path.abspath(agents_dir))\n    agent = importlib.import_module(\"agent\").root_agent\n    if isinstance(agent, App):\n        agent = agent.root_agent\n\n    card = asyncio.run(AgentCardBuilder(\n        agent=agent,\n        rpc_url=f\"http://127.0.0.1{A2A_PREFIX}\",\n        capabilities=AgentCapabilities(streaming=True),\n    ).build())\n    runner = Runner(\n        app_name=agent.name,\n        agent=agent,\n        session_service=InMemorySessionService(),\n        artifact_service=InMemoryArtifactService(),\n        memory_service=InMemoryMemoryService(),\n    )\n    _compat.attach_a2a_routes_to_app(\n        app,\n        agent_card=card,\n        agent_executor=A2aAgentExecutor(runner=runner),\n        task_store=InMemoryTaskStore(),\n        push_config_store=InMemoryPushNotificationConfigStore(),\n        prefix=A2A_PREFIX,\n    )\n```\n\n`get_fast_api_app` is called without `a2a=True`, and `_mount_a2a(app, agents_dir)` runs right after it. The cards are back at the same path for every agent:\n\n```\n8001 researcher ['http://localhost:8001/a2a/agent']\n8002 judge ['http://localhost:8002/a2a/agent']\n8003 content_builder ['http://localhost:8003/a2a/agent']\n```\n\na2a-sdk 1.x builds agent cards as protobuf messages, so the card has no `model_dump_json()`. ADK's own helper writes either version to a dict:\n\n```\ncard_json = json.dumps(_compat.a2a_to_dict(agent_card), indent=2)\n```\n\nThe card lists its endpoints under `supportedInterfaces`:\n\n```\n{\"name\": \"researcher\", \"supportedInterfaces\": [{\"url\": \"http://127.0.0.1/a2a/researcher\", \"protocolBinding\": \"JSONRPC\", \"protocolVersion\": \"1.0\"}], \"capabilities\": {\"streaming\": true}}\n```\n\nThe codelab's middleware rewrites the card's address to the host the request came in on, which is what lets one card work on localhost and behind Cloud Run. It now rewrites both shapes:\n\n```\n# a2a-sdk 0.3.x keeps the endpoint in \"url\";\n# 1.x keeps one per entry in \"supportedInterfaces\".\nif \"url\" in card:\n    card[\"url\"] = rewrite(card[\"url\"])\nfor iface in card.get(\"supportedInterfaces\", []):\n    if \"url\" in iface:\n        iface[\"url\"] = rewrite(iface[\"url\"])\n```\n\n`a2a.utils.constants` in 1.3.1 defines only `AGENT_CARD_WELL_KNOWN_PATH`, so the two older card paths the middleware also matches, `/.well-known/agent.json` and `/agent/authenticatedExtendedCard`, are local constants.\n\n`adk run`\nIn ADK 2.0, `adk run` takes the message as an argument:\n\n```\nUsage: adk run [OPTIONS] AGENT [QUERY]\n```\n\nSo each agent can be checked in one command before the system is wired together:\n\n```\nadk run agents/judge \"Topic: Tokyo. Findings: Tokyo is a city.\"\n[judge]: {\"status\":\"fail\",\"feedback\":\"The finding 'Tokyo is a city' is far too brief and lacks the depth necessary to create a high-quality course. ...\nadk run agents/researcher \"Find the population of Tokyo in 2020\"\n[researcher]: The population of Tokyo in 2020 was approximately **14,047,594** people.\n```\n\n`run_local.sh` starts the agents with `python3` and the web app with `python3 -m uvicorn`:\n\n```\n./run_local.sh\n```\n\nIn Cloud Shell all five ports were listening 9 seconds after start. One prompt to the web app's stream endpoint:\n\n```\ncurl -sN -X POST http://localhost:8000/api/chat_stream \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"message\": \"Create a short course about the history of coffee\", \"user_id\": \"cs\"}'\nCounter({'progress': 24, 'result': 1})\nchars 36020 h2 42\n```\n\n24 progress events, then one course of 36,020 characters with 42 `##` sections.\n\n`requires-python = \">=3.11\"` for the Container Build\nThe agents run locally with pip, and the Dockerfiles install with `uv sync`. uv resolves for every Python version `requires-python` allows, so `>=3.10` fails against fastapi 0.165 in Cloud Build even though the container runs Python 3.12:\n\n```\nerror: No solution found when resolving dependencies for split (markers: python_full_version == '3.10.*')\n  cause: Because the requested Python version (>=3.10) does not satisfy Python>=3.11 and fastapi==0.165.0 depends on Python>=3.11, we can conclude that fastapi==0.165.0 cannot be used.\n```\n\nEvery `pyproject.toml` now has `requires-python = \">=3.11\"`, with no upper bound, and `uv lock` in each agent folder refreshes the lock files. `uv lock` only resolves and creates no virtual environment.\n\n`a2a-sdk[http-server]` for the A2A Routes\na2a-sdk 1.x imports `sse-starlette` when the A2A server routes load, and ships it only in extras:\n\n```\nsse-starlette; extra == 'all'\nsse-starlette; extra == 'fastapi'\nsse-starlette; extra == 'http-server'\n```\n\nA container built from plain `a2a-sdk` stops at startup:\n\n```\n  File \"/opt/venv/lib/python3.12/site-packages/a2a/compat/v0_3/jsonrpc_adapter.py\", line 6, in <module>\nModuleNotFoundError: No module named 'sse_starlette'\n```\n\nThe agents now depend on `a2a-sdk[http-server]>=1.3.1`. A workstation that already has `sse-starlette` installed for another project runs the agents either way, which is why the container is the place to check.\n\n`deploy.sh` deploys five services from source. The four agent services accept only authenticated calls, and the orchestrator reaches them with Google ID tokens; the web app is public:\n\n```\n./deploy.sh\nService URL: https://researcher-1056842563084.us-central1.run.app\nService URL: https://content-builder-1056842563084.us-central1.run.app\nService URL: https://judge-1056842563084.us-central1.run.app\nService URL: https://orchestrator-1056842563084.us-central1.run.app\nService URL: https://course-creator-1056842563084.us-central1.run.app\nDEPLOY_EXIT=0\n```\n\nOne prompt to the deployed web app, then each agent card fetched with no credentials:\n\n```\nhome: 200\nCounter({'progress': 14, 'result': 1})\nchars 25470 h2 12\nresearcher unauth: 403\njudge unauth: 403\ncontent-builder unauth: 403\norchestrator unauth: 403\n```\n\nThe codelab's last step deletes the five services:\n\n```\nfor s in course-creator orchestrator researcher judge content-builder; do\n  gcloud run services delete $s --region us-central1 --quiet\ndone\n```\n\nThe codelab text is one markdown file in claat format, `codelab/building-a-multi-agent-system-adk2.md`, exported to static HTML and served by GitHub Pages:\n\n```\nclaat export -o docs codelab/building-a-multi-agent-system-adk2.md\n```\n\nThe `googlecodelabs/tools` repository that holds claat is archived; `go install github.com/googlecodelabs/tools/claat@latest` still builds it, and the exported page loads its styles and scripts from `storage.googleapis.com/claat-public`.\n\nA shared workstation Python can satisfy an import that the container cannot. Building one agent image with `docker build` and starting it with the same command Cloud Run uses shows a missing package in a minute, where a source deploy shows it after a Cloud Build run and a failed revision.\n\n`requirements.txt`\nEach agent keeps its own `pyproject.toml` for its container. Attendees in Cloud Shell need all of them at once, and one file that merges them installs in a single command.\n\n`adk run agents/judge \"...\"` returns one answer and exits, which makes each agent testable from a script or a codelab step with its expected output printed underneath.\n\n|  | Original codelab | ADK 2.0 update | \n|---|---|---|\n| Packages | google-adk 1.x, a2a-sdk 0.3 | google-adk 2.15, a2a-sdk 1.3 with `[http-server]` | \n| Python | `>=3.10,<3.14` | `>=3.11` , no upper cap | \n| Local install | `uv sync` ,`uv run` | `pip install -r requirements.txt` | \n| A2A path | `/a2a/agent` from a card file | `/a2a/agent` mounted by`_mount_a2a` | \n| Card endpoint field | `url` | `supportedInterfaces[].url` | \n| Test one agent | interactive `adk run` | `adk run AGENT \"message\"` | \n| Agent code | four `agent.py` files | the same four files | \n\nWorkshops scheduled from now on should use the ADK 2.0 version, because a fresh `pip install google-adk` installs ADK 2.x. The original codelab stays correct for anyone pinned to google-adk 1.x and a2a-sdk 0.3.\n\nThe goal of this article was to move Google's multi-agent codelab to ADK 2.0 and A2A 1.x and keep it runnable from Cloud Shell. The key to the solution was serving each agent over A2A at a fixed `/a2a/agent` path, in the a2a-sdk 1.x card shape, with packaging that matches what the containers install. The results were:\n\n`agent.py` files run on google-adk 2.15 unchanged`requires-python = \">=3.10\"` and plain `a2a-sdk` both fail on Cloud Run, the first in Cloud Build and the second at container start\nThe checks ran on one Google Cloud project in `us-central1`, from one Cloud Shell VM (Python 3.12.3) and one workstation (Python 3.14.7), one end to end run each, with `gemini-3-flash-preview` on Vertex AI. The credit claim and new-project steps of the codelab were not run.\n\nThe strategy for updating a multi-agent A2A codelab to ADK 2.0 was validated with an incremental step by step approach.", "url": "https://wpnews.pro/news/updating-google-s-multi-agent-codelab-for-adk-2-0-and-a2a-1-x", "canonical_source": "https://dev.to/gde/updating-googles-multi-agent-codelab-for-adk-20-and-a2a-1x-4cpg", "published_at": "2026-11-24 20:34:20+00:00", "updated_at": "2026-11-24 20:44:22.532446+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools", "artificial-intelligence"], "entities": ["Google", "ADK", "A2A", "Cloud Run", "FastAPI", "Cloud Shell", "google-genai", "a2a-sdk"], "also_reported_by": [], "takeaway": "ADK 2.0 mounts A2A routes under the agent's folder name, so hardcoding /a2a/agent breaks; build the agent card and mount routes at a fixed prefix yourself, and add the extra package a2a-sdk 1.x needs to serve its new card shape.", "recommendation": {"advice": "When upgrading to ADK 2.0 and a2a-sdk 1.x, mount A2A routes at a fixed prefix and serve the new agent-card shape with the required extra package, since folder-based routing moves cards to /a2a/<name>/.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/updating-google-s-multi-agent-codelab-for-adk-2-0-and-a2a-1-x", "markdown": "https://wpnews.pro/news/updating-google-s-multi-agent-codelab-for-adk-2-0-and-a2a-1-x.md", "text": "https://wpnews.pro/news/updating-google-s-multi-agent-codelab-for-adk-2-0-and-a2a-1-x.txt", "jsonld": "https://wpnews.pro/news/updating-google-s-multi-agent-codelab-for-adk-2-0-and-a2a-1-x.jsonld"}}