Share
## https://sploitus.com/exploit?id=D156225F-5496-5259-831A-81F4F6624A68
# Sales-to-Delivery Agent Orchestration System - POC

## Phase 1.1 Complete: Registry Service + Base Agent

This POC demonstrates a **Dynamic Persona-Based Agent Orchestration System** using a three-tier hierarchical architecture with capability-skill separation and registry-based service discovery.

## ๐Ÿ—๏ธ What's Implemented (Phase 1.1)

### โœ… Core Foundation
- **BaseAgent Class**: Common functionality for all agents with registry integration
- **Registry Service**: Central service discovery and capability management API
- **Initial Data Files**: JSON-based persistence for all agent data
- **Project Structure**: Complete directory structure for three-tier architecture

### โœ… Registry Service APIs
- `POST /api/agents/register` - Agent registration with capabilities
- `POST /api/capabilities/query` - Persona-based capability discovery  
- `GET /api/agents` - Agent directory listing
- `GET /api/personas` - Persona configuration and permissions
- `GET /health` - Service health check

### โœ… BaseAgent Features
- Automatic registry registration on startup
- Persona context handling and propagation
- Standardized error handling with confidence scoring
- Health monitoring and agent communication utilities

## ๐Ÿš€ Quick Start

**โš ๏ธ IMPORTANT: Always use virtual environment for this project!**

### 1. Create and Activate Virtual Environment
```powershell
cd "c:\Users\goswamee\OneDrive - HP Inc\Workspace\Blueprint\POC"

# Create virtual environment
python -m venv poc-env

# Activate virtual environment (Windows PowerShell)
poc-env\Scripts\activate

# Verify activation - you should see (poc-env) in your prompt
```

### 2. Install Dependencies
```powershell
# Make sure virtual environment is activated first!
pip install -r requirements.txt

# Verify installation
pip list
```

### 3. Start Registry Service
```powershell
# Virtual environment must be activated
python agents\registry_service.py
```
You should see:
```
๐Ÿš€ Starting Registry Service...
๐ŸŒ Registry Service running on: http://localhost:8000
```

### 4. Test Registry Service
Open a **new PowerShell terminal**, activate virtual environment, then run:
```powershell
# In new terminal - activate virtual environment first!
cd "c:\Users\goswamee\OneDrive - HP Inc\Workspace\Blueprint\POC"
poc-env\Scripts\activate

# Run tests
python test_registry.py
```

## ๐Ÿ“ Project Structure

```
poc-agent-orchestration/
โ”œโ”€โ”€ poc-env/                       # Virtual environment (excluded from git)
โ”‚   โ”œโ”€โ”€ Scripts/                   # Python executable and activation scripts (Windows)
โ”‚   โ”œโ”€โ”€ Lib/                       # Installed packages
โ”‚   โ””โ”€โ”€ pyvenv.cfg                 # Environment configuration
โ”œโ”€โ”€ agents/                        # All agent implementations
โ”‚   โ”œโ”€โ”€ __init__.py                # Package initialization
โ”‚   โ”œโ”€โ”€ base_agent.py              # โœ… Base class for all agents
โ”‚   โ”œโ”€โ”€ registry_service.py        # โœ… Central registry service
โ”‚   โ”œโ”€โ”€ virtual_assistant.py       # ๐Ÿ”„ Phase 3 (Tier 1)
โ”‚   โ”œโ”€โ”€ sales_domain_agent.py      # ๐Ÿ”„ Phase 2 (Tier 2)
โ”‚   โ”œโ”€โ”€ onboarding_domain_agent.py # ๐Ÿ”„ Phase 2 (Tier 2)
โ”‚   โ””โ”€โ”€ drones/                     # ๐Ÿ”„ Phase 1.2 (Tier 3)
โ”‚       โ”œโ”€โ”€ cpq_drone.py           # Deal and pricing management
โ”‚       โ”œโ”€โ”€ tm_drone.py            # Transition workflow tracking
โ”‚       โ”œโ”€โ”€ ms4_drone.py           # Customer master data
โ”‚       โ””โ”€โ”€ itsm_drone.py          # Contract management
โ”œโ”€โ”€ data/                          # โœ… JSON persistence files
โ”‚   โ”œโ”€โ”€ registry.json              # Registry service data
โ”‚   โ”œโ”€โ”€ sales_data.json            # CPQ drone data
โ”‚   โ”œโ”€โ”€ transition_data.json       # TM drone data
โ”‚   โ”œโ”€โ”€ customer_data.json         # MS4 drone data  
โ”‚   โ””โ”€โ”€ contract_data.json         # ITSM drone data
โ”œโ”€โ”€ docs/                          # Documentation
โ”‚   โ”œโ”€โ”€ design/
โ”‚   โ”‚   โ””โ”€โ”€ registry.md            # โœ… Registry design documentation
โ”‚   โ”œโ”€โ”€ plan.md                    # Implementation plan
โ”‚   โ”œโ”€โ”€ POC.md                     # POC specification
โ”‚   โ””โ”€โ”€ skill-driven-ai-agent-architecture.md
โ”œโ”€โ”€ skills/                        # ๐Ÿ”„ Phase 2 (Skills framework)
โ”œโ”€โ”€ web/                           # ๐Ÿ”„ Phase 3 (Web interface)
โ”œโ”€โ”€ .gitignore                     # โœ… Git ignore rules
โ”œโ”€โ”€ .instructions.md               # โœ… Copilot instructions
โ”œโ”€โ”€ requirements.txt               # โœ… Python dependencies
โ”œโ”€โ”€ README.md                      # This file
โ””โ”€โ”€ test_registry.py               # โœ… Phase 1.1 validation
```

