Skip to main content

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:

  1. User connects to chat UI and selects "BGV Agent"
  2. Frontend establishes Socket.io connection with Hexabot
  3. User sends "I want background verification"
  4. Agent Router identifies it's for BGV Agent
  5. BGV Agent asks for PAN upload
  6. User uploads PAN card via modal
  7. Frontend sends file upload event to Hexabot
  8. BGV Agent forwards to Prophunt Webserver
  9. Webserver processes OCR, stores data
  10. Webserver calls Hexabot API: "Payment required"
  11. Hexabot sends payment link to user via Socket.io
  12. User completes payment
  13. Payment gateway webhooks Webserver
  14. Webserver calls Hexabot API: "Payment successful"
  15. Hexabot notifies user, starts verification
  16. Webserver calls third-party BGV service
  17. When complete, Webserver calls Hexabot API: "Report ready"
  18. 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:

  1. Start with Architecture Overview to understand the big picture
  2. Read Multi-Agent System to understand how agents work
  3. Follow How to Add a New Agent to create your first agent
  4. 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

Contributing

This is internal Prophunt documentation. For contribution guidelines, contact the core team.


Ready to dive in? Start with the Architecture Overview