← Back to list

Deep Dive Agent-to-Agent (A2A) Protocol: A Hands-On Guide

Ever wondered how your smart AI assistants could talk to each other? That’s precisely what Agent-to-Agent (A2A) protocol enables! In a…

Nihal Jain · 2025-07-13 20:21 · 0 claps · 14.1 min read
#a2a #agent2agent #agent2agent-protocol #agents
Open on Medium ↗
Wiki topics: AGT · AI Agents AI · AI · General

Deep Dive into Agent-to-Agent (A2A) Protocol: A Hands-On Guide

Ever wondered how your smart AI assistants could talk to each other? That’s precisely what Agent-to-Agent (A2A) protocol enables! In a world where specialized AI agents, from travel planners to hotel bookers, need to collaborate, A2A provides a standardized way for them to discover, authenticate, and communicate securely and efficiently.

Think of A2A as the “internet protocol” for AI agents: it governs how agents introduce themselves, establish secure channels, and interact. As AI systems grow increasingly specialized, it’s no longer practical for one monolithic assistant to handle everything. Instead, we need to have coordinated agent ecosystems, each contributing its strengths.

Let’s say you want your assistant to plan an international trip. It might need to collaborate with:

  • A flight booking agent
  • A hotel reservation agent
  • A local tour recommendation agent

Each agent may be owned by different vendors or teams. Without A2A, integrating them requires fragile pipelines. A2A eliminates this friction by offering a shared protocol.

In this guide, you’ll learn:

  • What A2A is and why it’s essential
  • Its core concepts and architecture
  • How communication is structured in A2A
  • How to build and orchestrate agents with a Python demo

Lazy to read? Enjoy a podcast version of this blog on Spotify!

Why A2A Protocols Matter

The Problem

Without a standardized protocol, agents must rely on custom integrations. This makes systems fragile, unscalable, and expensive to maintain, just like trying to coordinate a team where everyone speaks a different language.

The Solution

Using A2A protocol offers significant advantages over relying on custom integrations for AI agent collaboration:

  • Interoperability: Any A2A-compliant agent can communicate with any other, regardless of their underlying technology or vendor. This eliminates the need for connectors for every new agent pairing.
  • Scalability: A2A supports large networks of loosely coupled agents, making it easier to expand and manage complex AI ecosystems. Custom integrations often become bottlenecks as the number of agents grows.
  • Reduced Fragility and Maintenance: Custom integrations are often brittle and break easily with changes in any integrated system. A2A’s standardized approach makes systems more robust and less expensive to maintain.
  • Asynchronous Messaging: A2A is built for long-running or deferred tasks, which is ideal for many AI operations. Custom solutions might struggle with managing state and responses for such tasks.
  • Enhanced Security and Trust: A2A includes built-in features for encrypted channels, identity verification, etc., providing a secure foundation for inter-agent communication, which is often an afterthought in custom solutions.

This transforms agents from siloed workers to collaborative digital colleagues.

A2A Protocol in Depth

The Agent2Agent (A2A) Protocol is designed with simplicity, enterprise readiness, asynchronous communication, and modality agnosticism in mind. Its core principles include leveraging existing web standards like HTTP and JSON-RPC 2.0, supporting tracing, authentication, and privacy for real-world applications, and being flexible enough to handle various data types (text, files, structured data) and streaming updates. Agents expose their capabilities without revealing internal logic, promoting a black-box interaction.

Common features of A2A include:

  • Transport & Format: JSON-RPC 2.0 over HTTP(S)
  • Discovery via Agent Cards: Self-describing JSON metadata published at well-known URLs
  • Task Lifecycle: Support for long-running, stateful workflows
  • Multi-modality: Text, files, structured data, streaming updates
  • Security: Encrypted channels, identity verification, and scoped access

Core Actors in A2A

