Skip to main content

Knowledge > Runbooks > Voice Ops > Deploy Voice Agent Code Changes

Deploy Voice Agent Code Changes

Deploy updated voice agent code to Railway. This runbook covers the full deploy cycle: branch, code, test, deploy, verify.

Prerequisites

  • Write access to churchwiseai-web git repository
  • Railway CLI (optional) or Railway dashboard access for log monitoring
  • No active concurrent voice agent deployments in progress

Critical Warnings

  • One agent serves all churches. A bad deploy affects every church simultaneously.
  • Deploy via LiveKit CLI. Run C:\dev\lk.exe agent deploy --project cwa-voice --silent. No git push, no Railway, no Cartesia CLI needed.

Steps

  1. Create a feature branch from main

    cd /mnt/c/dev/churchwiseai-web
    git checkout main
    git pull origin main
    git checkout -b feat/voice-[short-description]
  2. Make your changes in churchwiseai-web/voice-agent-livekit/

    Key files:

    • main.py — entry point and call routing (reads sip.trunkPhoneNumber)
    • session.py — Supabase client, phone registry, caching
    • turn_processor.py — moderation, noise filtering
    • verticals/church/agents.py — Coordinator + Care agent builders
    • verticals/church/prompts.py — per-church prompt templates
    • verticals/church/tools.py — prayer, callbacks, visitor capture
    • core/ — shared utilities and RAG
  3. Test locally if possible (limited — LiveKit runtime is not available locally, but Python syntax and import errors can be caught):

    cd /mnt/c/dev/churchwiseai-web/voice-agent-livekit
    python -m py_compile main.py session.py turn_processor.py
    python -m py_compile verticals/church/agents.py verticals/church/tools.py
  4. Commit your changes

    git add voice-agent-livekit/
    git commit -m "feat(voice): [description of change]"
  5. Push to main — Railway auto-deploys

    cd /mnt/c/dev/churchwiseai-web
    git push origin main

    Wait ~2 minutes for Railway to build and deploy the Python service. LiveKit Cloud connects automatically once the worker is running — no additional step needed.

  6. Place a test call to the demo church number (or any active church number) immediately after deploy.

  7. Verify the call log shows a successful post-deploy call:

    SELECT id, created_at, call_outcome, duration_seconds, error_message
    FROM voice_call_logs
    ORDER BY created_at DESC
    LIMIT 3;
  8. Merge to main after successful verification (if working on a feature branch):

    git checkout main
    git pull origin main
    git merge feat/voice-[short-description]
    git push origin main

    Railway will auto-deploy again from the merge push. LiveKit Cloud connects automatically.

Verification

  • Railway build completes successfully (check Railway dashboard or railway logs).
  • LiveKit Cloud shows the agent worker as connected (check LiveKit Cloud dashboard for project cwa-voice-9x077mph).
  • Test call is answered with correct greeting and normal agent behavior.
  • No error_message in the latest voice_call_logs row.

Rollback

To rollback, revert the code change in git and push to main (Railway auto-deploys):

  1. Revert the code change in git:
    git revert HEAD
    git push origin main
  2. Wait ~2 minutes for Railway to build. LiveKit Cloud connects automatically once the service is running.
  3. Verify calls are routing correctly again.

See Also