AI Agents Overview

The AI layer is ten task-scoped agents behind a single execution path. Each is a pure function of (structured input + grounded schema context) → LLM call → parsed structured output. Everything routes through one chokepoint, AgentRunner, which owns context assembly, prompt rendering, the provider call, response parsing, and a durable audit write to agent_runs. There is no shared conversational state between agents and no hidden background inference: an agent runs when you invoke it and writes exactly one accountable row.

The ten agents

Where it lives

Left navigation → AI Agents, one tab per agent. Provider and governance config live under Settings → AI (admin-only).

Provider model, bring your own key, keep your data

Simcha DB Studio is self-hosted and BYO-key. You configure a provider once; keys are stored in the internal settings store, encrypted at rest (AES-256-GCM via the same EncryptionService that protects connection passwords). Prompts are built and dispatched from your own backend, no Simcha-hosted relay sits in the path, and nothing leaves your environment except the outbound call to the provider endpoint you point at. Choose a local runtime (Ollama) and inference never leaves the host at all.

The provider catalog is served by GET /api/ai/providers:

Per-request controls (Settings → AI): maxTokens, temperature, timeoutMs, and free-form extraHeaders for provider quirks (e.g. OpenRouter's HTTP-Referer). The base-URL override is the seam for Azure, Bedrock proxies, and on-prem gateways, pin the endpoint and the model and the rest of the pipeline is unchanged.

License gating

The agent fleet is gated on the AI-enabled license flag (requireAI() on /api/ai), orthogonal to the Starter/Professional/Enterprise tier axis. No flag, no agents, the routes refuse before any provider call is made.

Operator controls (Settings → AI → Agent Behavior)

Defaults are power-user posture: nothing capped, throttled, or cached unless an operator opts in.

Privacy & governance (admin-only)

Under Settings → AI → Privacy & Governance. Changing AI settings requires the admin role.

Default egress is schema structure only: table/column names, types, nullability. No rows.

Audit and cost accounting

Every invocation writes to agent_runs: input/output summary only (full prompts are deliberately not persisted, keeping PII out of long-term storage), prompt/completion tokens, ms duration, model, status, user, connection ID. Async runs additionally write queue state to agent_jobs. Query via GET /api/ai/agents/:id/runs and GET /api/ai/agents/jobs.