## ๐Ÿงช Test Results

After running `python test_registry.py`, you should see:
```
๐Ÿš€ Starting Registry Service Tests - Phase 1.1 Validation
โœ… Registry Health Check
โœ… Agent Registration  
โœ… Capability Query
โœ… Agent Directory
โœ… Persona Configuration
๐ŸŽ‰ Phase 1.1 validation successful! Ready for Phase 1.2 (Drone Agents)
```

## ๐Ÿ”ง Architecture Highlights

### Three-Tier Agent Hierarchy
- **Tier 1 (Virtual Assistant)**: Persona management, UI generation, capability routing
- **Tier 2 (Process Agents)**: Business logic, domain expertise, workflow orchestration
- **Tier 3 (Drone/Task Agents)**: System integration, direct tool execution, data operations

### Registry-Based Orchestration  
- All agents register capabilities on startup
- Virtual Assistant queries registry for persona-accessible capabilities
- Dynamic capability discovery enables adaptive user experiences

### Persona-Based Access Control
- **Sales**: Can access sales operations and common queries
- **Onboarding**: Can access onboarding workflows and staged deals  
- **ServiceDelivery**: Can access contracts and delivery metrics

## ๐ŸŽฏ Next Steps

### Phase 1.2: Drone Agents (Tier 3)
- Implement CPQ-Drone for deal management
- Implement TM-Drone for workflow tracking
- Implement MS4-Drone for customer data
- Implement ITSM-Drone for contract management

### Phase 2: Process Agents (Tier 2)  
- Create skills framework
- Implement Sales Domain Agent
- Implement Onboarding Domain Agent

### Phase 3: Virtual Assistant (Tier 1)
- Implement persona-based routing
- Create dynamic UI generation
- Build web interface

## ๐Ÿ› Troubleshooting

### Virtual Environment Issues
**Problem**: Command not found or import errors
```powershell
# Check if virtual environment is activated
echo $env:VIRTUAL_ENV    # Should show path to poc-env

# If not activated
poc-env\Scripts\activate

# Verify Python is using virtual environment
where python             # Should point to poc-env\Scripts\python.exe
```

**Problem**: Virtual environment creation fails
```powershell
# Upgrade pip first
python -m pip install --upgrade pip

# Try creating venv again
python -m venv poc-env
```

### Registry Service Won't Start
**Problem**: Port 8000 already in use
```powershell
# Check what's using port 8000
netstat -an | findstr :8000

# Kill process if needed (find PID first)
taskkill /f /pid 
```

**Problem**: Module import errors
```powershell
# Make sure virtual environment is activated and dependencies installed
poc-env\Scripts\activate
pip install -r requirements.txt
```

### Test Failures
**Problem**: Registry connection failed
- Ensure virtual environment is activated in BOTH terminals
- Start registry service FIRST, then run tests in separate terminal
- Check firewall isn't blocking localhost connections
- Verify data directory exists and is writable

### Dependencies Issues  
**Problem**: Package installation fails
```powershell
# Update pip and setuptools
pip install --upgrade pip setuptools

# Clear pip cache
pip cache purge

# Reinstall requirements
pip install -r requirements.txt
```

---

**Status**: โœ… Phase 1.1 Complete - Registry Service + Base Agent  
**Next**: ๐Ÿ”„ Phase 1.2 - Drone Agents Implementation