Every A2A interaction revolves around a few essential participants. These actors each play a specific role in facilitating structured, secure agent communication: whether initiating tasks, routing requests, or executing services. Understanding these roles is key to grasping how agent collaboration unfolds.

  • User: This can be a human or an external service that initiates a goal or a task that needs to be accomplished by the AI agents.
  • A2A Client (Client Agent): This agent acts on behalf of the user, initiating communication and orchestrating tasks among other agents. It’s the one that sends requests to remote agents.
  • A2A Server (Remote Agent): This is the service that receives structured tasks from a client, performs them, and then sends back responses. The client views the server as a “black box” that advertises specific skills it can perform.

Fundamental Elements of A2A Communication

These are the core building blocks of A2A interactions. They define how agents describe themselves, how tasks are defined, and how content and results are structured and exchanged.

  • Agent Card: A JSON file located at a standard URL (/.well-known/agent.json) that acts as a machine-readable “business card” for an agent. It describes the agent’s identity, version, endpoint, available skills, capabilities, and authentication methods.
  • Task: Represents a self-contained unit of work with a defined lifecycle (submitted, working, input-required, completed/failed). Each task has a unique ID and can involve multiple messages exchanged over time.
  • Message: A single turn of communication within a task, carrying a messageId and containing one or more Part objects. Messages indicate the role of the sender (user or agent).
  • Part: The smallest unit of content within a message or artifact. There are different kinds of parts: TextPart for plain text, FilePart for files (via base64 or URI), and DataPart for structured JSON.
  • Artifact: A tangible result produced by an agent in response to a task. An artifact can contain one or more Part objects and can be streamed incrementally as it is generated.

How A2A Client–Server Communication Works?

The A2A client-server communication unfolds in a structured sequence of steps:

  1. Discovery: The Client Agent first fetches the Remote Agent’s “Agent Card” from its well-known URL. This card provides the client with essential information about the remote agent’s capabilities and how to interact with it.
  2. Task Assignment: The Client Agent then sends a structured JSON-RPC task request to the Remote Agent, detailing the work it needs done.
  3. Communication: As the Remote Agent processes the task, it may send messages back to the client to clarify questions or request additional information, enabling multi-turn conversations.
  4. Task Progress: The Remote Agent keeps the client updated on the task’s status, sending back incremental status updates, potentially streaming them in real-time.
  5. Completion: Once the task is finished, the final result is sent back to the client as an “Artifact,” and the task’s status is updated to ‘completed’ or ‘failed’.

How does A2A support multi-agent orchestration for complex workflows?

A2A protocol is designed to facilitate complex workflows that involve multiple specialized agents working together. Instead of a single monolithic AI, A2A allows a client agent to coordinate and delegate tasks across various remote agents. For example, planning an international trip might involve a flight booking agent, a hotel reservation agent, a local tour agent, and a currency conversion agent.

The client acts as the orchestrator, discovering the capabilities of each specialized agent via their Agent Cards, sending them specific parts of a larger task, and then synthesizing the results received from each agent to achieve the overall goal. This enables the creation of highly capable and flexible AI systems by leveraging the strengths of diverse, loosely coupled agents.

The Python demo in following section will showcase this by having a client interact with both a “HelloWorldAgent” and a “CurrencyAgent” to demonstrate how these independent agents can be orchestrated to perform different parts of a larger interaction.

Hands-On with A2A in Python

To bring these concepts to life, let’s explore a working A2A system in action. In this section, you’ll set up agents, run a sample client, and see how discovery, messaging, and orchestration play out in real-time. Whether you’re testing basic skills or coordinating multi-agent flows, this hands-on section will ground the theory in executable code.

🛠 Setup

Let’s start by setting up your local environment. This includes cloning the project and installing required packages to get your agents running.

Requirements:

  • Python 3.12+
  • pip & Git
git clone https://github.com/NihalJain/agentic_ai_starter_kit.git
cd agentic-ai-learning-kit
python3 -m venv .venv
source .venv/bin/activate
pip install -r a2a/requirements.txt

