Skip to content

Commit 721b8c0

Browse files
committed
Modularized agents, added Streamlit UI, improved README for tutorial review
1 parent 77f1d9b commit 721b8c0

File tree

7 files changed

+431
-494
lines changed

7 files changed

+431
-494
lines changed

a2a_customer_routing/README.md

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
A customer support system built with distributed AI agents using the A2A (Agent-to-Agent) protocol and Google's Agent Development Kit (ADK). The system intelligently routes customer inquiries based on sentiment analysis and provides automated responses through knowledge base search or human escalation.
44

5-
## System Architecture
5+
## System Architecture
66

77
```
88
User Message → Coordinator Agent → Sentiment Analysis → Routing Decision
9-
10-
┌─────────────────────────────┐
11-
│ │
12-
Negative Sentiment Positive/Neutral
13-
│ │
14-
↓ ↓
15-
Escalation Agent Resolution Agent
16-
(Human Handoff) (Knowledge Base Search)
17-
│ │
18-
└─────────────────────────────┘
19-
20-
Final Response to User
9+
10+
┌─────────────────────────────┐
11+
│ │
12+
Negative Sentiment Positive/Neutral
13+
│ │
14+
↓ ↓
15+
Escalation Agent Resolution Agent
16+
(Human Handoff) (Knowledge Base Search)
17+
│ │
18+
└─────────────────────────────┘
19+
20+
Final Response to User
2121
```
2222

23-
## Agent Overview
23+
## Agent Overview
2424

2525
| Agent | Port | Purpose | Technology |
2626
|-------|------|---------|------------|
@@ -36,39 +36,60 @@ User Message → Coordinator Agent → Sentiment Analysis → Routing Decision
3636
- **Human Escalation**: Automatic escalation for negative sentiment cases
3737
- **Distributed Architecture**: Each agent runs independently via A2A protocol
3838
- **Scalable Design**: Easy to add new agents or modify existing ones
39+
- **Interactive UI**: Streamlit-based web interface for easy interaction
3940

40-
## Prerequisites
41+
## Prerequisites
4142

4243
- Python 3.8+
4344
- API access to Nebius AI models
4445
- Required Python packages (see requirements.txt)
4546

46-
## How to Run
47+
## Project Structure
48+
49+
```
50+
a2a_customer_routing/
51+
├── knowledge_base/
52+
│ └── swiftcart_kb.json
53+
├── multi_agent/
54+
│ ├── __init__.py
55+
│ ├── agent.py
56+
│ ├── run_agents.py
57+
│ └── tools.py
58+
├── README.md
59+
├── requirements.txt
60+
└── streamlit_app.py
61+
```
62+
63+
## How to Run
4764

4865
1. **Clone the repository**
49-
```
66+
```bash
5067
git clone https://github.com/Astrodevil/ADK-Agent-Examples.git
51-
cd ADK-Agent-Examples/"A2A Customer Query Routing and Resolution"
68+
cd ADK-Agent-Examples/a2a_customer_routing
5269
```
5370

5471
2. **Install dependencies**
55-
```
72+
```bash
5673
pip install -r requirements.txt
5774
```
5875

5976
3. **Set up environment variables**
60-
```
77+
```bash
6178
cp .env.example .env
6279
# Edit .env with your API credentials
6380
```
6481

6582
4. **Run the multi-agent system**
66-
```
67-
python multi_agent/agent.py
83+
```bash
84+
python -m a2a_customer_routing.multi_agent.run_agents
6885
```
6986

87+
5. **Launch the Streamlit interface** (in a separate terminal)
88+
```bash
89+
streamlit run a2a_customer_routing/streamlit_app.py
90+
```
7091

71-
## Workflow Examples
92+
## Workflow Examples
7293

7394
### Positive/Neutral Sentiment Flow
7495
```
@@ -78,7 +99,7 @@ Coordinator → Intake Agent → "neutral"
7899
79100
Coordinator → Resolution Agent → KB Search
80101
81-
Response: " "
102+
Response: "You can track your order by..."
82103
```
83104

84105
### Negative Sentiment Flow
@@ -89,23 +110,26 @@ Coordinator → Intake Agent → "negative"
89110
90111
Coordinator → Escalation Agent → Human Escalation
91112
92-
Response: " "
113+
Response: "I understand your frustration. A human agent will contact you shortly..."
93114
```
94115

95-
## System Components
116+
## System Components
96117

97118
### Core Classes
98119

99120
- **`KB`**: Knowledge base management with LlamaIndex integration
100121
- **`ADKAgentExecutor`**: Wrapper for Google ADK agents to work with A2A protocol
101122
- **`A2AToolClient`**: Client for agent-to-agent communication
102123

103-
104124
### Agent Tools
105125

106126
- **`resolve_query_fn`**: Searches knowledge base for answers
107127
- **`classify_fn`**: Performs sentiment analysis
108128
- **`escalate_fn`**: Handles human escalation logging
109129

130+
## Usage
110131

111-
132+
1. Start the multi-agent system using the run command
133+
2. Open the Streamlit interface in your browser
134+
3. Enter customer queries to see the intelligent routing in action
135+
4. Monitor the console output to see agent-to-agent communication

a2a_customer_routing/multi_agent/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)