Introduction
Welcome to the Hexabot + Prophunt Multi-Agent Documentation!
This documentation provides comprehensive coverage of the multi-agent chatbot architecture built on Hexabot, integrated with the Prophunt webserver and frontend.
What is this system?
This is a multi-agent conversational AI platform that allows users to interact with specialized AI agents (BGV, Loan, Listing) through a unified chat interface. The system combines:
- Hexabot - The core chatbot framework providing conversation management, message routing, and plugin architecture
- Prophunt Webserver - Business logic layer handling payments, document verification, and third-party integrations
- Multi-Agent Orchestrator - Custom extension enabling multiple specialized agents with isolated contexts
- Angular Frontend - Real-time chat UI with Socket.io integration
Key Features
✅ Multi-Agent Architecture - Multiple specialized agents (BGV, Loan, Listing) with isolated conversation contexts
✅ Real-Time Communication - Socket.io for instant bidirectional messaging
✅ Persistent Conversations - Resume conversations across sessions
✅ External Integration - Webserver can inject messages and trigger events
✅ Event-Driven Design - Decoupled architecture using pub/sub pattern
✅ Type-Safe - Full TypeScript implementation with strong typing
Architecture Overview
┌─────────────────────────────────────────────────────────────────┐
│ Angular Frontend │
│ • Chat UI │
│ • Agent Selection │
│ • Socket.io Client │
└───────────────────────┬─────────────────────────────────────────┘
│
│ Socket.io (ws://localhost:4000)
│
┌───────────────────────▼─────────────────────────────────────────┐
│ Hexabot Server │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ ChatGateway (Socket.io Handler) │ │
│ └────────────────────┬─────────────────────────────────────┘ │
│ │ │
│ ┌────────────────────▼─────────────────────────────────────┐ │
│ │ AgentOrchestrator │ │
│ │ • Agent Router │ │
│ │ • Event Bus │ │
│ │ • Channel Manager │ │
│ │ • Conversation Manager │ │
│ └────┬────────────────────────┬──────────────────────────┬─┘ │
│ │ │ │ │
│ ┌────▼────┐ ┌───────▼──────┐ ┌──────▼────────┐ │
│ │ BGV │ │ Loan │ │ Listing │ │
│ │ Agent │ │ Agent │ │ Agent │ │
│ └────┬────┘ └───────┬──────┘ └──────┬────────┘ │
│ │ │ │ │
│ └───────────────┴─────────────────┘ │
│ │ │
│ ┌────────────────────▼─────────────────────────────────────┐ │
│ │ ConversationRepo & MessageRepo │ │
│ │ (MongoDB Persistence) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ AgentApiController (REST API) │ │
│ │ • POST /agent-api/send-message │ │
│ │ • POST /agent-api/link-verification │ │
│ │ • GET /agent-api/conversation/:taskId/history │ │
│ └────────────────────┬─────────────────────────────────────┘ │
└───────────────────────┼─────────────────────────────────────────┘
│
│ HTTP REST API
│
┌───────────────────────▼─────────────────────────────────────────┐
│ Prophunt Webserver │
│ • Business Logic │
│ • Payment Processing │
│ • Document Verification (BGV) │
│ • Third-Party Integrations │
└─────────────────────────────────────────────────────────────────┘
User Journey Example
Here's how a typical BGV (Background Verification) flow works:
- User connects to chat UI and selects "BGV Agent"
- Frontend establishes Socket.io connection with Hexabot
- User sends "I want background verification"
- Agent Router identifies it's for BGV Agent
- BGV Agent asks for PAN upload
- User uploads PAN card via modal
- Frontend sends file upload event to Hexabot
- BGV Agent forwards to Prophunt Webserver
- Webserver processes OCR, stores data
- Webserver calls Hexabot API: "Payment required"
- Hexabot sends payment link to user via Socket.io
- User completes payment
- Payment gateway webhooks Webserver
- Webserver calls Hexabot API: "Payment successful"
- Hexabot notifies user, starts verification
- Webserver calls third-party BGV service
- When complete, Webserver calls Hexabot API: "Report ready"
- User receives report link in chat
Documentation Structure
This documentation is organized into the following sections:
📐 Architecture
Deep dive into the system architecture, design patterns, and component interactions.
🤖 Agents
Everything about agents - how they work, lifecycle, and specific agent implementations (BGV, Loan, Listing).
🔌 Backend Integration
How Prophunt Webserver integrates with Hexabot - REST APIs, event flows, and webhook patterns.
💬 Frontend Integration
How the Angular frontend connects via Socket.io, sends messages, and handles agent-specific UI.
🗄️ Data Models
Complete database schema documentation for conversations, messages, and agent contexts.
🚀 Deployment
Environment setup, Docker configuration, production deployment, and troubleshooting.
🛠️ Extending the System
Step-by-step guides for adding new agents, custom message types, and extending functionality.
Quick Start
If you're new to the system:
- Start with Architecture Overview to understand the big picture
- Read Multi-Agent System to understand how agents work
- Follow How to Add a New Agent to create your first agent
- Integrate using Frontend Integration guide
Prerequisites
To work with this system, you should have:
- Node.js 18+ and npm
- TypeScript knowledge
- NestJS framework understanding (helpful but not required)
- MongoDB for persistence
- Socket.io for real-time communication
- Docker for containerization (optional)
Getting Help
- GitHub Issues: Report bugs or request features
- Architecture Questions: See Architecture FAQ
- API Reference: See Backend Integration
Contributing
This is internal Prophunt documentation. For contribution guidelines, contact the core team.
Ready to dive in? Start with the Architecture Overview →