A multi-agent AI system for retail decision intelligence, built with .NET Aspire and Microsoft Agent Framework. The system orchestrates specialized AI agents to analyze business decisions from multiple perspectives, providing comprehensive insights for retail executives.
Retail Intelligence Studio uses a fan-out/fan-in orchestration pattern to evaluate business decisions through 8 specialized intelligence agents. Each agent analyzes the decision from a unique perspective, and the results are synthesized into an executive recommendation.
- Multi-Agent Architecture: 8 specialized AI agents working in concert
- Parallel Execution: 6 analysis agents run concurrently for fast insights
- Real-time Streaming: Server-Sent Events (SSE) for live progress updates
- Persona-Based Context: Tailored analysis for different retail segments
- Observable: Full OpenTelemetry integration with Aspire Dashboard
flowchart TB
subgraph Input
U[User Decision Request]
P[Persona Context]
end
subgraph "Stage 1: Framing"
DF[π― Decision Framer]
end
subgraph "Stage 2: Parallel Analysis"
SI[π₯ Shopper Insights]
DEM[π Demand Forecasting]
INV[π¦ Inventory Readiness]
MAR[π° Margin Impact]
DIG[π Digital Merchandising]
RSK[β οΈ Risk & Compliance]
end
subgraph "Stage 3: Synthesis"
EXE[π Executive Recommendation]
end
subgraph Output
REC[Final Recommendation]
INS[Role Insights]
end
U --> DF
P --> DF
DF --> SI
DF --> DEM
DF --> INV
DF --> MAR
DF --> DIG
DF --> RSK
SI --> EXE
DEM --> EXE
INV --> EXE
MAR --> EXE
DIG --> EXE
RSK --> EXE
EXE --> REC
EXE --> INS
style DF fill:#e1f5fe
style SI fill:#fff3e0
style DEM fill:#fff3e0
style INV fill:#fff3e0
style MAR fill:#fff3e0
style DIG fill:#fff3e0
style RSK fill:#fff3e0
style EXE fill:#e8f5e9
sequenceDiagram
participant Client
participant API
participant Orchestrator
participant DecisionFramer
participant AnalysisAgents
participant ExecutiveRec
participant Store
Client->>API: POST /api/decisions (SSE)
API->>Orchestrator: ExecuteAsync()
Note over Orchestrator: Stage 1: Framing
Orchestrator->>DecisionFramer: Analyze decision
DecisionFramer-->>Store: Append events
Store-->>Client: Stream events
Note over Orchestrator: Stage 2: Parallel Analysis
par Fan-out to 6 agents
Orchestrator->>AnalysisAgents: Shopper Insights
Orchestrator->>AnalysisAgents: Demand Forecasting
Orchestrator->>AnalysisAgents: Inventory Readiness
Orchestrator->>AnalysisAgents: Margin Impact
Orchestrator->>AnalysisAgents: Digital Merchandising
Orchestrator->>AnalysisAgents: Risk & Compliance
end
AnalysisAgents-->>Store: Append events
Store-->>Client: Stream events
Note over Orchestrator: Stage 3: Synthesis
Orchestrator->>ExecutiveRec: Synthesize all insights
ExecutiveRec-->>Store: Append events
Store-->>Client: Stream final recommendation
Client->>Client: Display results
| Agent | Purpose | Output |
|---|---|---|
| π― Decision Framer | Clarifies the business question and produces a structured Decision Brief. Identifies the core question, proposed action, scope, and key assumptions. | Decision Brief |
| Agent | Purpose | Focus Areas |
|---|---|---|
| π₯ Shopper Insights | Analyzes customer behavior, preferences, and potential reactions to the proposed decision. | Customer Segments, Purchase Patterns, Price Sensitivity, Brand Loyalty |
| π Demand Forecasting | Projects demand impact and volume changes resulting from the decision. | Volume Projections, Seasonality, Trend Analysis, Cannibalization |
| π¦ Inventory Readiness | Evaluates supply chain and inventory implications. | Stock Levels, Lead Times, Supplier Capacity, Distribution |
| π° Margin Impact | Calculates financial implications including margin, revenue, and profitability. | Gross Margin, Revenue Impact, Cost Analysis, ROI |
| π Digital Merchandising | Assesses e-commerce and digital channel considerations. | Online Conversion, Search Visibility, Digital Placement, Omnichannel |
| Identifies risks, regulatory concerns, and potential compliance issues. | Regulatory Risk, Brand Risk, Operational Risk, Mitigation Strategies |
| Agent | Purpose | Output |
|---|---|---|
| π Executive Recommendation | Synthesizes all analysis perspectives into a final recommendation with confidence score, key factors, and action items. | Executive Summary with Verdict (PROCEED / PROCEED WITH CAUTION / DO NOT PROCEED) |
- .NET 10 SDK
- Node.js 20+
- Docker Desktop (optional, for containerized deployment)
- Azure CLI (optional, for Azure OpenAI with Entra ID authentication)
-
Clone the repository
git clone https://github.com/yourusername/retail-intelligence-studio.git cd retail-intelligence-studio -
Trust the development certificate (first time only)
dotnet dev-certs https --trust
-
Start the application
dotnet run --project RetailIntelligenceStudio.AppHost
-
Open the application
- Aspire Dashboard: https://localhost:17204 (login token shown in console)
- Frontend: The URL will be shown in the Aspire Dashboard
Note: Without Azure OpenAI configuration, the application runs with local mock agents that return simulated responses. This is great for UI development and testing the workflow.
The application supports two authentication methods for Azure OpenAI:
-
Get your Azure OpenAI credentials from the Azure Portal:
- Navigate to your Azure OpenAI resource
- Go to Keys and Endpoint
- Copy the Endpoint and one of the Keys
-
Configure the application - Create or edit
RetailIntelligenceStudio.Server/appsettings.Development.json:{ "AzureOpenAI": { "Endpoint": "https://your-resource.openai.azure.com/", "DeploymentName": "gpt-4o", "ApiKey": "your-api-key-here" } }β οΈ Security Note: Never commit API keys to source control. Theappsettings.Development.jsonfile is included in.gitignore. -
Alternative: Use environment variables:
# PowerShell $env:AzureOpenAI__Endpoint = "https://your-resource.openai.azure.com/" $env:AzureOpenAI__DeploymentName = "gpt-4o" $env:AzureOpenAI__ApiKey = "your-api-key-here" # Bash export AzureOpenAI__Endpoint="https://your-resource.openai.azure.com/" export AzureOpenAI__DeploymentName="gpt-4o" export AzureOpenAI__ApiKey="your-api-key-here"
This method uses DefaultAzureCredential which supports multiple authentication flows including Azure CLI, Visual Studio, and managed identities.
-
Login to Azure CLI:
az login
-
Ensure you have the required RBAC role on your Azure OpenAI resource:
- Role: Cognitive Services OpenAI User (or Contributor)
- Assign via Azure Portal or CLI:
az role assignment create \ --role "Cognitive Services OpenAI User" \ --assignee your-email@domain.com \ --scope /subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.CognitiveServices/accounts/{openai-resource-name}
-
Configure the endpoint (no API key needed):
{ "AzureOpenAI": { "Endpoint": "https://your-resource.openai.azure.com/", "DeploymentName": "gpt-4o" } }
| Requirement | Details |
|---|---|
| Model Deployment | You need a deployed model (e.g., gpt-4o, gpt-4, gpt-35-turbo) in your Azure OpenAI resource |
| API Version | The application uses the latest Azure OpenAI SDK which handles API versioning automatically |
| Region | Ensure your Azure OpenAI resource is in a region that supports your chosen model |
| Error | Cause | Solution |
|---|---|---|
400 BadRequest |
Invalid endpoint, missing deployment, or auth failure | Verify endpoint URL and deployment name exist |
401 Unauthorized |
Invalid API key or missing RBAC permissions | Check API key or run az login and verify RBAC role |
403 Forbidden |
Subscription/resource access denied | Verify your account has access to the Azure OpenAI resource |
404 NotFound |
Deployment name doesn't exist | Verify the model deployment name in Azure Portal |
DefaultAzureCredential error |
Not logged into Azure CLI | Run az login to authenticate |
| Setting | Environment Variable | Description | Required |
|---|---|---|---|
AzureOpenAI:Endpoint |
AzureOpenAI__Endpoint |
Azure OpenAI endpoint URL | Yes |
AzureOpenAI:DeploymentName |
AzureOpenAI__DeploymentName |
Model deployment name | No (default: gpt-4o) |
AzureOpenAI:ApiKey |
AzureOpenAI__ApiKey |
API key for authentication | No (uses Entra ID if not set) |
retail-intelligence-studio/
βββ RetailIntelligenceStudio.AppHost/ # Aspire orchestration host
βββ RetailIntelligenceStudio.ServiceDefaults/ # Shared service configuration
βββ RetailIntelligenceStudio.Server/ # ASP.NET Core API backend
βββ RetailIntelligenceStudio.Core/ # Domain models and abstractions
βββ RetailIntelligenceStudio.Agents/ # Intelligence agents and orchestration
β βββ Roles/ # Individual agent implementations
β βββ Orchestration/ # Workflow orchestrator
β βββ Infrastructure/ # Agent factories and clients
βββ RetailIntelligenceStudio.Tests/ # Unit and integration tests
βββ frontend/ # React 19 + Vite frontend
The application includes full OpenTelemetry instrumentation:
- Traces: Distributed tracing across all agent executions
- Metrics: Runtime and HTTP metrics
- Structured Logs: Rich logging with emoji prefixes for easy scanning
View all telemetry in the Aspire Dashboard at https://localhost:17204.
Run all tests:
dotnet testRun specific test categories:
dotnet test --filter "OpenTelemetryLoggingTests"| Layer | Technology |
|---|---|
| Orchestration | .NET Aspire 13.1 |
| Backend | ASP.NET Core 10 |
| AI Framework | Microsoft Agent Framework |
| Frontend | React 19, Vite 6, TailwindCSS |
| Observability | OpenTelemetry, Aspire Dashboard |
| AI Provider | Azure OpenAI (or local mock) |
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request