CookbooksMYLO Cookbooks
Run Your First MYLO Agent Session
Create a real-time MYLO voice session with the nova voice and hear it speak in seconds.
- Create a session with
agent_id,model,voice, andlanguage - Stream 16kHz PCM audio over WebSocket with ~200ms first byte
- End the session and fetch the speaker timestamped transcript Time to complete: ~10 minutes
Prerequisites
SAGEA_API_KEYexported in your shell asBearerauth- Python 3.10+ with
requestsandwebsocket-clientinstalled - Basic familiarity with REST APIs and WebSockets
- Complete Send your first API request
- Read the MYLO overview import from '@/components/Tabs';
Step 1: Create a session
Create a session with support_np, sage-2-5-celer, nova, and ne-NP.
Save session_id and websocket_url. Sessions expire in 3600 seconds.
Step 2: Connect and speak your first line
Connect to websocket_url, stream 16kHz PCM in, and receive speech out.
Speak once, then keep the socket open until the agent reply finishes.
Step 3: Read the transcript and end the session
Fetch turns with speaker, text, and timestamps, then delete the session.
Always fetch the transcript before delete so you keep the record.
Verify
| Error | Cause | Fix |
|---|---|---|
401 Unauthorized | Missing or invalid API key | Export valid SAGEA_API_KEY and retry |
404 session_not_found | Wrong or expired session_id | Create a new session, check spelling |
429 rate_limit_exceeded | Too many session creates | Back off and retry with jitter |
422 voice_not_found | Unknown voice name | Use nova or atlas, check spelling |
