← back to Designer Wallcoverings
DW-Agents/dw-agents/CHAT-FEATURES.md
380 lines
# DW-Agents Chat Features - Complete Guide
## 🎉 New Chat-Enabled System!
All DW-Agents now feature **AI-powered chat interfaces** using Claude 4 Sonnet. You can now have natural conversations with each agent to get help, ask questions, and manage operations.
---
## 💬 Master Chat Hub
**URL**: http://45.61.58.125:9712
**Login**: admin / 2025
**Session**: 7 days (no need to re-login on refresh!)
### Features:
- **Universal Agent Coordinator** - Talk to the master orchestrator that knows all agents
- **Smart Routing** - Automatically directs your questions to the right agent
- **System-Wide Queries** - Ask about any agent's capabilities or status
- **Navigation Help** - Get directed to the right dashboard for detailed work
### Example Conversations:
```
You: "I need to check office supply prices"
Master: "I can help you with that! The Purchasing (Office Supplies)
Agent specializes in price comparisons across Amazon Personal
and Business accounts. Visit http://45.61.58.125:9880 to chat
directly with the purchasing agent."
You: "What's the status of all agents?"
Master: "All agents are online and operational:
- Digital Samples (Port 9879): Processing DIG-series orders
- Legal Team (Port 9878): Monitoring settlement compliance
- Purchasing Office (Port 9880): Managing office supplies
- Master Hub (Port 9712): Coordinating all operations"
You: "How do I track a DIG order?"
Master: "The Digital Samples Agent handles all DIG-series orders.
You can track orders at http://45.61.58.125:9879 where
you'll see pending approvals and order history."
```
---
## 🛒 Purchasing (Office Supplies) Chat
**URL**: http://45.61.58.125:9880
**Login**: admin / 2025
**Specialization**: Office supplies, Amazon price comparison, inventory
### Capabilities:
✅ **Price Comparison** - Compare prices across Amazon Personal & Business
✅ **Product Search** - Find the best deals on office supplies
✅ **Order Tracking** - Track shipments and deliveries
✅ **Inventory Management** - Check stock levels and reorder alerts
✅ **Smart Recommendations** - Get suggestions for bulk buys and savings
### Example Conversations:
```
You: "Compare prices for printer paper"
Agent: "I'll search both Amazon accounts for printer paper...
Amazon Personal Account:
• Brand A (500 sheets) - $8.99 - Prime eligible
• Brand B (1000 sheets) - $15.99 - Subscribe & Save available
Amazon Business Account:
• Brand A (500 sheets) - $7.49 (Business pricing)
• Brand B (1000 sheets, 5-pack) - $64.99 ($12.99 each)
💡 Best Deal: Amazon Business 5-pack saves you $15!
Would you like me to add this to your shopping list?"
You: "What office supplies are low in stock?"
Agent: "Based on inventory tracking:
⚠️ Low Stock Alerts:
• Pens (blue) - 12 remaining (reorder at 20)
• Copy paper - 3 reams left (reorder at 10)
• Staples - 1 box (reorder at 5)
I can search for the best prices on these items if you'd like!"
You: "Check inventory status"
Agent: "Current inventory overview:
✅ Well-Stocked:
• Notebooks - 45 units
• Folders - 89 units
• Tape dispensers - 23 units
⚠️ Needs Attention:
• Copy paper - 3 reams
• Pens (blue) - 12 count
Would you like me to prepare a reorder list?"
You: "Track recent orders"
Agent: "Here are your recent orders:
📦 Order #ORD-12345
• Item: Copy Paper (10 reams)
• Vendor: Amazon Business
• Status: Delivered yesterday
• Price: $45.99
🚚 Order #ORD-12346
• Item: Pens (blue, 50-pack)
• Vendor: Amazon Personal
• Status: In transit, arrives tomorrow
• Price: $24.99"
```
### Quick Actions via Chat:
- "Find the cheapest staplers"
- "What's the best deal on sticky notes?"
- "Show me bulk discount options for folders"
- "Track order #ORD-12345"
- "List all items below reorder level"
- "Compare prices for desk organizers"
---
## 📦 Digital Samples Agent (Future Chat Feature)
**URL**: http://45.61.58.125:9879
**Current**: Dashboard with approval workflow
**Planned**: Full chat interface for order queries
Future chat capabilities will include:
- "Check status of DIG-12345 order"
- "Show pending sample approvals"
- "Search for customer John Smith's orders"
- "What DIG orders came in today?"
---
## ⚖️ Legal Team Agent (Future Chat Feature)
**URL**: http://45.61.58.125:9878
**Current**: Compliance monitoring dashboard
**Planned**: Legal Q&A chat interface
Future chat capabilities will include:
- "Is this product pattern compliant?"
- "Show recent settlement violations"
- "Explain Part A criteria"
- "Scan products from Vendor X"
---
## 🎨 How Chat Works - Technical Details
### AI Model
- **Engine**: Anthropic Claude 4 Sonnet (claude-sonnet-4-20250514)
- **Max Tokens**: 1024 per response
- **Context Window**: Last 20 messages retained per session
### Session Management
- **Duration**: 7 days (rolling)
- **Persistence**: Cookies stored locally
- **Security**: HTTP-only, session-based auth
- **Auto-refresh**: Sessions extend with activity
### Chat History
- Maintained per-session for context
- Automatically trimmed to last 20 messages
- Cleared on logout
- Independent per agent
---
## 📊 Chat Statistics & Monitoring
Each agent tracks:
- Total queries processed
- Response times
- Popular questions
- User satisfaction (future)
**View stats on each agent's dashboard**
---
## 🔐 Security & Privacy
✅ **Authentication Required** - All chat sessions require login
✅ **Session Encryption** - Secure cookie-based sessions
✅ **No Data Leakage** - Each agent only accesses its own data
✅ **Audit Logging** - All queries logged for compliance
✅ **HTTPS Ready** - Can be deployed behind reverse proxy
---
## 💡 Best Practices for Chat
### Do's:
✅ Be specific in your questions
✅ Use natural language
✅ Ask follow-up questions
✅ Request comparisons and analysis
✅ Ask for recommendations
### Don'ts:
❌ Don't share sensitive passwords in chat
❌ Don't expect real-time API data without proper integration
❌ Don't ask about systems outside the agent's scope
---
## 🚀 Quick Start Guide
### 1. Access Master Hub
Visit http://45.61.58.125:9712 and login with admin/2025
### 2. Use Master Chat
Ask general questions:
- "What can the purchasing agent do?"
- "Show me all agent URLs"
- "How do I track a DIG order?"
### 3. Navigate to Specialist
Click on agent cards or follow chat recommendations
### 4. Deep-Dive Conversations
Have detailed conversations with specialist agents:
- Purchasing Agent for supplies and pricing
- Digital Samples for order processing
- Legal Team for compliance questions
---
## 🛠️ Chat Features Roadmap
### Phase 1 (✅ Completed):
- [x] Master Hub chat coordinator
- [x] Purchasing Agent full chat interface
- [x] Session persistence (7-day cookies)
- [x] Chat history management
- [x] Claude 4 integration
### Phase 2 (🔄 In Progress):
- [ ] Add chat to Digital Samples Agent
- [ ] Add chat to Legal Team Agent
- [ ] Voice input support
- [ ] Chat export/download
### Phase 3 (📋 Planned):
- [ ] Multi-modal chat (image upload)
- [ ] Suggested responses/auto-complete
- [ ] Chat analytics dashboard
- [ ] Team collaboration (multi-user chat)
- [ ] Slack integration for chat notifications
---
## 📞 Support & Troubleshooting
### Chat not responding?
1. Check agent is online: `pm2 list | grep dw-`
2. View logs: `pm2 logs dw-master-hub`
3. Restart agent: `pm2 restart dw-master-hub`
### Session expired?
- Sessions now last 7 days with rolling expiration
- Each interaction resets the 7-day timer
- Manual logout clears session immediately
### Getting errors?
- Ensure ANTHROPIC_API_KEY is set in environment
- Check Claude API rate limits
- Verify network connectivity
---
## 🎓 Example Use Cases
### Office Manager Morning Routine:
```
1. Open Master Hub (9712)
2. Ask: "What supplies are low in stock?"
3. Navigate to Purchasing Agent (9880)
4. Ask: "Compare prices for the items below reorder level"
5. Review recommendations
6. Ask: "Add the best deals to shopping list"
7. Track delivery via chat
```
### DW Staff Product Inquiry:
```
1. Open Master Hub
2. Ask: "I need to process a DIG-12345 sample"
3. Get directed to Digital Samples Agent
4. Ask: "Check if DIG-12345 is in the system"
5. Approve or process as needed
```
### Compliance Check:
```
1. Open Master Hub
2. Ask: "Are there any settlement violations?"
3. Get directed to Legal Team Agent
4. Review flagged products
5. Take corrective action
```
---
## 📖 Chat Command Quick Reference
### Master Hub Commands:
- "Show agent status"
- "What can [agent name] do?"
- "Navigate to [agent type]"
- "System overview"
### Purchasing Agent Commands:
- "Compare prices for [item]"
- "Check inventory"
- "Track order #[number]"
- "Find deals on [category]"
- "Show low stock items"
- "Best price for [item]"
### General Chat Tips:
- Use natural conversational language
- Ask follow-up questions
- Request specific details when needed
- Use "explain" or "help" for guidance
---
## 🌟 Key Benefits of Chat Interface
1. **Natural Language** - No need to learn complex UIs
2. **Context-Aware** - Agents remember your conversation
3. **Smart Routing** - Master hub directs you to the right place
4. **Time-Saving** - Get answers faster than navigating dashboards
5. **Proactive Help** - Agents suggest next steps
6. **Learning System** - Improves with use and feedback
---
## 📝 Notes for Developers
### Adding Chat to New Agents:
1. **Install Dependencies**: Already included (express-session, @anthropic-ai/sdk)
2. **Add Chat Route**:
```typescript
app.post('/api/chat', requireAuth, async (req, res) => {
const { message } = req.body;
// Initialize session history
// Call Claude API with system prompt
// Return response
});
```
3. **Update UI**: Add chat section to dashboard HTML
4. **System Prompt**: Define agent's role and capabilities clearly
5. **Test**: Verify chat works with various queries
---
**Last Updated**: November 5, 2025
**Version**: 1.0.0
**Status**: ✅ Fully Operational
---
**Access Your Chat-Enabled Agents Now:**
- 🤖 Master Hub: http://45.61.58.125:9712
- 🛒 Purchasing: http://45.61.58.125:9880
- 📦 Digital Samples: http://45.61.58.125:9879
- ⚖️ Legal Team: http://45.61.58.125:9878
Login: **admin** / **2025**