Skip to content

CodeUltr0n/AI-MultiAgents-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Multi-Agent Token Triage System

Intelligent Support Ticket Management with Autonomous AI Agents

Node.js Express React MongoDB Google Gemini Inngest

An AI-powered support ticket system where autonomous agents handle the entire triage workflow β€” from analyzing issues and extracting priorities to matching tickets with the right moderators and sending notifications. No manual routing needed.


Demo

TODO: Add screenshots and demo video. See the Media section for recommended assets.


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                          FRONTEND (React + Vite)                    β”‚
β”‚                                                                     β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚   β”‚  Signup   β”‚  β”‚  Login   β”‚  β”‚  Tokens  β”‚  β”‚   Admin Panel    β”‚  β”‚
β”‚   β”‚  Page     β”‚  β”‚  Page    β”‚  β”‚  Dashboardβ”‚  β”‚   (User Mgmt)    β”‚  β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚          β”‚             β”‚             β”‚               β”‚              β”‚
β”‚          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                              β”‚ REST API                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    BACKEND (Express + MongoDB)                      β”‚
β”‚                              β”‚                                      β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚   β”‚                    Express API Server                      β”‚     β”‚
β”‚   β”‚  /api/auth/*          /api/tokens/*        /api/inngest   β”‚     β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚                              β”‚                                      β”‚
β”‚          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
β”‚          β”‚                   β”‚                   β”‚                  β”‚
β”‚          β–Ό                   β–Ό                   β–Ό                  β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚   β”‚   MongoDB   β”‚    β”‚   Inngest   β”‚    β”‚  Mailtrap   β”‚            β”‚
β”‚   β”‚  Database   β”‚    β”‚  Workflows  β”‚    β”‚    SMTP     β”‚            β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”‚                              β”‚                                      β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”‚
β”‚         β”‚                    β”‚                    β”‚                 β”‚
β”‚         β–Ό                    β–Ό                    β–Ό                 β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚   β”‚  Agent 1  β”‚     β”‚    Agent 2    β”‚     β”‚   Google     β”‚         β”‚
β”‚   β”‚  Welcome  β”‚     β”‚  AI Triage    β”‚     β”‚   Gemini     β”‚         β”‚
β”‚   β”‚  Email    β”‚     β”‚  Pipeline     β”‚     β”‚   2.5 Flash  β”‚         β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β”‚                                                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

How It Works

This system uses two autonomous AI agents built on Inngest's durable workflow engine:

Agent 1: Welcome Email Agent

Triggered when a new user signs up. Looks up the user in the database and sends a welcome email via Mailtrap SMTP.

Agent 2: AI Triage Agent (Core)

Triggered when a support token is created. Runs a 6-step pipeline:

Token Created
     β”‚
     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. Fetch Token  β”‚  Retrieve from MongoDB
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 2. Set Status   β”‚  Mark as "TODO"
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 3. AI Analysis (Google Gemini 2.5 Flash) β”‚
β”‚    β€’ Summary extraction                  β”‚
β”‚    β€’ Priority classification             β”‚
β”‚    β€’ Helpful notes generation            β”‚
β”‚    β€’ Related skills extraction           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 4. Update Token β”‚  Save AI results to DB
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 5. Auto-Assignment                       β”‚
β”‚    β€’ Match skills β†’ moderator            β”‚
β”‚    β€’ Fallback β†’ admin                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 6. Notify       β”‚  Email assigned moderator
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Features

  • Autonomous AI Triage β€” Google Gemini analyzes each ticket, extracts priority, summary, and required skills automatically
  • Smart Assignment β€” Tickets are routed to moderators based on skill matching, with admin fallback
  • Durable Workflows β€” Inngest ensures each pipeline step is retriable and fault-tolerant
  • Role-Based Access β€” Three roles (user, moderator, admin) with distinct permissions
  • Skill-Based Routing β€” Moderators have skill tags; AI matches ticket requirements to the right person
  • Email Notifications β€” Assigned moderators receive automatic email alerts
  • Admin Panel β€” Full user management: roles, skills, and search

Tech Stack

Layer Technology Purpose
AI Engine Google Gemini 2.5 Flash Ticket analysis, priority extraction, skill matching
Agent Framework Inngest + @inngest/agent-kit Durable multi-step workflows with retries
Backend Express v5 + Node.js REST API server
Database MongoDB + Mongoose User and token persistence
Auth JWT + bcrypt Token-based authentication with password hashing
Frontend React 19 + Vite Single-page application
Styling Tailwind CSS v4 + DaisyUI v5 UI components and responsive design
Email Nodemailer + Mailtrap SMTP email delivery (dev sandbox)

Project Structure

AI-Multi-Agents-v1/
β”œβ”€β”€ ai-token-assistant/              # Backend API
β”‚   β”œβ”€β”€ index.js                     # Express server entry point
β”‚   β”œβ”€β”€ env.js                       # Environment config loader
β”‚   β”œβ”€β”€ makeAdmin.js                 # CLI: promote user to admin
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ token.js                 # Token CRUD + creation event
β”‚   β”‚   └── user.js                  # Auth + user management
β”‚   β”œβ”€β”€ inngest/
β”‚   β”‚   β”œβ”€β”€ client.js                # Inngest client setup
β”‚   β”‚   └── functions/
β”‚   β”‚       β”œβ”€β”€ onsignup.js          # Agent 1: welcome email
β”‚   β”‚       └── ont-token-create.js  # Agent 2: AI triage pipeline
β”‚   β”œβ”€β”€ middlewares/
β”‚   β”‚   └── auth.js                  # JWT verification + role guards
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ token.js                 # Token schema (title, priority, skills...)
β”‚   β”‚   └── user.js                  # User schema (email, role, skills)
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ token.js                 # /api/tokens/*
β”‚   β”‚   └── user.js                  # /api/auth/*
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   └── cleanDb.js               # Database cleanup utility
β”‚   └── utils/
β”‚       β”œβ”€β”€ Ai.js                    # Gemini AI agent wrapper
β”‚       └── mailer.js                # Nodemailer SMTP config
β”‚
β”œβ”€β”€ ai-token-frontend/               # React SPA
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.jsx                 # App entry point
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ checkauth.jsx        # Route guard (auth protection)
β”‚   β”‚   β”‚   └── navbar.jsx           # Dynamic navigation bar
β”‚   β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”‚   └── api.js               # API client (axios)
β”‚   β”‚   └── pages/
β”‚   β”‚       β”œβ”€β”€ login.jsx            # Login page
β”‚   β”‚       β”œβ”€β”€ Signup.jsx           # Registration page
β”‚   β”‚       β”œβ”€β”€ tokens.jsx           # Token list + creation
β”‚   β”‚       β”œβ”€β”€ token.jsx            # Token detail view
β”‚   β”‚       └── admin.jsx            # Admin user management
β”‚   └── vite.config.js
β”‚
└── README.md

Getting Started

Prerequisites

  • Node.js 18+
  • MongoDB instance (local or Atlas)
  • Google Gemini API key
  • Mailtrap account (for email testing)

Installation

# Clone the repository
git clone https://github.com/your-username/AI-Multi-Agents-v1.git
cd AI-Multi-Agents-v1

Backend setup:

cd ai-token-assistant
npm install

# Create environment file
cp .env.sample .env
# Edit .env with your credentials

Frontend setup:

cd ../ai-token-frontend
npm install

# Create environment file
cp .env.example .env
# Set VITE_SERVER_URL=http://localhost:3000/api

Environment Variables

Backend (ai-token-assistant/.env):

Variable Description
MONGO_URI MongoDB connection string
JWT_SECRET Secret key for JWT signing
GEMINI_API_KEY Google Gemini API key
MAILTRAP_SMTP_HOST Mailtrap SMTP host
MAILTRAP_SMTP_PORT Mailtrap SMTP port
MAILTRAP_SMTP_USER Mailtrap SMTP username
MAILTRAP_SMTP_PASS Mailtrap SMTP password
APP_URL Frontend URL (http://localhost:5173)

Frontend (ai-token-frontend/.env):

Variable Description
VITE_SERVER_URL Backend API URL (http://localhost:3000/api)

Run the Application

You need three terminals running simultaneously:

# Terminal 1 β€” Backend API
cd ai-token-assistant
npm run dev

# Terminal 2 β€” Inngest Dev Server
cd ai-token-assistant
npm run inngest-dev

# Terminal 3 β€” Frontend
cd ai-token-frontend
npm run dev

First-Time Setup

  1. Open http://localhost:5173 and create an account
  2. Promote your user to admin:
    cd ai-token-assistant
    node makeAdmin.js your-email@example.com
  3. Log in again β€” you now have access to the Admin panel

API Reference

Auth Routes

Method Endpoint Auth Description
POST /api/auth/signup β€” Register a new user
POST /api/auth/login β€” Login, returns JWT
POST /api/auth/logout User Verify token (stateless)
GET /api/auth/users Admin List all users
POST /api/auth/update-user Admin Update user role & skills

Token Routes

Method Endpoint Auth Description
GET /api/tokens User List tokens (own for users, all for mods/admins)
GET /api/tokens/:id User Get token details
POST /api/tokens User Create token (triggers AI triage)

Data Models

User:

  • email β€” Unique email address
  • password β€” Bcrypt-hashed password
  • role β€” user | moderator | admin
  • skills β€” Array of skill tags (e.g., ["React", "MongoDB"])

Token:

  • title β€” Issue title
  • description β€” Full issue description
  • status β€” TODO | IN_PROGRESS
  • priority β€” low | medium | high (AI-generated)
  • helpfulNotes β€” AI-generated technical notes
  • relatedSkills β€” AI-extracted skill tags
  • assignedTo β€” Assigned moderator/admin reference
  • createdBy β€” Token creator reference

Customization

Component What to Change
AI Model Swap Gemini for any LLM in utils/Ai.js
Email Provider Replace Mailtrap with any SMTP provider in utils/mailer.js
Skills Taxonomy Update the AI prompt in utils/Ai.js to extract domain-specific skills
Assignment Logic Modify the matching algorithm in ont-token-create.js
UI Theme Change DaisyUI theme in Tailwind config

Acknowledgments

  • Inngest for the durable workflow engine and agent framework
  • Google Gemini for the AI analysis capabilities
  • DaisyUI for the UI component library
  • Mailtrap for email testing infrastructure

Built with autonomous agents. Powered by intelligent automation.

About

AI-powered support ticket triage system with autonomous agents. Uses Google Gemini for intelligent issue analysis, skill-based moderator assignment, and automated email notifications. Built with Express, React, MongoDB, and Inngest.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages