AI agent and config models
AiAgent
Table ai_agents.
| Field | Type | Notes |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
Nullable, allowing a shared agent across workspaces |
|
|
Vercel AI Gateway slug, e.g. |
|
|
Retell |
|
|
The published version; null only before the first version exists |
Indexes: subscriptionId, retellAgentId.
Relations: subscription, versions (relation AgentVersions), latestVersion (relation
LatestVersion), campaignsPreferredForAnalysis (relation
CampaignPreferredAnalysisAgent), callAiAgentAnalysisResults, calls.
The two relations to AiAgentVersion are intentional: versions is the full history,
latestVersion is a pointer to the one currently published.
AiAgentVersion
Table ai_agent_versions. Immutable once written.
| Field | Type | Notes |
|---|---|---|
|
|
|
|
|
|
|
|
1-based |
|
|
default |
|
|
default |
|
|
No |
Unique: (aiAgentId, version). Indexes: aiAgentId, subscriptionId.
Relations: subscription, aiAgent, agentAsLatest, analysisResults, calls.
Because Call.agentVersionId and CallAiAgentAnalysisResult.aiAgentVersionId both reference this
table, a call can always be replayed against the exact prompt that was live when it happened.
AgentTestCase
Table agent_test_cases. A saved conversation plus its correct answer, for regression-testing prompt
changes.
| Field | Type | Notes |
|---|---|---|
|
|
|
|
|
|
|
|
The call it was captured from; null for hand-written cases |
|
|
Missing transcript ⇒ the case is skipped, not failed |
|
|
|
|
|
Ground truth |
|
|
Ground truth |
|
|
Ground truth |
Indexes: subscriptionId, sourceCallId. Relation: sourceCall (relation CallTestCases).
A null ground-truth column means "not asserted": the runner reports pass: null and excludes the
field from the verdict rather than counting it as a pass. See
Regression test cases.
Configs
Table configs. Per-workspace key/value settings.
| Field | Type | Notes |
|---|---|---|
|
|
Globally unique |
|
|
|
|
|
Always a string; callers coerce |
Indexes: key, subscriptionId.
Known keys (CONFIG_KEYS in lib/constants.ts):
| Key | Effect |
|---|---|
|
Master switch for automatic number purchasing |
|
Cap on purchases per day |
|
ISO datetime watermark for |
Automatic purchasing requires both to be enabled.
|
|
Accessed through lib/repositories/config-repository.ts. Workspace members can list, create, and
edit values on the Settings Config tab (/settings), which calls GET|POST /api/configs and
PATCH /api/configs/{id}.