Create a .env file in root of the project with following:

git clone https://github.com/NihalJain/agentic-ai-learning-kit.git
cd agentic-ai-learning-kit
python3 -m venv .venv
source .venv/bin/activate
pip install -r a2a/requirements.txt

Swicth to a2a folder

cd a2a

🤖 HelloWorldAgent

This minimal agent introduces you to A2A basics: reading an Agent Card, invoking a skill, and receiving a response. It’s your “Hello, World” for agent communication.

Start the agent:

python agents/hello_world_agent/server.py

Run the client:

python clients/a2a_single_agent_client_demo.py 9999

Output:

Starting Single-Agent Demo...
Attempting to fetch public agent card from: http://localhost:9999/.well-known/agent.json
Successfully fetched public agent card.
╭─────────────────────────────────── Agent Card ────────────────────────────────────╮
│   Name             Hello World Agent                                              │
│   Description      Just a hello world agent                                       │
│   URL              http://localhost:9999/                                         │
│   Version          1.0.0                                                          │
│   Streaming        True                                                           │
│   Supports Auth    True                                                           │
│   Skills            ID           Name                 Description                 │
│                     hello_world  Returns hello world  Just returns hello world    │
╰───────────────────────────────────────────────────────────────────────────────────╯
Attempting to fetch authenticated extended card...
Successfully fetched authenticated extended agent card.
╭──────────────────────────────────────────────────────────── Agent Card ────────────────────────────────────────────────────────────╮
│   Name             Hello World Agent - Extended Edition                                                                            │
│   Description      The full-featured hello world agent for authenticated users.                                                    │
│   URL              http://localhost:9999/                                                                                          │
│   Version          1.0.1                                                                                                           │
│   Streaming        True                                                                                                            │
│   Supports Auth    True                                                                                                            │
│   Skills            ID                 Name                         Description                                                    │
│                     hello_world        Returns hello world          Just returns hello world                                       │
│                     super_hello_world  Returns a SUPER Hello World  A more enthusiastic greeting, only for authenticated users.    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
A2AClient initialized!
Conversation Flow
╭──────────────── Sent Streaming Message ────────────────╮
│   Request ID    0eadd4e5-bf67-4ea7-bd25-7c286790ba9d   │
│   Role          user                                   │
│   Message ID    b2365e58b41841dca1d3067e8cd3107b       │
│   Content       how much is 10 USD in INR?             │
╰────────────────────────────────────────────────────────╯
╭─────────────────────────────────────────────────────────────────────────────────────────────────────── Streaming Response ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ {                                                                                                                                                                                                                                │
│     'id': '0eadd4e5-bf67-4ea7-bd25-7c286790ba9d',                                                                                                                                                                                │
│     'jsonrpc': '2.0',                                                                                                                                                                                                            │
│     'result': {                                                                                                                                                                                                                  │
│         'kind': 'message',                                                                                                                                                                                                       │
│         'messageId': 'cdf0376f-624b-46ea-8210-52c983771bda',                                                                                                                                                                     │
│         'parts': [{'kind': 'text', 'text': 'Hello World, this is Nihal Jain and you got a response from the HelloWorldAgent!'}],                                                                                                 │
│         'role': 'agent'                                                                                                                                                                                                          │
│     }                                                                                                                                                                                                                            │
│ }                                                                                                                                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Observe:

  • Client reads the public agent card with a list of available skills.
  • Also, displays the agents’ extended card.
  • Sends a message to HelloWorldAgent
  • Receives a structured response: “Hello World, this is Nihal Jain and you got a response from the HelloWorldAgent!”

Try yourself:

💲CurrencyAgent: Streaming & Follow-ups

Next, let’s explore more advanced interactions like streaming updates and multi-turn conversations.

Start the server:

python agents/currency_agent/server.py

Run the client:

python clients/a2a_single_agent_client_demo.py 10000

