Building PrismBot: A Multi-Tenant, Multi-Agent Chat Architecture
A multi-tenant AI chatbot backend built with NestJS and TypeScript that utilizes LangGraph for a supervisor-specialist agent routing system, delivering real-time responses and autonomous CRM updates via WebSockets.
3-Stage
RAG pipeline with parallel query expansion
100%
Tenant isolation across vectors, KB, and CRM
2
Specialist agents (RAG Expert & CRM Sales)
WhatsApp messaging gets complicated at scale.
Single-agent LLM systems struggle with context bloat and lack the ability to simultaneously query complex knowledge bases while also updating customer relationship databases autonomously. Additionally, serving multiple enterprise tenants requires strict data isolation to prevent data leakage.
Challenge 1
Static AI pipelines cannot easily update CRM records based on conversation context.
Challenge 2
Monolithic LLMs are vulnerable to jailbreaks and script injections.
Challenge 3
Data leakage risks in shared vector databases and chat histories.
Challenge 4
Tightly coupled WebSocket logic makes it hard to scale AI agent tools.
Parallel query expansion significantly improves the recall of relevant vector chunks.
Abstracting WebSockets via closures allows LLM agents to safely trigger UI updates without knowing the transport layer.
Running a mandatory CRM agent post-query ensures user profiles stay updated dynamically.
Pre-pipeline guardrails are essential to prevent costly and dangerous prompt injections.
Built with technologies we trust.
Project Goals
The Outcome
The PrismBot architecture proves that moving away from monolithic LLM prompts toward a multi-agent, supervisor-driven model drastically improves reliability and feature depth. By strictly isolating tenant context and decoupling the WebSocket layer from the LLM execution, we created a highly scalable platform.
Conclusion & Impact
"The PrismBot architecture proves that moving away from monolithic LLM prompts toward a multi-agent, supervisor-driven model drastically improves reliability and feature depth. By strictly isolating tenant context and decoupling the WebSocket layer from the LLM execution, we created a highly scalable platform."
Have a project in mind?
Let's discuss how we can help you build your next big thing.
Reach out and our team will be in touch.
Building systems that
hold up in production.
Bring up the problem others won't attempt.