- Monitor voice agent conversations in real-time
- Trace STT and TTS operations with automatic span capture
- Link multiple operations under a single trace for end-to-end visibility
- Debug and optimize your voice AI applications
Requirements
Environment Variables
Set up the following environment variables in your.env file:
Initialize Logger and Instrument ElevenLabs
Always call
instrument_elevenlabs(logger) before creating the ElevenLabs client to ensure all operations are traced.Text-to-Speech (TTS)
Convert text to natural-sounding speech with automatic tracing.- Input text
- Voice ID and model used
- Output audio metadata
- Latency metrics
Speech-to-Text (STT)
Transcribe audio to text with automatic tracing.- Input audio attachment
- Model used for transcription
- Output transcript text
- Processing time
Linking Operations with Trace ID
Link multiple STT, TTS, or LLM operations under a single trace using thex-maxim-trace-id header.
Combining with LLM Calls
Build a complete voice pipeline by combining ElevenLabs STT/TTS with an LLM for processing.What Gets Traced
Debug Mode
Enable debug mode for detailed logging during development:Cleanup
Always calllogger.cleanup() before your application exits to ensure all traces are flushed:
What gets logged to Maxim
- Text-to-Speech: Input text, voice ID, model ID, output format, audio metadata, latency
- Speech-to-Text: Input audio attachment, model ID, output transcript, processing time
- Linked Operations: All operations under same trace ID with parent-child relationships
Resources
Full Pipeline Cookbook
Complete STT-LLM-TTS pipeline tutorial with detailed walkthrough
ElevenLabs Docs
Official ElevenLabs documentation