AI companion for dementia patients in Sri Lanka. Ama speaks with patients using their memory book; caregivers receive session summaries after each call.
Terminal 1 — Python voice agent (LiveKit + Beyond Presence):
cd livekit-bey-agent
cp .env.example .env
# Fill in LIVEKIT_*, GOOGLE_API_KEY, GOOGLE_APPLICATION_CREDENTIALS, BEY_*
uv run agent.py devTerminal 2 — Next.js frontend:
npm install
cp .env.local.example .env.local
# Fill in LIVEKIT_* (same project as agent)
npm run devOpen http://localhost:3000.
In LiveKit Cloud → Agents → Dispatch rules:
| Field | Value |
|---|---|
| Rule type | Individual |
| Room prefix | recall-room |
| Agent | ama |
| Variable | Purpose |
|---|---|
LIVEKIT_URL |
Server-side LiveKit URL (wss://...) |
LIVEKIT_API_KEY |
API key |
LIVEKIT_API_SECRET |
API secret |
NEXT_PUBLIC_LIVEKIT_URL |
Client connect URL (usually same as LIVEKIT_URL) |
SESSION_WEBHOOK_SECRET |
Bearer token for POST /api/sessions/end (same as agent .env) |
USE_SUPABASE |
false = in-memory sessions (no DB). Auto-on if Supabase URL + service role key are set |
- Set
USE_SUPABASE=falsein.env.local(or leave out Supabase keys). - Set
SESSION_WEBHOOK_SECRETand the same secret inlivekit-bey-agent/.env. - Set
RECALL_APP_URL=http://localhost:3000in the agent.env. - Start Next.js + agent as usual. Transcripts persist until you restart
npm run dev.
For production persistence, use Supabase: run supabase/migrations/001_sessions.sql, set USE_SUPABASE=true, and add NEXT_PUBLIC_SUPABASE_URL + SUPABASE_SERVICE_ROLE_KEY.
See livekit-bey-agent/.env.example. Do not wrap values in quotes.
| Route | Description |
|---|---|
/ |
Marketing landing page |
/patient |
Patient home |
/patient/start |
Handoff — memory chips, begin session |
/patient/loading |
Token fetch + agent dispatch |
/patient/call |
LiveKit call with Ama avatar |
/caregiver |
Caregiver dashboard |
/caregiver/summary |
Session end + WhatsApp preview |
Caregiver Start session with Thatha → /patient/start → Begin session → /patient/loading (POST /api/livekit/token) → /patient/call (LiveKit room) → end call → /caregiver/summary.
| Component | Platform | Command |
|---|---|---|
| Frontend | Netlify | npm run build |
| Agent | Railway | uv run agent.py start in livekit-bey-agent/ |
See project_overview.md for WhatsApp/webhook APIs (not yet wired). The voice stack uses Google STT + Gemini LLM/TTS + Beyond Presence (see livekit-bey-agent/).