MYLO Sessions
Create a realtime Nepali voice-agent session and stream audio over WebSocket for support and sales calls.
POST https://api.sagea.space/mylo/sessions
Each session returns a websocket_url for bidirectional audio plus an expiry your client must refresh or close.
Authentication
Send Authorization: Bearer $SAGEA_API_KEY on every request. Get a key
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | Agent identifier such as support_np for Nepali support |
model | string | No | Conversation model, use sage-2-5-celer for lowest latency |
voice | string | No | Voice preset nova, atlas, or a custom voice_id |
language | string | No | BCP-47 code, defaults to ne-NP in this example |
system_prompt | string | No | Behavior prompt including the Nepali greeting to speak first |
tools | array | No | Function tools the agent may call during the session |
expires_in | integer | No | Session TTL in seconds, defaults to 3600 when omitted |
Use support_np with ne-NP for Kathmandu customers and switch voices per use case without changing agent logic.
Set system_prompt to define greeting, tone, escalation rules, and when to switch between Nepali and English.
Pass order, booking, or NPR billing tools so the agent can act instead of only answering questions.
End a session when the conversation finishes:
Connect to websocket_url for PCM audio in and out, with turn events and tool calls over the same socket.
Response
A successful create returns 201 with the session handle, stream URL, and TTL.
The agent speaks first with नमस्ते when your system_prompt requests a Nepali greeting.
Refresh or reconnect before expires_in elapses to keep long support calls alive.
Errors
| Status | Code | Fix |
|---|---|---|
| 422 | voice_not_found | Use nova, atlas, or a valid custom voice_id |
| 404 | session_not_found | Check the session ID or create a new session |
| 401 | unauthorized | Verify SAGEA_API_KEY and header formatting |
| 429 | rate_limit_exceeded | Retry with backoff and reuse sessions where possible |
Limits
100 concurrent sessions per key, 3600 second default TTL, one WebSocket stream per session.
