Skip to content
~/benhattab
Back to work
In productionSaaS2026 — present

Synka Sphere

A SaaS platform where companies hire AI employees

A multi-tenant platform where each company hires “AI employees”: agents grounded in its own documents through RAG, able to act inside Gmail, Slack, Notion and Google Drive — with human approval scaled to how risky the action is.

55
agent personas
3
applications
5+
connected tools
Role

Founder & sole engineer — product, architecture, code, infrastructure

Stack
Laravel 13PHP 8.3Next.js 16React 19PostgreSQL 16pgvectorRedis 7Laravel HorizonSanctumOpenRoutern8nFirecrawlDocker
Links
The problem

Enterprise AI assistants hit the same two walls. First, they answer from a generic model and start inventing as soon as internal processes come up. Second, even well-informed, they do nothing — they draft the email and a human copy-pastes it. The actual work stays manual. And the moment you do let an agent act, a new question appears immediately: what is it allowed to do without asking?

The approach

I treated the three problems separately. Grounding is a RAG pipeline: a workspace's documents are ingested asynchronously, chunked, embedded into pgvector, and every answer returns sourced citations — if the agent finds nothing it says so instead of improvising.

Action goes through n8n rather than hand-rolled integration code. Each provider (Gmail, Slack, Notion, Drive, Dropbox) is a workflow referenced from configuration, so adding a tool does not require redeploying the backend. The agent emits an intent, the backend translates it into a workflow call, and the result returns into the conversation.

Trust is a risk level attached to every action. Reading a document runs straight through. Sending an external email or deleting anything escalates to a human who approves or rejects. It is the part demos skip and the part companies ask about first.

Isolation is strict and structural: one workspace's data is never reachable from another, including inside the vector indexes. On a product that ingests its customers' internal documents, that is the only guarantee that genuinely matters.

Architecture
  1. 01

    API & orchestration

    Laravel 13 behind Sanctum (SPA cookies) and Google OAuth. All business logic and agent orchestration live here. It is the single source of truth.

    Laravel 13 · PHP 8.3

  2. 02

    Vector memory

    PostgreSQL 16 + pgvector. One engine for both relational data and semantic search — no separate vector database to keep in sync and back up.

    PostgreSQL 16 · pgvector

  3. 03

    Queues & ingestion

    Redis 7 and Laravel Horizon. Document ingestion and web crawling (Firecrawl) are asynchronous: dropping 200 files never blocks the interface.

    Redis 7 · Horizon · Firecrawl

  4. 04

    Model layer

    A provider-agnostic factory driven by AI_PROVIDER, defaulting to OpenRouter. Switching models is an environment variable, not a rewrite.

    OpenRouter · provider factory

  5. 05

    Integration engine

    n8n. Every external provider is a workflow referenced from config; risky actions wait for human approval before firing.

    n8n

  6. 06

    Interfaces

    Two Next.js 16 App Router apps: the user-facing product with token-by-token SSE streaming, and a separate superadmin dashboard for platform supervision.

    Next.js 16 · React 19

Trade-offs

pgvector over a dedicated vector database

I have used Qdrant on other projects and it is excellent. Here, keeping embeddings inside Postgres saves me a second system to back up, restore and keep consistent with relational data — and crucially, workspace isolation is expressed in the same SQL constraints as the rest of the domain. At the scale of a young SaaS, that simplicity beats the last few points of performance.

n8n as the integration engine, not as a gadget

Hand-writing the OAuth integrations for Gmail, Slack, Notion, Drive and Dropbox means five separate pieces of technical debt to maintain for years. Delegating to n8n turns each new connector into a workflow plus an ID in config. The accepted trade-off: one more operational dependency to monitor.

Human approval graded by risk

Approving everything makes the product useless; approving nothing makes it unacceptable. So the risk level is carried by the action itself. Reads and drafts run on their own; external sends, deletions and writes into third-party tools require sign-off. That is what makes the platform deployable inside a real company.

Highlights
  • 55 ready-made agent personas — Support, Marketing, Sales, Finance, HR — each with its own tool scope and tone
  • Strict per-workspace data isolation, all the way down into the vector indexes
  • SSE-streamed answers with sourced citations pointing back to the original document
  • Multilingual public support widget (EN / FR / AR) embeddable on any website
  • Asynchronous document ingestion and website crawling via Firecrawl
  • Superadmin dashboard, health checks and scheduled-task monitoring