SAGEA LogoDocs & API
CookbooksMYLO Cookbooks

Build a Multilingual Support Agent

Serve Nepali and English callers in one MYLO session with auto language detection.

  • Start sessions in ne-NP and en-US with the same agent logic
  • Auto detect caller language and reply in kind
  • Look up orders live with a function tool schema Time to complete: ~20 minutes

Prerequisites

  • SAGEA_API_KEY exported in your shell as Bearer auth
  • Python 3.10+ with requests and websocket-client installed
  • A mock order database or API for the lookup tool
  • Complete Send your first API request
  • Read the MYLO overview import from '@/components/Tabs';

Step 1: Create a Nepali-first session

Create the agent in ne-NP with English fallback so greetings feel native.

curl -X POST https://api.sagea.space/mylo/sessions \
  -H "Authorization: Bearer $SAGEA_API_KEY" -H "Content-Type: application/json" \
  -d '{"agent_id":"support_np","model":"sage-2-5-celer","voice":"nova","language":"ne-NP","system_prompt":"You are bilingual. Detect Nepali or English and reply in caller language."}'

Audio streams as 16kHz PCM in and speech out with ~200ms first byte.

Step 2: Add order lookup tool

Attach fetch_order_status so the agent resolves order questions in either language.

curl -X POST https://api.sagea.space/mylo/sessions \
  -H "Authorization: Bearer $SAGEA_API_KEY" -H "Content-Type: application/json" \
  -d '{"agent_id":"support_np","model":"sage-2-5-celer","voice":"nova","language":"ne-NP","system_prompt":"Detect language, use tools.","tools":[{"name":"fetch_order_status"}]}'

Return status, ETA, and location from the tool so voice replies stay short.

Step 3: Test both languages and review transcript

Open en-US and ne-NP sessions, speak one turn each, then compare.

SESSION_ID="mylo_ses_REPLACE_ME"
curl https://api.sagea.space/mylo/sessions/$SESSION_ID/transcript \
  -H "Authorization: Bearer $SAGEA_API_KEY"
curl -X DELETE https://api.sagea.space/mylo/sessions/$SESSION_ID \
  -H "Authorization: Bearer $SAGEA_API_KEY"

Confirm the agent mirrors the caller language within the first two turns.

Verify

ErrorCauseFix
401 UnauthorizedMissing or invalid API keyExport valid SAGEA_API_KEY and retry
404 session_not_foundSession ID mixed across languagesTrack NP and EN IDs separately
429 rate_limit_exceededParallel language tests throttledSerialize tests, add retry with backoff
422 voice_not_foundVoice unavailable for languageUse nova or atlas, verify pairing

What's next

On this page