Cross-Language Agent Communication via A2A Protocol
Connect Python ADK agents with remote microservices and workers written in Go or Java using the Agent-to-Agent (A2A) HTTP standard protocol.
Published on • 2026-07-30
AI Assistant

Subagent delegation in Google ADK works seamlessly inside a single process. However, enterprise software architectures often require agents to collaborate across distinct microservices, cloud accounts, or tech stacks — connecting a primary Python ADK agent with a high-performance backend worker written in Go, Rust, or Java.
The Agent-to-Agent (A2A) Protocol is an open standard that defines a unified HTTP/JSON communication protocol for AI agents. It standardizes payload structures, task lifecycles, and error contracts across language boundaries.
Challenges Solved by A2A
Without an open inter-agent standard, connecting agents across independent microservices requires:
- Designing custom REST or gRPC serialization schemas for every pair of agents
- Managing disparate authentication and session tracking schemes
- Building bespoke retry, state polling, and error-handling code
A2A solves this by standardizing the request payload, authentication headers, task lifecycle states, and response schemas.
Recipe: Python ADK Primary Agent Invoking a Remote Go Worker
The following Python ADK agent uses an async function tool wrapper to dispatch tasks to a remote microservice following the A2A HTTP standard:
import asyncio
import httpx
from google.adk.agents import Agent
from google.adk.tools import FunctionTool
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
# A2A Remote Microservice Wrapper Tool
async def call_remote_a2a_agent(task_description: str) -> dict:
"""Invokes a remote microservice agent using the Agent-to-Agent (A2A) HTTP Protocol.
Args:
task_description: The detailed task instruction payload for the remote worker.
"""
a2a_endpoint = "https://remote-worker.internal.net/a2a/v1/tasks"
payload = {
"protocol_version": "1.0",
"task": task_description,
"caller_agent": "adk_primary_harness",
"metadata": {
"environment": "production",
"priority": "high"
}
}
# Non-blocking async HTTP call to remote microservice
# async with httpx.AsyncClient() as client:
# response = await client.post(a2a_endpoint, json=payload, timeout=30.0)
# return response.json()
# Simulated A2A response payload
await asyncio.sleep(0.3)
return {
"status": "COMPLETED",
"remote_agent": "Go-Inventory-Worker-Service",
"task_id": "task-88392",
"result": f"Successfully completed optimization task: '{task_description}' across remote cluster."
}
a2a_tool = FunctionTool(func=call_remote_a2a_agent)
# Primary Coordinator Agent
primary_agent = Agent(
name="primary_coordinator",
model="gemini-2.5-flash",
instruction="Use `call_remote_a2a_agent` to delegate compute tasks to external microservice workers.",
tools=[a2a_tool]
)
async def main():
session_service = InMemorySessionService()
runner = Runner(agent=primary_agent, session_service=session_service)
res = await runner.run_async(
session_id="a2a-demo-session-01",
message="Dispatch a database index optimization task to the remote Go worker cluster."
)
print("Agent Response:\n", res.text)
if __name__ == "__main__":
asyncio.run(main())
Standard A2A Payload Specification
The standard A2A JSON request format structures task parameters as follows:
{
"protocol_version": "1.0",
"task": "Perform database index optimization across shard 4",
"caller_agent": "adk_primary_coordinator",
"metadata": {
"tenant_id": "org_881",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}
The corresponding A2A response standardizes status reporting:
{
"status": "COMPLETED",
"remote_agent": "Go-Inventory-Worker-Service",
"task_id": "task-88392",
"result": "Optimization completed successfully in 240ms."
}
Comparing Subagent Integration Approaches
| Feature / Metric | Native Subagents | A2A Protocol |
|---|---|---|
| Language Support | Single process (Python) | Cross-language (Python, Go, Java, Rust, Node.js) |
| Deployment Model | Monolithic process | Decoupled microservices / serverless functions |
| Latency | In-memory microsecond execution | Network HTTP/gRPC overhead (milliseconds) |
| Security Scope | Shared process permissions | Scoped OAuth2 / API Key tokens per endpoint |
Summary
The Agent-to-Agent (A2A) Protocol turns your Google ADK agent into a central coordinator across a polyglot microservice ecosystem. By adopting A2A, your Python agents can reliably delegate tasks to specialized Go, Rust, or Java services across organizational boundaries.