A guide to converting ADK agents with MCP to the A2A framework
In this hands-on engineering guide published on the Google Cloud Blog, I outline how to break down the boundaries of standalone AI applications by upgrading Google Agent Development Kit (ADK) agents into fully cooperative components using the Agent-to-Agent (A2A) framework.
By wrapping a standalone agent—specifically a MultiURLBrowser initialized with a firecrawl-mcp tool execution set—into the universal A2A protocol, we allow disparate agentic microservices to dynamically discover, communicate, and delegate tasks to one another.
Step-by-Step Refactoring Blueprint:
- Step 1: Define the Core Agent and its MCP Tool (
agent.py) The foundation relies on setting up the core execution logic. Insideagent.py, the_build_agentmethod initializes the foundational ADKLlmAgent(running ongemini-1.5-pro-preview-0514) and links its correspondingMCPToolsetto launch and manage thefirecrawl-mcpstdio server parameter requirements securely. - Step 2: Establish a Public Identity (
__main__.py) For secondary enterprise networks to seamlessly discover your microservice, it must broadcast its unique capabilities. This is achieved by creating an explicitAgentSkilldeclaration (specifying identifiers, descriptive schemas, and usage examples like web scraping execution intents) paired with anAgentCardmetadata anchor exposing endpoint networking variables. - Step 3: Implement the A2A Task Manager (
task_manager.py) The ultimate operational bridge relies on inheriting the A2A server’sAgentExecutorinterface. By overriding the asynchronousexecuteandcancelmethod loops, the manager intercepts remote pipeline invocations, wraps runtime state updates via a localizedTaskUpdater, and pushes streaming structural outputs back to the orchestration cluster smoothly.
Enjoy Reading This Article?
Here are some more articles you might like to read next: