Streaming Kokoro TTS for AI agents on SageMaker AI
- AWS demonstrates sending each completed agent sentence to Kokoro-82M on a SageMaker AI endpoint, so speech synthesis can begin before the full reply is ready.
- The example exposes both a single-request route and a bidirectional streaming route, which can carry multiple messages on one persistent session.
- Putting audio in base64-encoded SSE events adds about 33% to the payload, and clients must buffer data because transport chunks may split MP3 frames.
- In tests, sending the first sentence separately reduced mean time to first audio byte for the TTS transport by 52.4%; the end-to-end bidi setup also outperformed its batch baseline.
Our take
For teams with an established SSE frontend, base64 is a practical way to add voice without replacing that path, but it requires payload overhead and frame reassembly. A binary bidirectional path avoids those costs between the agent and model, while AgentCore's JSON-serializable output requirement still means base64 is needed on the return leg.
Sources
- Stream low-latency speech from AI agents using Kokoro TTS on Amazon SageMaker AI · AWS Machine Learning
The summary and analysis were generated by AI. The original sources are authoritative. AI content policy