Try asking:

how much is 10 USD in INR?

Output:

python clients/a2a_single_agent_client_demo.py 10000
Starting Single-Agent Demo...
Attempting to fetch public agent card from: http://localhost:10000/.well-known/agent.json
Successfully fetched public agent card.
╭─────────────────────────────────────────────────────────── Agent Card ────────────────────────────────────────────────────────────╮
│   Name                  Currency Agent                                                                                            │
│   Description           Helps with exchange rates for currencies                                                                  │
│   URL                   http://localhost:10000/                                                                                   │
│   Version               1.0.0                                                                                                     │
│   Streaming             True                                                                                                      │
│   Push Notifications    True                                                                                                      │
│   Supports Auth         None                                                                                                      │
│   Skills                 ID                Name                          Description                                              │
│                          convert_currency  Currency Exchange Rates Tool  Helps with exchange values between various currencies    │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
A2AClient initialized!
Conversation Flow
╭──────────────── Sent Streaming Message ────────────────╮
│   Request ID    c7ce89b5-7fb5-44c5-b4c1-7a2475ba861b   │
│   Role          user                                   │
│   Message ID    71f7359ca08946369b233c69a44482a8       │
│   Content       how much is 10 USD in INR?             │
╰────────────────────────────────────────────────────────╯
╭──────────────────────────────── Streaming Response ────────────────────────────────╮
│ {                                                                                  │
│     'id': 'c7ce89b5-7fb5-44c5-b4c1-7a2475ba861b',                                  │
│     'jsonrpc': '2.0',                                                              │
│     'result': {                                                                    │
│         'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',                       │
│         'history': [                                                               │
│             {                                                                      │
│                 'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',               │
│                 'kind': 'message',                                                 │
│                 'messageId': '71f7359ca08946369b233c69a44482a8',                   │
│                 'parts': [                                                         │
│                     {'kind': 'text', 'text': 'how much is 10 USD in INR?'}         │
│                 ],                                                                 │
│                 'role': 'user',                                                    │
│                 'taskId': '80552221-197d-4ad5-b940-2290ad203f21'                   │
│             }                                                                      │
│         ],                                                                         │
│         'id': '80552221-197d-4ad5-b940-2290ad203f21',                              │
│         'kind': 'task',                                                            │
│         'status': {'state': 'submitted'}                                           │
│     }                                                                              │
│ }                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────────── Streaming Response ───────────────────────────────────╮
│ {                                                                                        │
│     'id': 'c7ce89b5-7fb5-44c5-b4c1-7a2475ba861b',                                        │
│     'jsonrpc': '2.0',                                                                    │
│     'result': {                                                                          │
│         'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',                             │
│         'final': False,                                                                  │
│         'kind': 'status-update',                                                         │
│         'status': {                                                                      │
│             'message': {                                                                 │
│                 'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',                     │
│                 'kind': 'message',                                                       │
│                 'messageId': 'a3131821-075f-4d79-8f24-31087fc69c55',                     │
│                 'parts': [                                                               │
│                     {'kind': 'text', 'text': 'Looking up the exchange rates...'}         │
│                 ],                                                                       │
│                 'role': 'agent',                                                         │
│                 'taskId': '80552221-197d-4ad5-b940-2290ad203f21'                         │
│             },                                                                           │
│             'state': 'working',                                                          │
│             'timestamp': '2025-07-13T16:29:04.573154+00:00'                              │
│         },                                                                               │
│         'taskId': '80552221-197d-4ad5-b940-2290ad203f21'                                 │
│     }                                                                                    │
│ }                                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────── Streaming Response ───────────────────────────────────╮
│ {                                                                                       │
│     'id': 'c7ce89b5-7fb5-44c5-b4c1-7a2475ba861b',                                       │
│     'jsonrpc': '2.0',                                                                   │
│     'result': {                                                                         │
│         'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',                            │
│         'final': False,                                                                 │
│         'kind': 'status-update',                                                        │
│         'status': {                                                                     │
│             'message': {                                                                │
│                 'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',                    │
│                 'kind': 'message',                                                      │
│                 'messageId': '07e716f7-dbc1-493b-b141-d2d4d649697f',                    │
│                 'parts': [                                                              │
│                     {'kind': 'text', 'text': 'Processing the exchange rates..'}         │
│                 ],                                                                      │
│                 'role': 'agent',                                                        │
│                 'taskId': '80552221-197d-4ad5-b940-2290ad203f21'                        │
│             },                                                                          │
│             'state': 'working',                                                         │
│             'timestamp': '2025-07-13T16:29:05.340666+00:00'                             │
│         },                                                                              │
│         'taskId': '80552221-197d-4ad5-b940-2290ad203f21'                                │
│     }                                                                                   │
│ }                                                                                       │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────────────────────────────────────────────────────────────────────── Streaming Response ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ {                                                                                                                                                                                                                 │
│     'id': 'c7ce89b5-7fb5-44c5-b4c1-7a2475ba861b',                                                                                                                                                                 │
│     'jsonrpc': '2.0',                                                                                                                                                                                             │
│     'result': {                                                                                                                                                                                                   │
│         'artifact': {                                                                                                                                                                                             │
│             'artifactId': 'c36698f7-e390-4b07-99b6-6a61947d6921',                                                                                                                                                 │
│             'name': 'conversion_result',                                                                                                                                                                          │
│             'parts': [{'kind': 'text', 'text': '10 USD is approximately 858.30 INR at the current exchange rate.'}]                                                                                               │
│         },                                                                                                                                                                                                        │
│         'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',                                                                                                                                                      │
│         'kind': 'artifact-update',                                                                                                                                                                                │
│         'taskId': '80552221-197d-4ad5-b940-2290ad203f21'                                                                                                                                                          │
│     }                                                                                                                                                                                                             │
│ }                                                                                                                                                                                                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────── Streaming Response ───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮        
│ {                                                                                                                                                                                                                                                │        
│     'id': 'c7ce89b5-7fb5-44c5-b4c1-7a2475ba861b',                                                                                                                                                                                                │        
│     'jsonrpc': '2.0',                                                                                                                                                                                                                            │        
│     'result': {                                                                                                                                                                                                                                  │        
│         'contextId': 'c62653fd-31f0-47e8-a0ef-80a0e65c776d',                                                                                                                                                                                     │        
│         'final': True,                                                                                                                                                                                                                           │        
│         'kind': 'status-update',                                                                                                                                                                                                                 │        
│         'status': {'state': 'completed', 'timestamp': '2025-07-13T16:29:07.546525+00:00'},                                                                                                                                                       │        
│         'taskId': '80552221-197d-4ad5-b940-2290ad203f21'                                                                                                                                                                                         │        
│     }                                                                                                                                                                                                                                            │        
│ }                                                                                                                                                                                                                                                │        
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯        
Using previous task_id and contextId to showcase multiturn conversation

