Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 52 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Demo: Zava AI Shopping Assistant <br/> Multi-Agent Architecture with A2A Protocol - Overview
# Demo: Zava AI Shopping Assistant <br/> Multi-Agent Architecture with A2A Protocol - Overview

Costa Rica

[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
[brown9804](https://github.com/brown9804)

Last updated: 2025-12-03
Last updated: 2025-12-04

----------

> [!IMPORTANT]
> 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!
> 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!

<img width="1905" height="1086" alt="image" src="https://github.com/user-attachments/assets/5cd2776f-4606-45c2-9482-53ff2d4df74e" />

Expand All @@ -23,16 +23,20 @@ Last updated: 2025-12-03

## Key Features

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

## About A2A Protocol

Expand All @@ -49,11 +53,13 @@ Last updated: 2025-12-03
> A2A Components in This Project:

- **Agent Execution Framework**: Manages multiple agent instances (`src/a2a/server/agent_execution.py`)
- **Event Queue System**: Handles inter-agent communication (`src/a2a/server/events/`)
- **Task Management**: Coordinates work between agents (`src/a2a/server/tasks.py`)
- **Request Handlers**: Processes agent-to-agent requests (`src/a2a/server/request_handlers.py`)
- **Coordinator Agent**: Orchestrates multi-agent workflows (`src/a2a/agent/coordinator.py`)
- **API Endpoints**: RESTful and WebSocket APIs for agent communication (`src/a2a/api/`)
- **Event System**: Handles inter-agent communication and delegation (`src/a2a/server/events/`)
- **Task Coordination**: Advanced task delegation between specialized agents (`src/a2a/server/tasks.py`)
- **Request Handlers**: Processes agent-to-agent requests with delegation routing (`src/a2a/server/request_handlers.py`)
- **Coordinator Agent**: Orchestrates complex multi-agent workflows (`src/a2a/agent/coordinator.py`)
- **Specialized Agents**: Marketing Agent, Ranker Agent with delegation patterns (`src/app/agents/`)
- **Product Information Plugin**: Factual data source for product catalog (`src/app/agents/product_information_plugin.py`)
- **API Endpoints**: RESTful and WebSocket APIs for enhanced agent communication (`src/a2a/api/`)

> A2A vs Traditional Multi-Agent Systems:

Expand All @@ -79,17 +85,26 @@ graph TD
Router -->|Inventory Events| Inventory[Inventory Agent]
Router -->|Loyalty Tasks| Loyalty[Loyalty Agent]
Router -->|Cart Events| Cart[Cart Agent]
Router -->|Product Tasks| ProductMgr[Product Manager]

ProductMgr -->|Marketing Tasks| Marketing[Marketing Agent]
ProductMgr -->|Ranking Tasks| Ranker[Ranker Agent]
ProductMgr -->|Factual Data| Plugin[Product Info Plugin]

subgraph "A2A Communication"
EventQueue <--> Cora
EventQueue <--> Design
EventQueue <--> Inventory
EventQueue <--> Loyalty
EventQueue <--> Cart
EventQueue <--> ProductMgr
EventQueue <--> Marketing
EventQueue <--> Ranker
end

Inventory -->|Query| Search[Azure AI Search]
Inventory -->|Lookup| Cosmos[Cosmos DB]
Plugin -->|Catalog| PredefinedData[Product Catalog Data]
```

## What Happens Under the Hood?
Expand Down Expand Up @@ -119,12 +134,16 @@ graph TD

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

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

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

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

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

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

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

<!-- START BADGE -->
<div align="center">
Expand Down
6 changes: 3 additions & 3 deletions src/a2a/.env_automation
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ A2A_PORT=8001
A2A_LOG_LEVEL=INFO

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

# Azure monitoring integration
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
LOG_ANALYTICS_WORKSPACE_ID=9a4604f5-a37e-4fc6-9c14-73d1d63e88d7
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
LOG_ANALYTICS_WORKSPACE_ID=d3733137-0fd4-48ea-ad35-e3d066ec4d0b

# Automation features
ENABLE_PROCESS_MANAGEMENT=true
Expand Down
5 changes: 3 additions & 2 deletions src/a2a/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
ZavaAgentAdapter, InteriorDesignAgentAdapter, InventoryAgentAdapter,
CustomerLoyaltyAgentAdapter, CartManagementAgentAdapter, CoraAgentAdapter
)
from .coordinator import A2ACoordinatorAgent, EnhancedProductManagementAgent
from .coordinator import A2ACoordinatorAgent, EnhancedProductManagementAgent as CoordinatorEnhancedAgent
from .product_management_agent import EnaganecedProductManagementAgent

__all__ = [
"ZavaAgentAdapter",
Expand All @@ -16,5 +17,5 @@
"CartManagementAgentAdapter",
"CoraAgentAdapter",
"A2ACoordinatorAgent",
"EnhancedProductManagementAgent"
"EnaganecedProductManagementAgent"
]
7 changes: 4 additions & 3 deletions src/a2a/agent/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
CartManagementAgentAdapter, CoraAgentAdapter
)


# Import existing handoff service
import sys
import os
Expand Down Expand Up @@ -197,7 +198,7 @@ def _simple_classification(self, user_message: str) -> Dict[str, Any]:
best_domain = max(scores, key=scores.get)
confidence = min(0.8, scores[best_domain] * 0.2) # Max 0.8 confidence
else:
best_domain = "cora" # Default fallback
best_domain = "product_management" # Default to product management
confidence = 0.3

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

target_agent = self.agents[domain]
self.active_handoffs[task.id] = domain
Expand Down
2 changes: 1 addition & 1 deletion src/a2a/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from a2a.api import A2AChatRouter, A2AServerRouter
from a2a.api.enhanced_chat_router import EnhancedA2AChatRouter
from a2a.server import A2AStarletteApplication, DefaultRequestHandler
from a2a.agent import EnhancedProductManagementAgent
from a2a.agent import EnaganecedProductManagementAgent
from a2a.types import AgentCard, AgentCapabilities, AgentSkill

# Import legacy components for hybrid mode
Expand Down
2 changes: 1 addition & 1 deletion src/a2a/status_automation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if () {

# Check automation endpoint
try {
= Invoke-RestMethod -Uri "https://zava-72910920-app.azurewebsites.net/a2a/automation/status" -TimeoutSec 5
= Invoke-RestMethod -Uri "https://zava-51c07969-app.azurewebsites.net/a2a/automation/status" -TimeoutSec 5
Write-Host "Automation Status: "
} catch {
Write-Host "Automation endpoint not accessible"
Expand Down
Loading