How vinayvermavlogs/multi_ai_agent_code works
CortexAI is a multi-agent AI workspace with chat history, Google authentication, and credit-based payments. Users sign in, create or select a conversation, submit a prompt or file, and receive an agent-generated response that is saved to chat history; they can also purchase credits. The agent graph selects specialized workflows, including PDF retrieval, while chat, auth, billing, and Redis support the product. The README documents additional agent capabilities not all inspected here; those branches are represented at the agent-directory level, with uncertain implementation links omitted.
Main entry points: Home.jsx React Workspace · auth.controller.js Authentication · index.js Gateway Router · graph.js Agent Graph
Components 23
User Workspace
- React Workspace
frontend/src/pages/Home.jsx - Conversation Sidebar
frontend/src/components/SideBar.jsx - Chat Interface
frontend/src/components/ChatArea.jsx - Artifact Viewer
frontend/src/components/Artifact.jsx - Credit Drawer
frontend/src/components/BillingDrawer.jsx - API Client
frontend/utils/axios.js
API Gateway
- Gateway Router
backend/gateway/index.js
AI Workflows
- Agent Controller
backend/services/agent/controllers/agent.controller.js - Agent Graph
backend/services/agent/graph/graph.js - Auto Router
backend/services/agent/graph/router.js - Specialized Agents
backend/services/agent/agents - PDF Retrieval
backend/services/agent/agents/pdfRag.agent.js - LLM Models
backend/services/agent/config/llmModels.js
Identity and Billing
- Authentication
backend/services/auth/controllers/auth.controller.js - Payment Service
backend/services/billing/controllers/billing.controller.js
Persistence and Cache
- Conversation Service
backend/services/chat/controllers/chat.controller.js - User Records
backend/services/auth/models/user.model.js - Payment Records
backend/services/billing/models/payment.model.js - Conversation and Messages
backend/services/chat/models/coversation.model.js - Redis Cache
backend/shared/redis/redis.js
Other components
- User
- Firebase Auth
- Razorpay
Connections 26
- User → React Workspace: uses
- React Workspace → Conversation Sidebar: renders
frontend/src/pages/Home.jsx - React Workspace → Chat Interface: renders
frontend/src/pages/Home.jsx - React Workspace → Artifact Viewer: renders
frontend/src/pages/Home.jsx - React Workspace → Firebase Auth: signs in with
frontend/src/pages/Home.jsx - React Workspace → API Client: calls
frontend/src/pages/Home.jsx - Conversation Sidebar → Credit Drawer: opens
frontend/src/components/SideBar.jsx - API Client → Gateway Router: sends requests
- Gateway Router → Agent Controller: routes requests
- Gateway Router → Authentication: routes requests
- Gateway Router → Payment Service: routes requests
- Agent Controller → Conversation Service: saves messages
backend/services/agent/controllers/agent.controller.js - Agent Controller → Agent Graph: invokes
backend/services/agent/controllers/agent.controller.js - Agent Graph → Auto Router: dispatches through
backend/services/agent/graph/graph.js - Agent Graph → Specialized Agents: dispatches to
backend/services/agent/graph/graph.js - Auto Router → LLM Models: gets router model
backend/services/agent/graph/router.js - Auto Router → Agent Controller: imports
backend/services/agent/graph/router.js - Agent Graph → PDF Retrieval: dispatches to
backend/services/agent/graph/graph.js - PDF Retrieval → LLM Models: gets PDF model
backend/services/agent/agents/pdfRag.agent.js - Authentication → User Records: reads and updates
backend/services/auth/controllers/auth.controller.js - Authentication → Redis Cache: stores sessions
backend/services/auth/controllers/auth.controller.js - Authentication → Firebase Auth: verifies tokens
backend/services/auth/controllers/auth.controller.js - Payment Service → Payment Records: records payments
backend/services/billing/controllers/billing.controller.js - Payment Service → Razorpay: creates orders
backend/services/billing/controllers/billing.controller.js - Payment Service → Authentication: updates plan
backend/services/billing/controllers/billing.controller.js - Conversation Service → Conversation and Messages: reads and writes
backend/services/chat/controllers/chat.controller.js