By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
When you have an agent running and want other agents to call it, you need to expose it over A2A and then figure out how to invoke it reliably. The protocol details are handled by SDKs, but understanding the flow—how a client discovers your agent, sends work, and polls for results—matters when debugging or integrating with existing systems.
Official SDKs exist for Python, JavaScript, Java, .NET, Go, and Rust. They manage card serialization, task storage, and streaming. Your responsibility is the agent logic itself and the skills you advertise. You don't write the wire protocol by hand unless you're debugging or learning.
Many frameworks can wrap an existing agent in an A2A server with minimal code. The Strands Agents SDK, for example, provides an A2AServer wrapper that exposes the Agent Card endpoint and handles incoming calls.
from strands import Agent
from strands.multiagent.a2a import A2AServer
billing = Agent(
name="Billing Agent",
description="Handles refunds and invoice questions",
tools=[lookup_invoice, issue_refund],
)
server = A2AServer(agent=billing, host="0.0.0.0", port=9000)
server.serve() # serves the Agent Card and the A2A endpointsReading raw HTTP calls clarifies what's actually happening. A client fetches the Agent Card from a well-known endpoint, extracts the RPC URL, sends a message with returnImmediately set to true (fire-and-forget), then polls GetTask until the task reaches a terminal or interrupted state.
import time, uuid, requests
BASE = "https://agents.example.com"
TERMINAL = {"TASK_STATE_COMPLETED", "TASK_STATE_FAILED",
"TASK_STATE_CANCELED", "TASK_STATE_REJECTED"}
INTERRUPTED = {"TASK_STATE_INPUT_REQUIRED", "TASK_STATE_AUTH_REQUIRED"}
card = requests.get(f"{BASE}/.well-known/agent-card.json", timeout=10).json()
rpc_url = next(i["url"] for i in card["supportedInterfaces"]
if i["protocolBinding"] == "JSONRPC")
def rpc(method, params, token=None):
headers = {"Authorization": f"Bearer {token}"} if token else {}
body = {"jsonrpc": "2.0", "id": str(uuid.uuid4()), "method": method, "params": params}
r = requests.post(rpc_url, json=body, headers=headers, timeout=30)
r.raise_for_status()
return r.json()["result"]
result = rpc("SendMessage", {
"message": {"role": "ROLE_USER", "messageId": str(uuid.uuid4()),
"parts": [{"text": "Refund order 4521"}]},
"configuration": {"returnImmediately": True},
}, token="...")
task = result["task"]
deadline = time.time() + 120 # ALWAYS bound the wait
while task["status"]["state"] not in TERMINAL | INTERRUPTED and time.time() < deadline:
time.sleep(2)
task = rpc("GetTask", {"id": task["id"]}, token="...")["task"]
print(task["status"]["state"], task.get("artifacts"))The key detail: always set a deadline for polling. The example uses 120 seconds. Without a bound, a hung task or network issue will block your caller indefinitely.
Field spellings follow the v1.0 data model, but SDK versions and servers differ in small ways. Prefer the official SDK in production and use raw HTTP for learning and debugging.
A practical pattern: create a local tool for each remote agent. The tool body does the card lookup, SendMessage call, and polling loop. Your supervisor agent then treats the remote agent as a normal tool, with timeouts, retries, and budgets applied consistently.
This abstraction keeps the supervisor simple. It doesn't care whether a tool runs locally or over the network; it only sees the same interface and enforces the same constraints.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.