>>

Observe:

  • Streaming feedback (“Looking up the exchange rates…”)
  • Task processing flow
  • Artifacts generated by the task
  • Follow-up questions supported via multi-turn messaging

Try yourself:

  • Ask follow up questions
  • Ask vague questions without all required details
  • Corrupt you API key and see how an error looks like

🔁 Multi-Agent Orchestration

Now, you’ll experience how a single client can coordinate workflows across multiple agents. This simulates a real-world workflow with specialized agents contributing their part.

Start both agents, then:

python clients/a2a_multi_agent_client_demo.py

Output:

python clients/a2a_multi_agent_client_demo.py
Starting Multi-Agent Demo...

Step 1: Interacting with HelloWorldAgent on port 9999
Attempting to fetch public agent card from: http://localhost:9999/.well-known/agent.json
Successfully fetched public agent card.
╭─────────────────────────────────── Agent Card ────────────────────────────────────╮
│   Name             Hello World Agent                                              │
│   Description      Just a hello world agent                                       │
│   URL              http://localhost:9999/                                         │
│   Version          1.0.0                                                          │
│   Streaming        True                                                           │
│   Supports Auth    True                                                           │
│   Skills            ID           Name                 Description                 │
│                     hello_world  Returns hello world  Just returns hello world    │
╰───────────────────────────────────────────────────────────────────────────────────╯
Attempting to fetch authenticated extended card...
Successfully fetched authenticated extended agent card.
╭──────────────────────────────────────────────────────────── Agent Card ────────────────────────────────────────────────────────────╮
│   Name             Hello World Agent - Extended Edition                                                                            │
│   Description      The full-featured hello world agent for authenticated users.                                                    │
│   URL              http://localhost:9999/                                                                                          │
│   Version          1.0.1                                                                                                           │
│   Streaming        True                                                                                                            │
│   Supports Auth    True                                                                                                            │
│   Skills            ID                 Name                         Description                                                    │
│                     hello_world        Returns hello world          Just returns hello world                                       │
│                     super_hello_world  Returns a SUPER Hello World  A more enthusiastic greeting, only for authenticated users.    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────── Sent Message ─────────────────────╮
│   Request ID    d92c82d7-d83f-4c88-a634-e7db019aef50   │
│   Role          user                                   │
│   Message ID    9dc1c4280a4b41d09a0fa126405780bd       │
│   Content       Hello                                  │
╰────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────── Response from HelloWorldAgent ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ {                                                                                                                                                                                                                                │
│     'id': 'd92c82d7-d83f-4c88-a634-e7db019aef50',                                                                                                                                                                                │
│     'jsonrpc': '2.0',                                                                                                                                                                                                            │
│     'result': {                                                                                                                                                                                                                  │
│         'kind': 'message',                                                                                                                                                                                                       │
│         'messageId': '116c3f8a-268b-4584-aea3-075162521ce5',                                                                                                                                                                     │
│         'parts': [{'kind': 'text', 'text': 'Hello World, this is Nihal Jain and you got a response from the HelloWorldAgent!'}],                                                                                                 │
│         'role': 'agent'                                                                                                                                                                                                          │
│     }                                                                                                                                                                                                                            │
│ }                                                                                                                                                                                                                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Step 2: Interacting with CurrencyAgent on port 10000
Attempting to fetch public agent card from: http://localhost:10000/.well-known/agent.json
Successfully fetched public agent card.
╭─────────────────────────────────────────────────────────── Agent Card ────────────────────────────────────────────────────────────╮
│   Name                  Currency Agent                                                                                            │
│   Description           Helps with exchange rates for currencies                                                                  │
│   URL                   http://localhost:10000/                                                                                   │
│   Version               1.0.0                                                                                                     │
│   Streaming             True                                                                                                      │
│   Push Notifications    True                                                                                                      │
│   Supports Auth         None                                                                                                      │
│   Skills                 ID                Name                          Description                                              │
│                          convert_currency  Currency Exchange Rates Tool  Helps with exchange values between various currencies    │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭──────────────── Sent Streaming Message ────────────────╮
│   Request ID    07b34dbd-7d37-4069-9be7-df76dc31dbea   │
│   Role          user                                   │
│   Message ID    0130b732d896453c9f688c9f336174b5       │
│   Content       how much is 25 USD in INR?             │
╰────────────────────────────────────────────────────────╯
╭────────────────────── Streaming Response from CurrencyAgent ───────────────────────╮
│ {                                                                                  │
│     'id': '07b34dbd-7d37-4069-9be7-df76dc31dbea',                                  │
│     'jsonrpc': '2.0',                                                              │
│     'result': {                                                                    │
│         'contextId': '5c30405f-e962-494a-bb36-16054b992720',                       │
│         'history': [                                                               │
│             {                                                                      │
│                 'contextId': '5c30405f-e962-494a-bb36-16054b992720',               │
│                 'kind': 'message',                                                 │
│                 'messageId': '0130b732d896453c9f688c9f336174b5',                   │
│                 'parts': [                                                         │
│                     {'kind': 'text', 'text': 'how much is 25 USD in INR?'}         │
│                 ],                                                                 │
│                 'role': 'user',                                                    │
│                 'taskId': '2bd183db-480a-4e4c-afcb-fec5b264b3ee'                   │
│             }                                                                      │
│         ],                                                                         │
│         'id': '2bd183db-480a-4e4c-afcb-fec5b264b3ee',                              │
│         'kind': 'task',                                                            │
│         'status': {'state': 'submitted'}                                           │
│     }                                                                              │
│ }                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────── Streaming Response from CurrencyAgent ──────────────────────────╮
│ {                                                                                        │
│     'id': '07b34dbd-7d37-4069-9be7-df76dc31dbea',                                        │
│     'jsonrpc': '2.0',                                                                    │
│     'result': {                                                                          │
│         'contextId': '5c30405f-e962-494a-bb36-16054b992720',                             │
│         'final': False,                                                                  │
│         'kind': 'status-update',                                                         │
│         'status': {                                                                      │
│             'message': {                                                                 │
│                 'contextId': '5c30405f-e962-494a-bb36-16054b992720',                     │
│                 'kind': 'message',                                                       │
│                 'messageId': 'dcde9681-e29d-4ce5-81fc-c38b5dc504f7',                     │
│                 'parts': [                                                               │
│                     {'kind': 'text', 'text': 'Looking up the exchange rates...'}         │
│                 ],                                                                       │
│                 'role': 'agent',                                                         │
│                 'taskId': '2bd183db-480a-4e4c-afcb-fec5b264b3ee'                         │
│             },                                                                           │
│             'state': 'working',                                                          │
│             'timestamp': '2025-07-13T16:33:56.863823+00:00'                              │
│         },                                                                               │
│         'taskId': '2bd183db-480a-4e4c-afcb-fec5b264b3ee'                                 │
│     }                                                                                    │
│ }                                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────── Streaming Response from CurrencyAgent ─────────────────────────╮
│ {                                                                                       │
│     'id': '07b34dbd-7d37-4069-9be7-df76dc31dbea',                                       │
│     'jsonrpc': '2.0',                                                                   │
│     'result': {                                                                         │
│         'contextId': '5c30405f-e962-494a-bb36-16054b992720',                            │
│         'final': False,                                                                 │
│         'kind': 'status-update',                                                        │
│         'status': {                                                                     │
│             'message': {                                                                │
│                 'contextId': '5c30405f-e962-494a-bb36-16054b992720',                    │
│                 'kind': 'message',                                                      │
│                 'messageId': '8514d8c3-6c4b-4fc6-bde9-4dc666a5a73e',                    │
│                 'parts': [                                                              │
│                     {'kind': 'text', 'text': 'Processing the exchange rates..'}         │
│                 ],                                                                      │
│                 'role': 'agent',                                                        │
│                 'taskId': '2bd183db-480a-4e4c-afcb-fec5b264b3ee'                        │
│             },                                                                          │
│             'state': 'working',                                                         │
│             'timestamp': '2025-07-13T16:33:57.396430+00:00'                             │
│         },                                                                              │
│         'taskId': '2bd183db-480a-4e4c-afcb-fec5b264b3ee'                                │
│     }                                                                                   │
│ }                                                                                       │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────── Streaming Response from CurrencyAgent ──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ {                                                                                                                                                                                                                                        │
│     'id': '07b34dbd-7d37-4069-9be7-df76dc31dbea',                                                                                                                                                                                        │
│     'jsonrpc': '2.0',                                                                                                                                                                                                                    │
│     'result': {                                                                                                                                                                                                                          │
│         'artifact': {                                                                                                                                                                                                                    │
│             'artifactId': '7a327313-47b9-49d8-856c-76e37d2859dd',                                                                                                                                                                        │
│             'name': 'conversion_result',                                                                                                                                                                                                 │
│             'parts': [{'kind': 'text', 'text': '25 USD is approximately 2,145.75 INR at the current exchange rate of 1 USD = 85.83 INR.'}]                                                                                               │
│         },                                                                                                                                                                                                                               │
│         'contextId': '5c30405f-e962-494a-bb36-16054b992720',                                                                                                                                                                             │
│         'kind': 'artifact-update',                                                                                                                                                                                                       │
│         'taskId': '2bd183db-480a-4e4c-afcb-fec5b264b3ee'                                                                                                                                                                                 │
│     }                                                                                                                                                                                                                                    │
│ }                                                                                                                                                                                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────── Streaming Response from CurrencyAgent ──────────────────────────────────────────────────────────────────────────────────────────────────────╮        
│ {                                                                                                                                                                                                                                                │        
│     'id': '07b34dbd-7d37-4069-9be7-df76dc31dbea',                                                                                                                                                                                                │        
│     'jsonrpc': '2.0',                                                                                                                                                                                                                            │        
│     'result': {                                                                                                                                                                                                                                  │        
│         'contextId': '5c30405f-e962-494a-bb36-16054b992720',                                                                                                                                                                                     │        
│         'final': True,                                                                                                                                                                                                                           │        
│         'kind': 'status-update',                                                                                                                                                                                                                 │        
│         'status': {'state': 'completed', 'timestamp': '2025-07-13T16:33:59.491724+00:00'},                                                                                                                                                       │        
│         'taskId': '2bd183db-480a-4e4c-afcb-fec5b264b3ee'                                                                                                                                                                                         │        
│     }                                                                                                                                                                                                                                            │        
│ }                                                                                                                                                                                                                                                │        
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯        

