rhythmic-gold-33085
03/11/2026, 12:07 PMtall-airline-16756
03/11/2026, 12:07 PMtall-airline-16756
03/11/2026, 12:08 PMMyRealtimeModel, MyRealtimePlugin).
• Key capabilities to implement:
◦ Accept streaming audio input from LiveKit (convert or forward frames as required).
◦ Send audio to your realtime API (likely over WebSocket or streaming gRPC) and stream back responses.
◦ Support sending/receiving text if your API produces transcriptions or text responses.
◦ Provide configuration for voice/model parameters, authentication, and modalities (audio, text).
• Use asynchronous streaming (async generators or similar) so the agent framework can read/write audio/text frames incrementally.
1. Integrate with AgentSession
• Pass your plugin instance into the AgentSession where the LLM/realtime model is expected:
◦ Example (conceptual): create AgentSession(llm=my_realtime_model_instance, ...).
• Ensure the session can route audio from LiveKit participants into your plugin and play returned audio back into the LiveKit room.
1. Handle turn detection and modalities
• If your realtime API handles turn detection, surface that behavior in your plugin.
• If turn detection isn’t provided by your API, you can integrate LiveKit’s VAD/turn detection or configure STT-based turn cues.
• Support both text-only and audio+text modes if useful (allow falling back to separate TTS/STT if the realtime API is audio-only or text-only).
1. Authentication & configuration
• Require users to provide API keys or credentials via environment variables or configuration objects.
• Expose configurable parameters (voice name, model id, sample rate, chunk size, latency/tls settings).
1. Testing
• Create automated tests using LiveKit’s testing patterns:
◦ Test text-only flows for quick unit tests.
◦ Test streaming audio flows end-to-end with a test room or test harness that simulates audio frames.
• Validate latency, audio quality, and that transcriptions (if any) remain time-aligned.
1. Documentation & packaging
• Document installation, configuration, example usage, and supported modalities.
• Publish the plugin (PyPI / npm) or provide install instructions for consumers.
• Include example code showing how to instantiate the plugin and start an AgentSession.
1. Optional: contribute or share
• If you want to share with the community, follow LiveKit’s plugin contribution guidance for the Agents project and include examples and tests.
If you’d like, I can help next with any of the following:
• A short Python or Node template for a realtime plugin that wires a WebSocket-based API into an AgentSession.
• Example configuration and environment variable naming suggestions.
• Guidance on testing streaming audio locally (what frames to send, simulating a LiveKit participant).
Which would you like me to provide next — a code template in Python or Node, or help designing the authentication/config schema for your plugin?
Sources: Realtime models overview | LiveKit Documentation | OpenAI and LiveKit partner to turn Advanced Voice into an API | Google AI and LiveKit | LiveKit Documentation | OpenAI Realtime API plugin guide | LiveKit Documentation | xAI Grok Voice Agent API plugin | LiveKit Documentation