Skip to content

Voice agent sync

The AI agent we host in our database is mirrored to ElevenLabs ConvAI for voice calls. ElevenLabs has its own agent record that holds the prompt, tools, voice settings; if we change ours without explicitly pushing, the phone version goes stale.

When sync fires

Sync is explicit, not automatic. Triggered by:

  • POST /v1/admin/voice-agents/resync — pushes prompt + tools + voice config from our DB to ElevenLabs.
  • Setup → Brand Voice screen save (frontend calls the resync endpoint after persisting changes).
  • Channel-edit save (when voice-related fields change).

What gets pushed

  • Prompt — assembled from Agent.prompt_who_you_are, prompt_what_you_can_do, prompt_language_instruction, plus the hardcoded ESCALATION + collect_name + tool instructions (prompt-assembly.service.ts).
  • Tools — the JSON-schema definitions for kb_retrieve, check_availability, create_booking, create_customer, cancel_appointment, forward_to_admin.
  • Voicevoice_id, voice_language (set per channel).
  • Webhook URL — the call event sink, includes the tenant_id and channel_id as query params.

Gotchas

  • If you change prompt fields in the database without calling resync, the chat channel (USE_BACKEND_AI=true) picks up the change on the next message, but the voice channel keeps using the stale ElevenLabs copy.
  • ElevenLabs has rate limits — don't loop the resync.
  • See backend/src/services/voice-agent-sync.service.ts for the actual diff/push logic.

Twinlix platform documentation.