Architecture & AI models

How the platform is built

Application

  • Web & API: Next.js (App Router) with React and TypeScript. Route handlers under /api share one request wrapper for authentication, RBAC, rate limiting, CSRF origin checks, JSON-schema validation and error handling.
  • Database: SQLite via Node’s built-in driver for development and single-node deployments; schema and migrations are portable to PostgreSQL (DDL with row-level security provided in db/postgres).
  • Object storage: local directory per organisation in this version; S3-compatible storage for production.
  • Background work: a worker process runs scheduled workflows (npm run worker).

Tenant isolation

Every tenant-owned row has org_id. Organisation context comes only from the session (membership-checked) or the API key — never from request bodies. All data access functions take the organisation as their first argument and bind it in every query. Tests assert cross-organisation reads return 404.

Engines and provider adapters

InterfaceBuilt-in implementationPluggable providers
Multimodal inference / product understandingPixel metrics, keyword classifier, colour namingNVIDIA NIM (OpenAI-compatible chat with image input)
Text generation (catalog)Grounded template generator + claim guardNVIDIA NIM, any OpenAI-compatible endpoint (vLLM, TGI…)
Embeddings / matchingPerceptual hash + feature-hashed text vectorsTriton Inference Server (KServe v2 HTTP)
Predictive inferenceStatistical forecaster; logistic risk baselineTriton (planned for trained models)
Agent orchestrationRule-based planner + policy runtimeLLM planner (planned) behind the same policy layer
Response evaluationSchema validation, banned-claim guard, listing scorerOffline evaluation sets (planned)

Configuring AI providers

Keys are read only on the server. They are never sent to the browser and never logged. The app shows a provider as “configured” when its variables are set and “verified” only after a successful call.
# NVIDIA NIM — hosted (build.nvidia.com) or self-hosted container
NIM_BASE_URL=https://integrate.api.nvidia.com/v1
NVIDIA_API_KEY=nvapi-...
NIM_VISION_MODEL=<vision-language model id>
NIM_TEXT_MODEL=<instruction model id>

# Any OpenAI-compatible endpoint (e.g. vLLM on your own GPU)
OPENAI_COMPAT_BASE_URL=http://gpu-host:8000/v1
OPENAI_COMPAT_API_KEY=...
OPENAI_COMPAT_TEXT_MODEL=<model id>

# NVIDIA Triton (KServe v2): model with BYTES input "text" and FP32 output
TRITON_URL=http://triton:8000
TRITON_EMBEDDING_MODEL=text_embedder

GPU inference services are deployed independently of the web application (separate host or Kubernetes node pool) and reached over the network, so they can scale to zero when idle.

Agent runtime

  • Tool registry: each tool has an owning agent, a tier (T0–T3) and an optional external provider.
  • Policy: T0/T1 run automatically; T2 runs automatically only if the agent’s policy is “auto-run reversible”; T3 always creates an approval (admin/owner).
  • Execution: tasks are persisted with status, attempts, duration and an idempotency key (unique per organisation).
  • Ledger: every event is stored with hash = SHA-256(prev_hash | kind | run | task | payload | time). GET /api/agents/ledger/verify recomputes the chain.