Skip to main content

Agent Tables

agent_mappings

Maps Ultravox agents to local records with configuration overrides. Each mapping belongs to an agency and can optionally be linked to a client and campaign.

ColumnTypeDefaultNullableDescription
iduuiduuid_generate_v4()noPrimary key
agency_iduuidnoFK → agencies.id
ultravox_agent_idvarchar(255)noUltravox-side agent identifier
ultravox_agent_namevarchar(255)yesAgent display name
client_iduuidyesFK → clients.id (optional assignment)
campaign_iduuidyesFK → campaigns.id (optional assignment)
default_directioncall_directionyesDefault call direction for this agent
system_prompttextyesThe agent's system prompt
voicevarchar(100)yesVoice ID from Ultravox
language_hintvarchar(10)'en'noLanguage hint for speech recognition
temperaturenumeric(3,2)0.4noLLM temperature (0.00–1.00)
first_speaker_texttextyesText the agent speaks when answering
recording_enabledbooleantruenoWhether calls are recorded
max_duration_secondsinteger3600noMaximum call duration (1–86400)
toolsjsonb'[]'noTool IDs assigned to this agent
last_synced_attimestamptzyesLast successful sync with Ultravox
sync_errortextyesLast sync error message
managed_by_virsynbooleanfalsenoWhether Virsyn manages this agent
created_attimestamptznow()noRecord creation timestamp
updated_attimestamptznow()noLast update timestamp (auto-updated)

Constraints:

ConstraintTypeDetails
agent_mappings_pkeyPrimary keyid
agent_mappings_unique_per_agencyUnique(agency_id, ultravox_agent_id)
agent_mappings_agency_id_fkeyForeign keyagency_idagencies(id) ON DELETE CASCADE
agent_mappings_client_id_fkeyForeign keyclient_idclients(id) ON DELETE SET NULL
agent_mappings_campaign_id_fkeyForeign keycampaign_idcampaigns(id) ON DELETE SET NULL
agent_mappings_temperature_rangeChecktemperature >= 0.0 AND temperature <= 1.0
agent_mappings_max_duration_positiveCheckmax_duration_seconds > 0 AND max_duration_seconds <= 86400

Indexes:

IndexColumns
idx_agent_mappings_agency_idagency_id
idx_agent_mappings_ultravox_agentultravox_agent_id
idx_agent_mappings_client_idclient_id
idx_agent_mappings_campaign_idcampaign_id

Triggers:

TriggerEventFunction
update_agent_mappings_updated_atBEFORE UPDATEupdate_updated_at_column()

Related edge functions: agents-create, agents-list, agents-get, agents-update, agents-delete, agents-assign, agents-sync, save-agent-mapping


agency_tools

Tools available to agents during calls. Synced from Ultravox and cached locally.

ColumnTypeDefaultNullableDescription
iduuiduuid_generate_v4()noPrimary key
agency_iduuidnoFK → agencies.id
ultravox_tool_idtextnoUltravox-side tool identifier
nametextnoTool display name
descriptiontextyesHuman-readable tool description
tool_typetextyesTool classification (e.g., http, client)
ownershiptextyesWho owns the tool (user, system)
created_at_ultravoxtimestamptzyesWhen created in Ultravox
definitionjsonb'{}'noFull tool definition from Ultravox
http_base_urltextyesBase URL for HTTP-type tools
http_methodtextyesHTTP method for HTTP-type tools
dynamic_parametersjsonb'[]'yesParameters resolved at runtime
static_parametersjsonb'[]'yesFixed parameters
categoryvarchar(50)yesUI grouping category
tagstext[]'{}'yesSearchable tags
iconvarchar(50)yesUI icon identifier
is_activebooleantruenoWhether the tool is enabled
managed_by_virsynbooleanfalsenoWhether Virsyn manages this tool
last_synced_attimestamptzyesLast successful sync
sync_errortextyesLast sync error message
created_attimestamptznow()noRecord creation timestamp
updated_attimestamptznow()noLast update timestamp (auto-updated)
created_byuuidyesFK → users.id

Constraints:

ConstraintTypeDetails
agency_tools_pkeyPrimary keyid
agency_tools_unique_ultravox_idUnique(agency_id, ultravox_tool_id)
agency_tools_agency_id_fkeyForeign keyagency_idagencies(id) ON DELETE CASCADE
agency_tools_created_by_fkeyForeign keycreated_byusers(id) ON DELETE SET NULL
agency_tools_name_not_emptyChecklength(trim(name)) > 0

Indexes:

IndexColumnsNotes
idx_agency_tools_agency_idagency_idAgency-scoped queries
idx_agency_tools_ultravox_idultravox_tool_idLookup by Ultravox ID
idx_agency_tools_tool_type(agency_id, tool_type)Filter by type
idx_agency_tools_active(agency_id, is_active)Active tools only (WHERE is_active = true)
idx_agency_tools_category(agency_id, category)Filter by category (WHERE category IS NOT NULL)

Triggers:

TriggerEventFunction
update_agency_tools_updated_atBEFORE UPDATEupdate_updated_at_column()

Related edge functions: tools-list, tools-get, tools-sync


ultravox_voices

Cached voice catalog from Ultravox. Not agency-scoped — shared across all agencies.

ColumnTypeDefaultNullableDescription
idtextnoPrimary key — Ultravox voice ID
nametextnoVoice display name
descriptiontextyesVoice description
language_labeltextyesHuman-readable language label
primary_languagetextyesISO language code
ownershiptextyesVoice ownership (fixie, user)
billing_styletextyesHow the voice is billed
providertextyesTTS provider name
preview_urltextyesURL to a voice sample
definitionjsonbyesFull voice definition from Ultravox
last_synced_attimestamptznow()noLast sync timestamp

Constraints:

ConstraintTypeDetails
ultravox_voices_pkeyPrimary keyid

Indexes:

IndexColumns
idx_ultravox_voices_namename
idx_ultravox_voices_primary_languageprimary_language
idx_ultravox_voices_providerprovider
idx_ultravox_voices_ownershipownership

Related edge functions: voices-list, voices-sync