# kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298 architecture

> Architecture diagram of the GitHub repository kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298
- Repository: https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298

## Overview

This repository is a set of course examples demonstrating MCP resource and tool access, HR policy retrieval, time-off operations, and A2A multi-agent routing. The principal workflow is a user request routed to a policy or time-off agent, which uses an MCP server to retrieve policy context or perform time-off operations and returns a response. The earlier code-of-conduct example demonstrates a separate MCP resource-to-LLM workflow. Some chapter capabilities are documented by the tree and README but their wiring is not sampled; those links are omitted.

Main entry points: [`chapter6/a2a_client_router_agent.py`](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter6/a2a_client_router_agent.py) (HR Router Agent), [`chapter2/code_of_conduct_client.py`](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter2/code_of_conduct_client.py) (Conduct Client), [`chapter3/hr_policy_agent.py`](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_agent.py) (Policy Agent), [`chapter3/hr_policy_server.py`](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_server.py) (Policy Vector Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conduct["Conduct Resource Demo"]
  node_conduct_client["Conduct Client"]
  node_conduct_server["Conduct MCP Server"]
  node_conduct_pdf["Conduct PDF"]
  node_conduct_llm{{"Language Model"}}
end

subgraph group_policy["Policy Assistant"]
  node_policy_agent["Policy Agent<br/>[hr_policy_agent.py]"]
  node_policy_server["Policy MCP Server"]
  node_policy_pdf["Policy Document"]
  node_policy_index[("Policy Vector Store")]
end

subgraph group_timeoff["Time-Off Service"]
  node_timeoff_agent["Time-Off Agent<br/>[timeoff_agent.py]"]
  node_timeoff_server["Time-Off MCP Server"]
  node_timeoff_store[("Time-Off Datastore")]
end

subgraph group_a2a["A2A Routing"]
  node_router["HR Router Agent"]
  node_policy_wrapper["Policy A2A Wrapper"]
  node_timeoff_wrapper["Time-Off A2A Wrapper"]
  node_router_llm{{"Language Model"}}
end

node_user(("User"))

node_user -->|"asks query"| node_conduct_client
node_conduct_client -->|"starts MCP; fetches resource"| node_conduct_server
node_conduct_server -->|"reads PDF"| node_conduct_pdf
node_conduct_client -->|"supplies context and query"| node_conduct_llm
node_conduct_llm -->|"returns answer"| node_conduct_client
node_user -->|"asks policy"| node_policy_agent
node_policy_agent -->|"loads prompt and tools"| node_policy_server
node_policy_agent -->|"queries via MCP tool"| node_policy_index
node_policy_server -->|"searches"| node_policy_index
node_policy_index -->|"indexes document"| node_policy_pdf
node_user -->|"asks time-off"| node_timeoff_agent
node_timeoff_agent -->|"loads prompt and tools"| node_timeoff_server
node_timeoff_server -->|"reads and updates"| node_timeoff_store
node_timeoff_store -->|"returns operation result"| node_timeoff_server
node_user -->|"sends request"| node_router
node_router -->|"classifies request"| node_router_llm
node_router -->|"routes A2A request"| node_policy_wrapper
node_router -->|"routes A2A request"| node_timeoff_wrapper
node_policy_wrapper -->|"executes policy query"| node_policy_agent
node_timeoff_wrapper -->|"executes time-off query"| node_timeoff_agent

click node_conduct_client "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter2/code_of_conduct_client.py"
click node_conduct_server "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter2/code_of_conduct_server.py"
click node_conduct_pdf "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter2/code_of_conduct.pdf"
click node_policy_agent "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_agent.py"
click node_policy_server "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_server.py"
click node_policy_pdf "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_document.pdf"
click node_policy_index "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_server.py"
click node_timeoff_agent "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter4/timeoff_agent.py"
click node_timeoff_server "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter4/timeoff_db_server.py"
click node_timeoff_store "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter4/timeoff_datastore.py"
click node_router "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter6/a2a_client_router_agent.py"
click node_policy_wrapper "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter6/a2a_wrapper_hr_policy_agent.py"
click node_timeoff_wrapper "https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter6/a2a_wrapper_timeoff_agent.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_conduct_client,node_conduct_server,node_conduct_pdf,node_conduct_llm,node_user toneBlue
class node_policy_agent,node_policy_server,node_policy_pdf,node_policy_index toneAmber
class node_timeoff_agent,node_timeoff_server,node_timeoff_store toneMint
class node_router,node_policy_wrapper,node_timeoff_wrapper,node_router_llm toneRose
```

## Components

### Conduct Resource Demo

- [Conduct Client](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter2/code_of_conduct_client.py): `chapter2/code_of_conduct_client.py`
- [Conduct MCP Server](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter2/code_of_conduct_server.py): `chapter2/code_of_conduct_server.py`
- [Conduct PDF](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter2/code_of_conduct.pdf): `chapter2/code_of_conduct.pdf`
- **Language Model**

### Policy Assistant

- [Policy Agent](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_agent.py): `chapter3/hr_policy_agent.py`
- [Policy MCP Server](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_server.py): `chapter3/hr_policy_server.py`
- [Policy Document](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_document.pdf): `chapter3/hr_policy_document.pdf`
- [Policy Vector Store](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter3/hr_policy_server.py): `chapter3/hr_policy_server.py`

### Time-Off Service

- [Time-Off Agent](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter4/timeoff_agent.py): `chapter4/timeoff_agent.py`
- [Time-Off MCP Server](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter4/timeoff_db_server.py): `chapter4/timeoff_db_server.py`
- [Time-Off Datastore](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter4/timeoff_datastore.py): `chapter4/timeoff_datastore.py`

### A2A Routing

- [HR Router Agent](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter6/a2a_client_router_agent.py): `chapter6/a2a_client_router_agent.py`
- [Policy A2A Wrapper](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter6/a2a_wrapper_hr_policy_agent.py): `chapter6/a2a_wrapper_hr_policy_agent.py`
- [Time-Off A2A Wrapper](https://github.com/kumbham8888/hands-on-ai-building-ai-agents-with-model-context-protocol-mcp-and-agent2agent-a2a-6055298/blob/main/chapter6/a2a_wrapper_timeoff_agent.py): `chapter6/a2a_wrapper_timeoff_agent.py`
- **Language Model**

### Other components

- **User**

## Connections

- User → Conduct Client: asks query
- Conduct Client → Conduct MCP Server: starts MCP; fetches resource
- Conduct MCP Server → Conduct PDF: reads PDF
- Conduct Client → Language Model: supplies context and query
- Language Model → Conduct Client: returns answer
- User → Policy Agent: asks policy
- Policy Agent → Policy MCP Server: loads prompt and tools
- Policy Agent → Policy Vector Store: queries via MCP tool
- Policy MCP Server → Policy Vector Store: searches
- Policy Vector Store → Policy Document: indexes document
- User → Time-Off Agent: asks time-off
- Time-Off Agent → Time-Off MCP Server: loads prompt and tools
- Time-Off MCP Server → Time-Off Datastore: reads and updates
- Time-Off Datastore → Time-Off MCP Server: returns operation result
- User → HR Router Agent: sends request
- HR Router Agent → Language Model: classifies request
- HR Router Agent → Policy A2A Wrapper: routes A2A request
- HR Router Agent → Time-Off A2A Wrapper: routes A2A request
- Policy A2A Wrapper → Policy Agent: executes policy query
- Time-Off A2A Wrapper → Time-Off Agent: executes time-off query
