{"id":9081,"library":"livekit-plugins-assemblyai","title":"LiveKit AssemblyAI Plugin","description":"LiveKit AssemblyAI Plugin is an Agent Framework plugin for integrating AssemblyAI's Speech-to-Text (STT) capabilities into LiveKit AI Agents. It enables real-time transcription for conversational AI applications. The library is actively maintained with frequent releases, often in sync with the core `livekit-agents` library, and is currently at version 1.5.4.","status":"active","version":"1.5.4","language":"en","source_language":"en","source_url":"https://github.com/livekit/agents/tree/main/livekit-plugins-assemblyai","tags":["AI","audio","livekit","realtime","voice","STT","AssemblyAI","plugin","agents"],"install":[{"cmd":"pip install \"livekit-agents[assemblyai]~=1.5\"","lang":"bash","label":"Recommended installation with LiveKit Agents core"},{"cmd":"pip install livekit-plugins-assemblyai","lang":"bash","label":"Install only the plugin"}],"dependencies":[{"reason":"This is a plugin for the LiveKit Agents framework, and requires it for core agent functionality.","package":"livekit-agents"}],"imports":[{"symbol":"STT","correct":"from livekit.plugins import assemblyai"},{"note":"Required for integrating AssemblyAI STT into a LiveKit Agent.","symbol":"AgentSession","correct":"from livekit.agents import AgentSession"}],"quickstart":{"code":"import os\nfrom livekit.agents import AgentSession, JobContext\nfrom livekit.plugins import assemblyai\nfrom livekit.agents.voice import VoiceAgent\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\nclass MyAssemblyAIAgent(VoiceAgent):\n    def __init__(self, ctx: JobContext):\n        super().__init__(ctx)\n        self.stt = assemblyai.STT(\n            api_key=os.environ.get('ASSEMBLYAI_API_KEY', '')\n        )\n\n    async def start(self):\n        # Example: Using AssemblyAI STT directly (not in a full agent pipeline)\n        # For a full agent, you'd pass self.stt to AgentSession's stt parameter.\n        print(\"AssemblyAI STT initialized. API Key status: \", \"Set\" if self.stt.api_key else \"Not Set\")\n\nif __name__ == \"__main__\":\n    # In a real application, you'd run the agent via LiveKit's infrastructure.\n    # This is a minimal example to show STT initialization.\n    if not os.environ.get('ASSEMBLYAI_API_KEY'):\n        print(\"Warning: ASSEMBLYAI_API_KEY environment variable is not set. STT may fail.\")\n    # You can instantiate the STT directly for testing or use it within a full AgentSession\n    my_stt_instance = assemblyai.STT(api_key=os.environ.get('ASSEMBLYAI_API_KEY', ''))\n    print(f\"AssemblyAI STT configured with API key: {'Yes' if my_stt_instance.api_key else 'No'}\")","lang":"python","description":"This quickstart demonstrates how to initialize the AssemblyAI STT plugin. It requires the `ASSEMBLYAI_API_KEY` environment variable to be set. For a complete voice agent, the `assemblyai.STT` instance would be passed to the `AgentSession` constructor."},"warnings":[{"fix":"Migrate `AgentSession` turn-handling parameters to use the `turn_handling` dictionary with `TurnHandlingOptions`. Example: `session = AgentSession(turn_handling={'endpointing': {'min_delay': 0.5}})`.","message":"LiveKit Agents 1.5.0 deprecated several keyword arguments for turn handling, such as `min_endpointing_delay` and `allow_interruptions`. These are now consolidated into a `TurnHandlingOptions` dictionary. Using old kwargs will still work but will emit deprecation warnings and will be removed in a future v2.0 release.","severity":"breaking","affected_versions":">=1.5.0 of livekit-agents"},{"fix":"If `turn_detection=\"stt\"` is set, explicitly configure `max_turn_silence=1000` within `TurnHandlingOptions` to restore the original AssemblyAI behavior. Example: `turn_handling={'turn_detection': 'stt', 'endpointing': {'max_turn_silence': 1000}}`.","message":"When using AssemblyAI's native turn detection (`turn_detection=\"stt\"`) in LiveKit Agents, the `max_turn_silence` default value differs from AssemblyAI's API. The LiveKit plugin defaults to `max_turn_silence=100`, while the AssemblyAI API's default is `max_turn_silence=1000`. This can lead to shorter turn durations than expected.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To disable preemptive generation and return to previous behavior, initialize `AgentSession` with `preemptive_generation=False`: `session = AgentSession(preemptive_generation=False)`.","message":"Preemptive generation is enabled by default in LiveKit Agents 1.5.0 and newer. This starts LLM and TTS inference before a user's turn fully completes, reducing latency but potentially changing agent conversational flow.","severity":"gotcha","affected_versions":">=1.5.0 of livekit-agents"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Set the `ASSEMBLYAI_API_KEY` environment variable in your shell or a `.env` file that is loaded by your application. Ensure `python-dotenv` is installed if using `.env` files. `export ASSEMBLYAI_API_KEY='your_key_here'`","cause":"The AssemblyAI STT plugin requires an API key for authentication, which is typically read from the `ASSEMBLYAI_API_KEY` environment variable.","error":"ValueError: ASSEMBLYAI_API_KEY not set"},{"fix":"Update your `AgentSession` initialization to use the `turn_handling` dictionary. For example, instead of `AgentSession(min_endpointing_delay=0.5)`, use `AgentSession(turn_handling={'endpointing': {'min_delay': 0.5}})`.","cause":"In `livekit-agents` v1.5.0, turn handling parameters like `min_endpointing_delay` were deprecated and moved into a consolidated `TurnHandlingOptions` dictionary passed via the `turn_handling` argument.","error":"TypeError: AgentSession() got an unexpected keyword argument 'min_endpointing_delay'"}]}