Skip to content

Commit a5b6a2d

Browse files
Merge branch 'main' into feature/security-review
2 parents ada0e4f + 6e5e46e commit a5b6a2d

File tree

11 files changed

+2360
-6
lines changed

11 files changed

+2360
-6
lines changed

DEMO.md

Lines changed: 578 additions & 0 deletions
Large diffs are not rendered by default.

QUICKSTART.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# Quick Start - Invoice Classifier Demo
2+
3+
Get the Business Process Agents platform running in under 5 minutes!
4+
5+
## Prerequisites
6+
7+
- Docker and Docker Compose
8+
- 4GB+ RAM available
9+
- Linux, macOS, or Windows (WSL2)
10+
11+
Install required tools:
12+
```bash
13+
# macOS
14+
brew install jq curl
15+
16+
# Ubuntu/Debian
17+
sudo apt-get install -y jq curl
18+
```
19+
20+
## 1-Minute Quick Start
21+
22+
```bash
23+
# Clone the repository
24+
git clone https://github.com/dylan-mccarthy/Scalable-Process-Agent-System.git
25+
cd Scalable-Process-Agent-System
26+
27+
# Run the interactive demo
28+
./demo-invoice-classifier.sh
29+
```
30+
31+
That's it! The demo will:
32+
1. ✅ Start all required services
33+
2. ✅ Deploy the Invoice Classifier agent
34+
3. ✅ Show you the complete workflow
35+
4. ✅ Demonstrate observability features
36+
37+
## What You'll See
38+
39+
The demo showcases invoice classification using AI:
40+
41+
```
42+
Invoice → Azure Service Bus → Node Runtime → GPT-4 Classification → API Delivery
43+
```
44+
45+
**Sample Invoice:**
46+
```json
47+
{
48+
"vendorName": "Office Depot",
49+
"invoiceNumber": "DEMO-001",
50+
"totalAmount": 542.75,
51+
"currency": "USD"
52+
}
53+
```
54+
55+
**Classification Result:**
56+
```json
57+
{
58+
"vendorCategory": "Office Supplies",
59+
"routingDestination": "Procurement Department",
60+
"confidence": 0.98
61+
}
62+
```
63+
64+
## Services Started
65+
66+
| Service | URL | Purpose |
67+
|---------|-----|---------|
68+
| Control Plane API | http://localhost:8080 | REST + gRPC API |
69+
| PostgreSQL | localhost:5432 | Persistent storage |
70+
| Redis | localhost:6379 | Leases & locks |
71+
| NATS | localhost:4222 | Event streaming |
72+
| Node Runtime | (internal) | Agent execution |
73+
74+
## Explore the API
75+
76+
After the demo starts, try these commands:
77+
78+
```bash
79+
# List agents
80+
curl http://localhost:8080/v1/agents | jq
81+
82+
# List nodes
83+
curl http://localhost:8080/v1/nodes | jq
84+
85+
# View agent details
86+
curl http://localhost:8080/v1/agents/invoice-classifier | jq
87+
```
88+
89+
## View Logs
90+
91+
```bash
92+
# All logs
93+
docker compose logs -f
94+
95+
# Control Plane only
96+
docker compose logs -f control-plane
97+
98+
# Node Runtime only
99+
docker compose logs -f node-runtime
100+
```
101+
102+
## Cleanup
103+
104+
```bash
105+
./demo-invoice-classifier.sh cleanup
106+
```
107+
108+
To remove all data:
109+
```bash
110+
docker compose down -v
111+
```
112+
113+
## Next Steps
114+
115+
1. **Read the full walkthrough**: [DEMO.md](DEMO.md)
116+
2. **Deploy to Kubernetes**: `./infra/scripts/setup-k3d.sh`
117+
3. **Run E2E tests**: `dotnet test tests/E2E.Tests/`
118+
4. **Configure Azure AI**: [docs/AZURE_AI_FOUNDRY_INTEGRATION.md](docs/AZURE_AI_FOUNDRY_INTEGRATION.md)
119+
120+
## Troubleshooting
121+
122+
**Services won't start?**
123+
- Check Docker is running: `docker ps`
124+
- Ensure ports are available: 5432, 6379, 4222, 8080
125+
- Check available RAM: Minimum 4GB required
126+
127+
**Control Plane not ready?**
128+
- Wait up to 60 seconds for first startup
129+
- Check logs: `docker compose logs control-plane`
130+
131+
**Need help?**
132+
- See full troubleshooting guide in [DEMO.md](DEMO.md)
133+
134+
## What's Running?
135+
136+
The platform demonstrates:
137+
-**Distributed Orchestration**: Control Plane schedules work to nodes
138+
-**Agent Execution**: Microsoft Agent Framework + GPT-4
139+
-**Service Integration**: Azure Service Bus + HTTP output
140+
-**Observability**: OpenTelemetry metrics, traces, and logs
141+
-**Resilience**: DLQ, retries, lease management
142+
143+
---
144+
145+
**Ready for more?** See the [full demo walkthrough](DEMO.md) for detailed explanations and advanced features.

