This directory demonstrates a simple implementation of Google�s Agent2Agent (A2A) protocol with three specialized agents and an orchestrator.
agent2agent/
├── README.md # this file
└── a2a_example.py # example script showing A2A workflow
The A2A protocol enables AI agents to discover each other�s capabilities, negotiate tasks, and collaborate through structured JSON messages.
- AgentCard: Advertises an agent�s name and capabilities.
- Task: Encapsulates task metadata, status, and resulting artifact.
- Message: Carries sender, receiver, content, and optional parts for UI negotiation.
- Agent (base class): Provides
advertiseand defaulthandle_message(echo). - SearchAgent: Implements
search_candidatesto return dummy profiles. - FilterAgent: Implements
filter_candidatesto filter by skill. - ScheduleAgent: Implements
schedule_interviewto assign interview times. - Orchestrator: Acts as the client agent, discovers capabilities, sends messages to complete a candidate-sourcing workflow.
- Python 3.7 or higher
No external packages are required (uses Python standard library).
- Clone or navigate to this directory:
cd agent2agent - Run the example script:
python a2a_example.py
- Observe:
- Agents advertise their capabilities.
- Orchestrator issues tasks: search, filter, schedule.
- Agents respond with
Taskartifacts. - Final output: list of found, filtered candidates and interview schedule.
- Add new agents: Create classes inheriting from
Agentand implementhandle_messagefor new actions. - Real data: Replace dummy logic with database/API calls or LLM-based processing.
- Network transport: Integrate HTTP/WebSocket layers for remote agent communication.
- UI integration: Use
Message.partsto negotiate UI components (forms, iframes).
- Google Developers Blog: Announcing the Agent2Agent Protocol (A2A)
- A2A Spec and Samples: https://github.com/google/A2A