Multi-Agent Demo finished.

Observe:

  • Client fetches cards for both agents
  • Orchestrates HelloWorldAgent + CurrencyAgent
  • Shows streaming and response sequence

🎨 Pretty Output

To improve readability, agent interactions and metadata are formatted with the Rich library. You’ll see agent responses and cards printed in a clean, human-friendly way.

Conclusion

A2A protocols offer a powerful way to build intelligent, scalable, and interoperable systems where agents collaborate like coworkers. With simple tools and patterns, you can:

  • Discover and talk to agents via Agent Cards
  • Delegate tasks with structured messaging
  • Orchestrate complex workflows with minimal code

This hands-on introduction is just a starting point. You can extend the codebase, build your own agents, or connect them to cloud-based services.

🔗 Check out the full project: GitHub Repo

References

[embed]GitHub - NihalJain/agentic-ai-learning-kit: This repository serves as a kit for learning how to… This repository serves as a kit for learning how to build Agentic AI applications. - NihalJain/agentic-ai-learning-kitgithub.com

[embed]Agent2Agent (A2A) Protocol An open protocol enabling communication and interoperability between opaque agentic applications.a2aproject.github.io

[embed]Announcing the Agent2Agent Protocol (A2A) Explore A2A, Google's new open protocol empowering developers to build interoperable AI solutions.developers.googleblog.com


메타데이터
post_id
7aa29f09307b
slug
deep-dive-agent-to-agent-a2a-protocol-a-hands-on-guide-7aa29f09307b
url
https://medium.com/@nihaljain-cs/deep-dive-agent-to-agent-a2a-protocol-a-hands-on-guide-7aa29f09307b
canonical_url
https://medium.com/@nihaljain-cs/deep-dive-agent-to-agent-a2a-protocol-a-hands-on-guide-7aa29f09307b
author_url
https://medium.com/@nihaljain-cs
status
ok
fetched_at
2026-08-08 05:49:19