Multi-Tenancy

How one Configent deployment serves isolated clients — each with its own branding, corpus, prompts, and cost limits — driven by a single YAML file per client.


Drop a YAML file in config/, documents in corpora/<client_id>/ and prompts in prompts/<client_id>/, and a branded, isolated assistant goes live. No code changes, no redeployment.

Two clients ship today, one per template: gcp-platform-support (support graph) and f1-analyst (text-to-SQL). Every boundary on this page is enforced on every request, and a new tenant of an existing template needs only its own files.


One YAML, one client

Each file in config/*.yaml defines one client:

# config/gcp-platform-support.yaml
client_id: gcp-platform-support
name: "Cloud Platform Support"

branding:
  logo: assets/gcp-platform-support/logo.svg
  primary_color: "#1a73e8"
  assistant_name: "DeployBot"

corpus:
  source: corpora/gcp-platform-support/

agent:
  model: anthropic/claude-haiku-4.5
  system_prompt_file: prompts/gcp-platform-support/answer.md

limits:
  rate_limit_per_minute: 60
  daily_budget_usd: 2.00

A second file, say config/newco.yaml, makes newco available at /c/newco without touching any other configuration or code.


Config registry

At first use, config/registry.py scans config/*.yaml, validates each file, and builds a module-level singleton:

config/*.yaml
      │
      ▼  yaml.safe_load()
      ▼  ClientConfig.model_validate()   Pydantic; unknown agent keys rejected
      ▼  price_for(agent.model)          no row in config/pricing/claude.yaml → ValueError
      │
_registry_instance: ConfigRegistry      singleton, keyed by client_id

Validation failures raise with the filename and field name, not at request time. The scan is not recursive, so config/pricing/ is never mistaken for a client.

# apps/api/app/config/registry.py
registry = get_registry()
cfg = registry.get("gcp-platform-support")   # KeyError if not found

DEV_CONFIG_RELOAD=1 makes .get() reload the YAML directory on every call, for local config iteration without restarting the server.


Isolation boundaries

client_id is the isolation key. It appears as a column on every data table:

Tableclient_id role
clientsPrimary key row; config snapshot stored here
documentsScopes the corpus: search never crosses client boundaries
chunksDenormalized for index-scoped pgvector queries (no join on hot path)
conversationsScopes message history
runsScopes the step trail. The ticket confirm endpoint checks it before resuming a run
tracesScopes per-turn observability data, and the daily budget sum
eval_runsScopes evaluation results

The API router validates client_id against the config registry on every request. A conversation or run id that belongs to a different client returns 404, not the other client’s data.


Branding API

The frontend loads branding at render time:

GET /api/clients/:client_id/branding

{
  "id": "gcp-platform-support",
  "name": "Cloud Platform Support",
  "primary_color": "#1a73e8",
  "logo": "assets/gcp-platform-support/logo.svg",
  "assistant_name": "DeployBot",
  "suggested_questions": ["My Cloud Run container fails to start — what does the PORT error mean?", "..."],
  "tagline": "I answer Cloud Run, GKE and IAM questions from public Google Cloud documentation…"
}

The Next.js shell applies primary_color as the accent and renders assistant_name in the chat header. There is no client-specific frontend code.


Config schema

ClientConfig is a Pydantic model in apps/api/app/config/schema.py:

SectionKey fields
brandinglogo, primary_color, assistant_name, tagline, suggested_questions
corpussource, chunking.chunk_size, chunking.overlap (support graph only)
agenttemplate, model, system_prompt_file, max_tokens, then the template’s own keys
escalationqueue, team, categories, product_areas, preamble
evalsgolden_set, judge_model
limitsrate_limit_per_minute, daily_budget_usd

client_id is validated as a lowercase slug ([a-z0-9][a-z0-9-]*[a-z0-9]). Duplicate client_id values across files fail with the conflicting filenames named.

See Config Reference for the full field listing.


Adding a new client

  1. Create config/<client_id>.yaml.
  2. Add documents to corpora/<client_id>/.
  3. Write the four prompts in prompts/<client_id>/: answer.md, grade.md, rewrite.md, ticket_draft.md.
  4. If the client uses a new model, add its row to config/pricing/claude.yaml.
  5. Ingest the corpus, then open /c/<client_id>.

Adding a New Use Case walks the whole recipe.