Skip to content

Commit df283b0

Browse files
committed
product management agent with demo task delegation
1 parent 0639d74 commit df283b0

17 files changed

Lines changed: 1744 additions & 57 deletions

README.md

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Demo: Zava AI Shopping Assistant <br/> Multi-Agent Architecture with A2A Protocol - Overview
1+
# Demo: Zava AI Shopping Assistant <br/> Multi-Agent Architecture with A2A Protocol - Overview
22

33
Costa Rica
44

@@ -10,7 +10,7 @@ Last updated: 2025-12-03
1010
----------
1111

1212
> [!IMPORTANT]
13-
> Disclaimer: This repository contains a demo of `Zava AI Shopping Assistant`, a multi-agent system designed for e-commerce. It features a fully automated `"Zero-Touch" deployment` pipeline orchestrated by Terraform, which `provisions infrastructure, ingests data, creates real AI agents in MSFT Foundry, and deploys the application container.` Please refer [TechWorkshop L300: AI Apps and Agents](https://microsoft.github.io/TechWorkshop-L300-AI-Apps-and-agents/), and if needed contact Microsoft directly: [Microsoft Sales and Support](https://support.microsoft.com/contactus?ContactUsExperienceEntryPointAssetId=S.HP.SMC-HOME) more guindace. There are tons of free resources out there, all eager to support!
13+
> Disclaimer: This repository contains a demo of `Zava AI Shopping Assistant`, an enhanced multi-agent system implementing Agent-to-Agent (A2A) protocol for e-commerce. It features a fully automated `"Zero-Touch" deployment` pipeline orchestrated by Terraform, which `provisions infrastructure, ingests data, creates specialized AI agents with delegation patterns in MSFT Foundry, and deploys the complete A2A application stack.` Please refer [TechWorkshop L300: AI Apps and Agents](https://microsoft.github.io/TechWorkshop-L300-AI-Apps-and-agents/), and if needed contact Microsoft directly: [Microsoft Sales and Support](https://support.microsoft.com/contactus?ContactUsExperienceEntryPointAssetId=S.HP.SMC-HOME) for more guidance. There are tons of free resources out there, all eager to support!
1414
1515
<img width="1905" height="1086" alt="image" src="https://github.com/user-attachments/assets/5cd2776f-4606-45c2-9482-53ff2d4df74e" />
1616

@@ -23,16 +23,20 @@ Last updated: 2025-12-03
2323
2424
## Key Features
2525

26-
- **A2A Protocol Implementation**: Complete Agent-to-Agent communication framework with standardized messaging, event handling, and task coordination
27-
- **Multi-Agent Architecture**: Specialized AI agents working through A2A protocol:
28-
- **Cora (Shopper)**: Front-facing assistant for general queries
29-
- **Inventory Manager**: Checks stock availability via A2A requests
30-
- **Customer Loyalty**: Manages rewards and discounts through agent coordination
31-
- **Cart Manager**: Handles shopping cart operations with inter-agent communication
32-
- **Real Azure AI Agents**: Integrates with **MSFT Foundry** to create and host persistent agents (not just local simulations)
33-
- **Zero-Touch Deployment**: A single [terraform apply](./terraform-infrastructure/README.md) command handles the entire lifecycle including A2A framework deployment
34-
- **A2A Intelligent Routing**: Enhanced Handoff Service that supports both traditional routing and A2A protocol agent discovery
35-
- **Data Pipeline Automation**: Automatically ingests product catalogs with A2A event notifications and coordination
26+
- **Enhanced A2A Protocol**: Agent-to-Agent communication with delegation patterns, specialized agent coordination, and factual data integration
27+
- **6-Agent Architecture**: Specialized AI agents with proper delegation through A2A protocol:
28+
- **Cora (Shopper)**: Front-facing assistant for general customer queries
29+
- **Interior Design Specialist**: Design expertise and style recommendations
30+
- **Inventory Manager**: Stock availability and product lookup coordination
31+
- **Customer Loyalty**: Rewards management and discount optimization
32+
- **Cart Manager**: Shopping cart operations and checkout coordination
33+
- **Product Management Specialist**: Coordinates with Marketing Agent, Ranker Agent, and Product Information Plugin for comprehensive product services
34+
- **Specialized Agent Delegation**: Product Manager delegates marketing tasks to Marketing Agent and ranking tasks to Ranker Agent as appropriate
35+
- **Factual Data Plugin**: Product Information Plugin provides accurate product catalog data from predefined sources
36+
- **Real MSFT Foundry Agents**: Integrates with **MSFT Foundry** to create and host persistent agents with proper delegation patterns
37+
- **Zero-Touch Deployment**: A single [terraform apply](./terraform-infrastructure/README.md) command handles the entire lifecycle including enhanced A2A framework deployment
38+
- **A2A Task Coordination**: Advanced inter-agent task delegation with specialized expertise routing
39+
- **Data Pipeline Automation**: Automatically ingests product catalogs with comprehensive A2A event coordination
3640

3741
## About A2A Protocol
3842

@@ -49,11 +53,13 @@ Last updated: 2025-12-03
4953
> A2A Components in This Project:
5054
5155
- **Agent Execution Framework**: Manages multiple agent instances (`src/a2a/server/agent_execution.py`)
52-
- **Event Queue System**: Handles inter-agent communication (`src/a2a/server/events/`)
53-
- **Task Management**: Coordinates work between agents (`src/a2a/server/tasks.py`)
54-
- **Request Handlers**: Processes agent-to-agent requests (`src/a2a/server/request_handlers.py`)
55-
- **Coordinator Agent**: Orchestrates multi-agent workflows (`src/a2a/agent/coordinator.py`)
56-
- **API Endpoints**: RESTful and WebSocket APIs for agent communication (`src/a2a/api/`)
56+
- **Event System**: Handles inter-agent communication and delegation (`src/a2a/server/events/`)
57+
- **Task Coordination**: Advanced task delegation between specialized agents (`src/a2a/server/tasks.py`)
58+
- **Request Handlers**: Processes agent-to-agent requests with delegation routing (`src/a2a/server/request_handlers.py`)
59+
- **Coordinator Agent**: Orchestrates complex multi-agent workflows (`src/a2a/agent/coordinator.py`)
60+
- **Specialized Agents**: Marketing Agent, Ranker Agent with delegation patterns (`src/app/agents/`)
61+
- **Product Information Plugin**: Factual data source for product catalog (`src/app/agents/product_information_plugin.py`)
62+
- **API Endpoints**: RESTful and WebSocket APIs for enhanced agent communication (`src/a2a/api/`)
5763

5864
> A2A vs Traditional Multi-Agent Systems:
5965
@@ -79,17 +85,26 @@ graph TD
7985
Router -->|Inventory Events| Inventory[Inventory Agent]
8086
Router -->|Loyalty Tasks| Loyalty[Loyalty Agent]
8187
Router -->|Cart Events| Cart[Cart Agent]
88+
Router -->|Product Tasks| ProductMgr[Product Manager]
89+
90+
ProductMgr -->|Marketing Tasks| Marketing[Marketing Agent]
91+
ProductMgr -->|Ranking Tasks| Ranker[Ranker Agent]
92+
ProductMgr -->|Factual Data| Plugin[Product Info Plugin]
8293
8394
subgraph "A2A Communication"
8495
EventQueue <--> Cora
8596
EventQueue <--> Design
8697
EventQueue <--> Inventory
8798
EventQueue <--> Loyalty
8899
EventQueue <--> Cart
100+
EventQueue <--> ProductMgr
101+
EventQueue <--> Marketing
102+
EventQueue <--> Ranker
89103
end
90104
91105
Inventory -->|Query| Search[Azure AI Search]
92106
Inventory -->|Lookup| Cosmos[Cosmos DB]
107+
Plugin -->|Catalog| PredefinedData[Product Catalog Data]
93108
```
94109

95110
## What Happens Under the Hood?
@@ -119,12 +134,16 @@ graph TD
119134

120135
<https://github.com/user-attachments/assets/37c4a8cd-73e1-4392-8755-fb018481d8cb>
121136

122-
4. **Agent Creation & A2A Registration**:
123-
- Installs the `azure-ai-projects` SDK.
124-
- Connects to MSFT Foundry.
125-
- Provisions 5 real agents with A2A protocol integration and specific instructions.
126-
- Registers agents with the A2A discovery service.
127-
- Saves the unique Agent IDs and A2A endpoints to the `.env` file.
137+
4. **Enhanced Agent Creation & A2A Registration**:
138+
- Installs the `azure-ai-projects` SDK and Microsoft Agent Framework.
139+
- Connects to MSFT Foundry for agent hosting.
140+
- Provisions 6 specialized agents with enhanced A2A protocol integration:
141+
- Core shopping agents (5) plus Product Management Specialist
142+
- Marketing Agent and Ranker Agent with delegation patterns
143+
- Product Information Plugin with predefined catalog data
144+
- Registers all agents with the enhanced A2A discovery service.
145+
- Configures delegation relationships between Product Manager and specialized agents.
146+
- Saves the unique Agent IDs, delegation endpoints, and A2A configuration to the `.env` file.
128147

129148
<img width="1907" height="990" alt="image" src="https://github.com/user-attachments/assets/4234ead4-16e0-4bec-bbfd-3b8891d113b0" />
130149

@@ -149,18 +168,23 @@ graph TD
149168
- Check A2A Server API: `https://<your-app-name>.azurewebsites.net/a2a/api/docs`
150169
- Verify agent discovery: `https://<your-app-name>.azurewebsites.net/a2a/server/agents`
151170

152-
3. **Verify Agents**:
171+
3. **Verify Enhanced Agent Architecture**:
153172
- Go to the [MSFT Foundry Portal](https://ai.azure.com).
154173
- Navigate to your project -> **Build** -> **Agents**.
155-
- You should see all 5 agents listed with A2A protocol integration.
174+
- You should see all 6 agents listed with enhanced A2A protocol integration:
175+
- Core agents: Cora, Interior Design, Inventory, Loyalty, Cart Manager
176+
- Product Management Specialist with delegation capabilities
156177

157178
<https://github.com/user-attachments/assets/3c562ccd-cff3-4a30-b9f8-44111fb71113>
158179

159-
4. **Test A2A Interactions**: For example:
180+
4. **Test Enhanced A2A Interactions**: For example:
160181
- **General**: "Hi, who are you?" (Handled by Cora via A2A protocol)
161182
- **Inventory**: "Do you have the classic leather sofa in stock?" (Routed through A2A to Inventory Agent)
162183
- **Design**: "What colors of green paint do you have?" (A2A task delegation to Design Agent)
163-
- **Multi-Agent**: "Find a sofa and check my loyalty points" (A2A coordination between multiple agents)
184+
- **Product Recommendations**: "Recommend modern furniture for my living room" (Product Manager delegates to Marketing Agent)
185+
- **Product Comparisons**: "Compare sectional sofas" (Product Manager delegates to Ranker Agent)
186+
- **Product Details**: "What are the specifications of product SOFA-001?" (Product Manager uses Product Information Plugin)
187+
- **Multi-Agent**: "Find a sofa, check reviews, and verify my loyalty points" (Complex A2A coordination across multiple specialized agents)
164188

165189
<!-- START BADGE -->
166190
<div align="center">

src/a2a/.env_automation

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ A2A_PORT=8001
44
A2A_LOG_LEVEL=INFO
55

66
# Base application URL for monitoring
7-
BASE_APP_URL=https://zava-72910920-app.azurewebsites.net
7+
BASE_APP_URL=https://zava-51c07969-app.azurewebsites.net
88

99
# Azure monitoring integration
10-
APPLICATION_INSIGHTS_CONNECTION_STRING=InstrumentationKey=cd157009-2ed7-472b-9bcf-9f83189fe438;IngestionEndpoint=https://westus3-1.in.applicationinsights.azure.com/;LiveEndpoint=https://westus3.livediagnostics.monitor.azure.com/;ApplicationId=43df942d-375b-4d95-b0b4-a85f1045018c
11-
LOG_ANALYTICS_WORKSPACE_ID=9a4604f5-a37e-4fc6-9c14-73d1d63e88d7
10+
APPLICATION_INSIGHTS_CONNECTION_STRING=InstrumentationKey=3ecb7f2d-bf9b-4c15-973f-39e820e44b10;IngestionEndpoint=https://westus3-1.in.applicationinsights.azure.com/;LiveEndpoint=https://westus3.livediagnostics.monitor.azure.com/;ApplicationId=c47cdc80-ebeb-4b09-a7f5-4f9b6c9502dc
11+
LOG_ANALYTICS_WORKSPACE_ID=d3733137-0fd4-48ea-ad35-e3d066ec4d0b
1212

1313
# Automation features
1414
ENABLE_PROCESS_MANAGEMENT=true

src/a2a/agent/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
ZavaAgentAdapter, InteriorDesignAgentAdapter, InventoryAgentAdapter,
77
CustomerLoyaltyAgentAdapter, CartManagementAgentAdapter, CoraAgentAdapter
88
)
9-
from .coordinator import A2ACoordinatorAgent, EnhancedProductManagementAgent
9+
from .coordinator import A2ACoordinatorAgent, EnhancedProductManagementAgent as CoordinatorEnhancedAgent
10+
from .product_management_agent import EnaganecedProductManagementAgent
1011

1112
__all__ = [
1213
"ZavaAgentAdapter",
@@ -16,5 +17,5 @@
1617
"CartManagementAgentAdapter",
1718
"CoraAgentAdapter",
1819
"A2ACoordinatorAgent",
19-
"EnhancedProductManagementAgent"
20+
"EnaganecedProductManagementAgent"
2021
]

src/a2a/agent/coordinator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
CartManagementAgentAdapter, CoraAgentAdapter
2828
)
2929

30+
3031
# Import existing handoff service
3132
import sys
3233
import os
@@ -197,7 +198,7 @@ def _simple_classification(self, user_message: str) -> Dict[str, Any]:
197198
best_domain = max(scores, key=scores.get)
198199
confidence = min(0.8, scores[best_domain] * 0.2) # Max 0.8 confidence
199200
else:
200-
best_domain = "cora" # Default fallback
201+
best_domain = "product_management" # Default to product management
201202
confidence = 0.3
202203

203204
return {
@@ -215,8 +216,8 @@ async def _route_to_agent(
215216
) -> None:
216217
"""Route request to the appropriate agent"""
217218
if domain not in self.agents:
218-
logger.warning(f"Unknown domain: {domain}, falling back to cora")
219-
domain = "cora"
219+
logger.warning(f"Unknown domain: {domain}, falling back to product_management")
220+
domain = "product_management"
220221

221222
target_agent = self.agents[domain]
222223
self.active_handoffs[task.id] = domain

src/a2a/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from a2a.api import A2AChatRouter, A2AServerRouter
3838
from a2a.api.enhanced_chat_router import EnhancedA2AChatRouter
3939
from a2a.server import A2AStarletteApplication, DefaultRequestHandler
40-
from a2a.agent import EnhancedProductManagementAgent
40+
from a2a.agent import EnaganecedProductManagementAgent
4141
from a2a.types import AgentCard, AgentCapabilities, AgentSkill
4242

4343
# Import legacy components for hybrid mode

src/a2a/status_automation.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if () {
1111

1212
# Check automation endpoint
1313
try {
14-
= Invoke-RestMethod -Uri "https://zava-72910920-app.azurewebsites.net/a2a/automation/status" -TimeoutSec 5
14+
= Invoke-RestMethod -Uri "https://zava-51c07969-app.azurewebsites.net/a2a/automation/status" -TimeoutSec 5
1515
Write-Host "Automation Status: "
1616
} catch {
1717
Write-Host "Automation endpoint not accessible"

0 commit comments

Comments
 (0)