README.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ This is the Business Process Agents MVP project, providing a complete platform f
2929

3030
## Quick Start
3131

32+
### 🎬 Interactive Demo (NEW!)
33+
34+
Experience the complete invoice classification workflow:
35+
36+
```bash
37+
./demo-invoice-classifier.sh
38+
```
39+
40+
This interactive demo walks you through:
41+
- ✅ Deploying the Invoice Classifier agent
42+
- ✅ Understanding the end-to-end processing flow
43+
- ✅ Exploring observability features
44+
- ✅ Testing with sample invoices
45+
46+
**See [DEMO.md](DEMO.md) for detailed walkthrough documentation.**
47+
48+
**For a faster start, see [QUICKSTART.md](QUICKSTART.md).**
49+
3250
### Option 1: Local Kubernetes with k3d (Recommended)
3351

3452
The fastest way to get a complete environment running locally:
@@ -52,6 +70,8 @@ This will create a local Kubernetes cluster and deploy all services:
5270
- Control Plane API: http://localhost:8080
5371
- Admin UI: http://localhost:3000
5472

73+
> **Note**: The k3d setup does not include Azure AI Foundry. Configure Azure AI Foundry credentials for the Node Runtime to enable agent execution. See [Azure AI Foundry Configuration](#azure-ai-foundry-configuration) section below.
74+
5575
**Cleanup:**
5676
```bash
5777
./infra/scripts/cleanup-k3d.sh
@@ -78,6 +98,8 @@ docker-compose down
7898
- Control Plane API: http://localhost:8080
7999
- Admin UI: http://localhost:3000
80100

101+
> **Note**: Docker Compose does not include Azure AI Foundry. You must configure Azure AI Foundry credentials in `src/Node.Runtime/appsettings.json` or use environment variables. See [Azure AI Foundry Configuration](#azure-ai-foundry-configuration) section below.
102+
81103
### Option 3: Local Development (No Docker)
82104

83105
Build and run individual services for development:
@@ -118,6 +140,23 @@ The API will be available at `http://localhost:5109`.
118140

119141
#### Running Node Runtime
120142

143+
Before running the Node Runtime, **configure Azure AI Foundry** (required for agent execution):
144+
145+
```bash
146+
# Option 1: Use user secrets (recommended for development)
147+
cd src/Node.Runtime
148+
dotnet user-secrets set "AgentRuntime:AzureAIFoundry:Endpoint" "https://your-resource.openai.azure.com/"
149+
dotnet user-secrets set "AgentRuntime:AzureAIFoundry:ApiKey" "your-api-key"
150+
dotnet user-secrets set "AgentRuntime:AzureAIFoundry:DeploymentName" "gpt-4o-mini"
151+
152+
# Option 2: Use environment variables
153+
export AgentRuntime__AzureAIFoundry__Endpoint="https://your-resource.openai.azure.com/"
154+
export AgentRuntime__AzureAIFoundry__ApiKey="your-api-key"
155+
export AgentRuntime__AzureAIFoundry__DeploymentName="gpt-4o-mini"
156+
```
157+
158+
Then start the Node Runtime:
159+
121160
```bash
122161
cd src/Node.Runtime
123162
dotnet run
@@ -134,6 +173,134 @@ The Node Runtime will:
134173
- PostgreSQL 14 or later (for production use)
135174
- Redis 6.0 or later (for lease and lock management)
136175
- NATS Server 2.10+ with JetStream enabled (for event streaming)
176+
- **Azure AI Foundry** or **Azure OpenAI Service** (for LLM-powered agent execution)
177+
178+
## Azure AI Foundry Configuration
179+
180+
The platform uses **Azure AI Foundry** (or Azure OpenAI Service) to power LLM-based agent execution. You must configure Azure AI Foundry for agents to process requests using AI models like GPT-4.
181+
182+
### Quick Setup
183+
184+
1. **Create Azure AI Foundry Resource**:
185+
```bash
186+
# Create resource group
187+
az group create --name rg-bpa-agents --location eastus
188+
189+
# Create Azure AI Foundry resource
190+
az cognitiveservices account create \
191+
--name my-ai-foundry \
192+
--resource-group rg-bpa-agents \
193+
--kind AIServices \
194+
--sku S0 \
195+
--location eastus
196+
```
197+
198+
2. **Deploy a Model**:
199+
- Navigate to your Azure AI Foundry resource in the Azure Portal
200+
- Go to "Deployments" → "Create new deployment"
201+
- Select model: `gpt-4o-mini` (recommended for cost-effective MVP)
202+
- Name: `gpt-4o-mini`
203+
- Note your endpoint: `https://your-resource.openai.azure.com/`
204+
205+
3. **Configure Node Runtime** (edit `src/Node.Runtime/appsettings.json`):
206+
```json
207+
{
208+
"AgentRuntime": {
209+
"DefaultModel": "gpt-4o-mini",
210+
"DefaultTemperature": 0.7,
211+
"MaxTokens": 4000,
212+
"MaxDurationSeconds": 60,
213+
"AzureAIFoundry": {
214+
"Endpoint": "https://your-resource.openai.azure.com/",
215+
"DeploymentName": "gpt-4o-mini",
216+
"ApiKey": "your-api-key-here",
217+
"UseManagedIdentity": false
218+
}
219+
}
220+
}
221+
```
222+
223+
> **Security Best Practice**: Never commit API keys to source control. Use one of these approaches:
224+
> - **Development**: `dotnet user-secrets set "AgentRuntime:AzureAIFoundry:ApiKey" "your-key"`
225+
> - **Production**: Use Managed Identity (set `UseManagedIdentity: true`) or Azure Key Vault
226+
> - **Environment Variables**: `export AgentRuntime__AzureAIFoundry__ApiKey="your-key"`
227+
228+
### Supported Models
229+
230+
Azure AI Foundry supports various models for different use cases:
231+
232+
| Model Family | Model | Best For | Cost |
233+
|-------------|-------|----------|------|
234+
| **GPT-4 Optimized** | `gpt-4o` | Latest performance, multimodal | $$$ |
235+
| | `gpt-4o-mini` | Cost-effective, fast, recommended for MVP | $ |
236+
| **GPT-4** | `gpt-4` | Complex reasoning tasks | $$$$ |
237+
| | `gpt-4-32k` | Extended context (32K tokens) | $$$$$ |
238+
| **GPT-3.5** | `gpt-3.5-turbo` | Fast, cost-effective | $ |
239+
| | `gpt-3.5-turbo-16k` | Extended context (16K tokens) | $$ |
240+
241+
### Configuration Options
242+
243+
| Setting | Required | Default | Description |
244+
|---------|----------|---------|-------------|
245+
| `Endpoint` || - | Azure AI Foundry endpoint URL |
246+
| `DeploymentName` || - | Model deployment name in Azure |
247+
| `ApiKey` |* | - | API key for authentication |
248+
| `UseManagedIdentity` | | `false` | Use Azure Managed Identity instead of API key |
249+
250+
*Required if `UseManagedIdentity` is `false`
251+
252+
### Using Managed Identity (Recommended for Production)
253+
254+
Managed Identity eliminates the need for API keys:
255+
256+
```json
257+
{
258+
"AgentRuntime": {
259+
"AzureAIFoundry": {
260+
"Endpoint": "https://your-resource.openai.azure.com/",
261+
"DeploymentName": "gpt-4o-mini",
262+
"UseManagedIdentity": true
263+
}
264+
}
265+
}
266+
```
267+
268+
Grant your Node Runtime's managed identity access:
269+
270+
```bash
271+
# Get Node Runtime's managed identity principal ID
272+
PRINCIPAL_ID=$(az aks show --name my-aks --resource-group my-rg --query identityProfile.kubeletidentity.clientId -o tsv)
273+
274+
# Get Azure AI Foundry resource ID
275+
AI_RESOURCE_ID=$(az cognitiveservices account show --name my-ai-foundry --resource-group rg-bpa-agents --query id -o tsv)
276+
277+
# Assign Cognitive Services User role
278+
az role assignment create \
279+
--assignee $PRINCIPAL_ID \
280+
--role "Cognitive Services User" \
281+
--scope $AI_RESOURCE_ID
282+
```
283+
284+
### Budget & Cost Management
285+
286+
Control costs by setting budget constraints in agent definitions:
287+
288+
```json
289+
{
290+
"agentId": "invoice-classifier",
291+
"budget": {
292+
"maxTokens": 2000,
293+
"maxDurationSeconds": 30
294+
}
295+
}
296+
```
297+
298+
The platform automatically tracks token usage and costs for each run. Monitor in:
299+
- Azure Portal: Cost analysis for Azure AI Foundry
300+
- Application logs: Token usage per execution
301+
- OpenTelemetry metrics: `run_tokens`, `run_cost_usd`
302+
303+
**For detailed Azure AI Foundry configuration, see [docs/AZURE_AI_FOUNDRY_INTEGRATION.md](docs/AZURE_AI_FOUNDRY_INTEGRATION.md).**
137304

138305
## Database Setup
139306

@@ -1171,7 +1338,9 @@ cd agents
11711338

11721339
## Documentation
11731340

1341+
- **[Demo Walkthrough (DEMO.md)](DEMO.md)** - Interactive demo guide for invoice classification (E8-T3)
11741342
- [System Architecture Document (SAD)](sad.md) - High-level system design and architecture
1343+
- [Architecture Diagrams](docs/ARCHITECTURE_DIAGRAMS.md) - C4 context and container diagrams
11751344
- [Invoice Classifier Agent](docs/INVOICE_CLASSIFIER.md) - Technical documentation for the MVP Invoice Classifier agent
11761345
- [Agent Definitions Guide](agents/README.md) - Guide to agent definitions and seeding agents
11771346
- [Agent Versioning and Validation](docs/VERSIONING.md) - Guide to agent versioning, semantic versioning, and spec validation

0 commit comments

Comments
 (0)