case study hero

SandCloud AI Ultimate: An AI Workflow Platform That Connects Configurable Agents With Automation, End-to-End

SCAI Ultimate is a multi-tenant AI workflow platform that bridges user-configurable AI agents with n8n automation. It combines a LangChain-based conversational agent runtime with retrieval-augmented knowledge base search, embeddable chat widgets with live human handoff, and a secure multi-tenant data layer, so teams can design, deploy, and operate their own AI agents and automations without a dedicated engineering team.

Category

AI Workflow SaaS / Multi-Tenant Platform

Status

Actively developed, in production

Scope

Agents · Workflows · KB RAG · Support Handoff

Overview

SCAI Ultimate lets teams configure their own AI agents, ground those agents in a company knowledge base, and put them to work across chat widgets, support inboxes, and automated workflows. Rather than shipping a single generic chatbot, the platform treats agents and workflows as first-class, configurable building blocks: an agent's goal, tone, model, tools, and memory are all set per-tenant, while n8n handles the heavier, deterministic automation underneath — order lookups, CRM updates, ticketing — triggered the same way a chat message is.

Everything runs multi-tenant from the ground up on Supabase (PostgreSQL with Row-Level Security and pgvector), so every team's agents, knowledge bases, conversations, and credentials are isolated by policy at the database layer, not just by application logic.

The Challenge

Teams adopting AI for customer-facing support and internal operations run into the same set of problems. A single off-the-shelf chatbot can't be deeply configured to a team's own goals, tone, tools, and data — it answers generically or not at all. Answers need to be grounded in the company's own knowledge rather than hallucinated. When the AI genuinely can't help, it needs to hand off to a human gracefully, with the full conversation carried over, instead of dropping the customer. And because the platform serves many organizations at once, data has to stay strictly isolated between tenants — agents, knowledge bases, tickets, and credentials from one team must never be visible to another.

On top of that, conversational AI alone isn't enough: real support and sales flows need to reach into order systems, CRMs, and ticketing tools. Hand-building that integration work for every customer doesn't scale, so the platform needed a way to pair agent conversation logic with a flexible automation layer underneath it.

Our Approach

We treated this as an orchestration-and-trust problem rather than a single LLM wrapper. The platform runs a dual-engine architecture: a LangChain-based agent runtime (src/lib/agents/deepagents.ts) handles conversational intelligence — system-prompt construction, memory, tool use, and knowledge-base-grounded context — while n8n handles deterministic workflow execution, triggered over webhooks so automation logic can be iterated on visually without redeploying application code.

Supabase is the backbone for multi-tenant trust: PostgreSQL with Row-Level Security scopes every table to auth.uid() and team context, pgvector powers both knowledge-base and conversational-memory search, and Supabase Auth handles session cookies over SSR. The frontend is a Next.js App Router application in React 19 and strict TypeScript, with Zustand for client state and React Query for server state. Deno edge functions take asynchronous work — like syncing token usage from n8n executions — off the request path entirely.

What We Built

LangChain Agent Runtime

Each agent's system prompt is assembled from its configured goal, examples, and live memory context, then run through streaming or non-streaming inference depending on the channel. Builder config covers model, provider, temperature, JSON mode, and streaming; memory runs in two modes — a simple last-N message window, or semantic recall via pgvector search over prior session messages. Agents can call HTTP tools (bearer, API key, basic, or custom header auth) or custom JS tools, which execute inside a Node VM sandbox with a 300ms timeout. Every invocation is logged with status, latency, and token usage for later analysis.

Embeddable Widget & Human Handoff State Machine

The chat widget drives a deliberate handoff state machine (ai → offering_handoff → awaiting_email → human). Signals like a repeated question, a failed tool call, an unhelpful streak, an out-of-scope topic, or a low-confidence reply make the agent ask for consent — “Would you like me to connect you with a member of our team?” — before escalating, with quick replies in the widget and typed answers on Telegram. An explicit request to speak to a human skips the question entirely. After a decline, the agent waits a configurable number of customer turns before it's allowed to offer again. Email and phone channels get channel-appropriate variants of the same logic, and every handoff carries the full transcript into a support ticket.

n8n Workflow Orchestration

A singleton n8n client exposes workflows as webhook-triggered automations: chat-style triggers for conversational workflows, and plain webhook triggers for request/response automations, both carrying session state and, where relevant, knowledge-base context injected directly into the payload metadata. Every execution is logged for audit, with token usage synced back asynchronously through a Supabase edge function so the request path itself stays fast.

Knowledge Base RAG

Knowledge base content is chunked, embedded, and stored as pgvector embeddings, searched through a dedicated Supabase RPC (match_knowledge_base_vectors) for low-latency similarity search. Sources can be files (parsed via XLSX and PDF extraction) or imported text, including YouTube transcript import with layered fallbacks for bot-detection issues. The same knowledge base can ground both an agent's conversational replies and an n8n workflow's automated response.

Multi-Tenant Security, Teams & Permissions

Access control runs on two layers: Supabase Row-Level Security at the database, and an application-level team model (owner/member relationships plus seven granular permission keys) that resolves every request to an effective tenant. User-supplied API keys are encrypted at rest with AES-256-GCM and scoped to an allowed-origins list per key. Each embeddable widget has its own per-agent allowed-origins setting rather than one global allowlist, so every embed controls exactly which sites may host it. Sensitive actions are written to an audit log with actor, action, resource, and IP.

Support Inbox & Reporting

Escalated conversations land in a support inbox backed by a single, audited path for status changes, so every ticket carries a full status timeline regardless of whether it was moved by a human reply, a Kustomer webhook, or an automated handoff. The platform also layers in CSAT survey delivery across email, Telegram, SMS, and in-widget surveys, Kustomer-based revenue attribution and reporting, and widget analytics dashboards for understanding chat volume and outcomes.

The Impact

  • Agents are configurable, not generic: goal, tone, model, tools, and memory are all set per tenant, and every reply can be grounded in that tenant's own knowledge base through vector search.
  • Seamless AI-to-human handoff across chat widget, Telegram, email, and phone, with the full conversation carried into the support inbox so customers never repeat themselves.
  • n8n-orchestrated automation lets heavier backend workflows — order lookups, CRM updates, ticketing — run independently of the conversational layer, and be iterated on visually without redeploying the app.
  • Multi-tenant security is enforced end-to-end: Postgres Row-Level Security on every table, AES-256-GCM encrypted API keys, per-agent widget origin allowlisting, and a fully audited ticket status timeline.
  • A granular, seven-key team permission system lets an owner delegate exactly the access a team member needs, without over-provisioning.
  • Built-in reporting covers execution logs, token usage, Kustomer-style revenue reports, and widget analytics — so performance and ROI are visible without exporting data elsewhere.

Technologies

Next.js (App Router)
React 19
TypeScript (strict)
TailwindCSS v4
Framer Motion
Zustand
React Query
Supabase / PostgreSQL
pgvector
Supabase Auth
LangChain
n8n
Deno (Edge Functions)
Docker
AES-256-GCM
Kustomer
Resend
Twilio

Industry Relevance

SCAI Ultimate demonstrates a production approach to AI that doesn't force customers to replace what already works. Rather than a one-size-fits-all chatbot, it lets each tenant shape agents around their own goals, tools, and knowledge, while n8n carries the deterministic automation work that pure conversational AI was never meant to do. The multi-tenant security model — Row-Level Security down to the table, encrypted credentials, and per-agent origin controls — reflects a platform built to be operated safely by many organizations at once, not a single-tenant proof of concept scaled up after the fact.

Incredible Visibility Logo

Let's build the system your industry can rely on.