SAGEA LogoDocs & API

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

ParameterTypeRequiredDescription
agent_idstringYesAgent identifier such as support_np for Nepali support
modelstringNoConversation model, use sage-2-5-celer for lowest latency
voicestringNoVoice preset nova, atlas, or a custom voice_id
languagestringNoBCP-47 code, defaults to ne-NP in this example
system_promptstringNoBehavior prompt including the Nepali greeting to speak first
toolsarrayNoFunction tools the agent may call during the session
expires_inintegerNoSession 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.

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 a Kathmandu support agent. Greet with नमस्ते, then help in Nepali.",
    "tools": []
  }'

End a session when the conversation finishes:

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

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.

{
  "session_id": "mylo_ses_9dK4pQ2mX7aB",
  "websocket_url": "wss://api.sagea.space/mylo/sessions/mylo_ses_9dK4pQ2mX7aB/stream",
  "expires_in": 3600,
  "agent_id": "support_np",
  "model": "sage-2-5-celer",
  "voice": "nova",
  "language": "ne-NP"
}

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

StatusCodeFix
422voice_not_foundUse nova, atlas, or a valid custom voice_id
404session_not_foundCheck the session ID or create a new session
401unauthorizedVerify SAGEA_API_KEY and header formatting
429rate_limit_exceededRetry with backoff and reuse sessions where possible

Limits

100 concurrent sessions per key, 3600 second default TTL, one WebSocket stream per session.

What's next

On this page