steep-balloon-41261
12/14/2025, 2:15 PMtall-airline-16756
12/14/2025, 2:15 PMtall-airline-16756
12/14/2025, 2:15 PMuser_started_speaking event) won't fire unless you change the setup.
What to do next (short checklist):
1. Update your event handling
◦ Listen for user_state_changed (states: speaking, listening, away) instead of user_started_speaking.
1. Disable the model's automatic activity detection
◦ Set the realtime model config to disable automatic activity detection so LiveKit can control turn detection.
1. Enable local VAD / turn detection and STT plugin
◦ Add a VAD plugin (e.g., Silero) and an STT plugin (e.g., AssemblyAI) or a custom turn detector so user_away_timeout and state transitions work.
1. Keep user_away_timeout set (e.g., 15s) in AgentSession — it will take effect once VAD/turn detection is active.
Example (illustrative):
session = AgentSession(
turn_detection=turn_detector.MultilingualModel(),
vad=silero.VAD.load(),
stt="assemblyai/universal-streaming",
llm=google.realtime.RealtimeModel(
realtime_input_config=types.RealtimeInputConfig(
automatic_activity_detection=types.AutomaticActivityDetection(disabled=True),
),
input_audio_transcription=None,
),
user_away_timeout=15.0,
)
If you’d like, share your current AgentSession config (redact secrets) and the event listener code — I can point out the exact changes you need.
Sources: Agent session | LiveKit docs | Agents v0.x migration guide - Python | LiveKit docs | Agents v0.x migration guide - Node.js | LiveKit Docs | Events and error handling | LiveKit docs | Gemini Live API plugin | LiveKit docstall-airline-16756
12/14/2025, 2:23 PMautomatic_activity_detection in your RealtimeInputConfig, which is the right first step.
Next steps to restore user_away_timeout and user state events:
1. Listen for user_state_changed (states: speaking, listening, away) instead of user_started_speaking.
2. Ensure LiveKit handles VAD/turn detection by adding:
◦ a VAD plugin (e.g., Silero) via vad=...
◦ a turn detector (e.g., turn_detection=turn_detector.MultilingualModel())
◦ an STT plugin (e.g., stt="assemblyai/universal-streaming") or set input_audio_transcription appropriately
1. Keep user_away_timeout set in your AgentSession (e.g., 15.0).
Example placement (illustrative):
session = AgentSession(
turn_detection=turn_detector.MultilingualModel(),
vad=silero.VAD.load(),
stt="assemblyai/universal-streaming",
llm=<your google.beta.realtime.RealtimeModel(...)>,
user_away_timeout=15.0,
)
If you share your AgentSession initialization (redact keys) and the event-listener code you use, I’ll point out exactly what to add or adjust.tall-airline-16756
12/14/2025, 3:28 PMAudioStream.aclose() checks self._processor even when it was never created, causing the AttributeError.
What you can do right now (short, safe fixes):
1. Prefer the factory that ensures initialization:
from livekit.rtc import AudioStream
stream = AudioStream.from_track(track, noise_cancellation=None)
1. If you must use the constructor or need a quick workaround, ensure the attribute exists:
stream = AudioStream(track)
if not hasattr(stream, "_processor"):
stream._processor = None
1. Verify plugin/version compatibility:
• Make sure livekit and any livekit-plugins-* packages are matched (same release family).
If you want, paste the small snippet where you create the AudioStream (redact secrets) and the exact package versions (pip show livekit and pip show livekit-plugins-*) and I’ll point out the specific change to make.
Sources: Capturing the First Few Seconds of a Call for Processing | Enhanced noise cancellation | LiveKit docstall-airline-16756
12/14/2025, 3:30 PMAudioStream.from_track(...) (preferred) or ensure _processor exists
• Replace any AudioStream(track) with:
from livekit.rtc import AudioStream
stream = AudioStream.from_track(track, noise_cancellation=None)
or, as a quick workaround after construction:
if not hasattr(stream, "_processor"):
stream._processor = None
2) Upgrade LiveKit if possible
• Your livekit is 1.0.21 and livekit-plugins-noise-cancellation is 0.2.5. This AttributeError is caused by _processor not being initialized in some code paths and is fixed in later releases. Please try upgrading livekit and related plugins to the latest 1.2.x/1.3.x family so the AudioStream initialization bug is resolved and package families match.
3) Tell me:
• Which code you use to create the AudioStream (paste the snippet, redact secrets).
• Confirm whether you create it via from_track or the constructor and whether you pass any noise_cancellation plugin.
I’ll point out the exact change to make and verify compatibility with your installed plugin versions.tall-airline-16756
12/14/2025, 3:33 PMAudioStream is trying to access self._processor during internal teardown but that attribute wasn't initialized in your SDK version, which raises the AttributeError. The reliable fixes are:
1) Upgrade LiveKit packages so AudioStream initializes _processor correctly:
• Run:
pip install --upgrade livekit livekit-agents livekit-plugins-noise-cancellation \
livekit-plugins-silero livekit-plugins-google livekit-plugins-turn-detector
• Aim to move from `1.0.21`/`0.2.5` to the matching 1.2.x / 1.3.x family for livekit + related plugins so package families are aligned.
2) Restart your service after upgrading.
If you cannot upgrade immediately, apply this server-side workaround to avoid the crash (patch where the AudioStream object is created internally):
• Add a defensive attribute initialization after the AudioStream is constructed:
# after stream is created internally
if not hasattr(stream, "_processor"):
stream._processor = None
You said the code is internal — if you cannot change where it's created, upgrading packages is the recommended path.
Also, for the original realtime-model issue (so user states and user_away_timeout work):
• Disable the model's automatic activity detection in your RealtimeInputConfig.
• Enable LiveKit VAD/turn detection by adding a VAD plugin (Silero), a turn detector, and an STT plugin (e.g., AssemblyAI).
• Listen for user_state_changed (states: speaking, listening, away) instead of user_started_speaking.
Next steps for me to help:
• Confirm you can upgrade now and restart the service. If yes, I’ll guide exact version targets if you want.
• If upgrade isn’t possible, tell me where you can inject the small _processor initialization (or paste the service/agent startup snippet, redacting secrets) and I’ll point exactly where to add it. Sources: Resolving &#34;InvalidState - failed to capture frame&#34; errors in AudioSource | Agents (Python) | livekit/livekit_composite | DeepWiki | Job lifecycle | LiveKit docs | Capturing the First Few Seconds of a Call for Processingtall-airline-16756
12/14/2025, 3:39 PMpip show livekit
pip show livekit-agents
pip show livekit-plugins-noise-cancellation
Paste their Version values (redact nothing else). I need to confirm they actually upgraded to the 1.2/1.3 family.
2) If upgrade is possible, run this exact upgrade command and then restart your service:
pip install --upgrade "livekit>=1.2.0" "livekit-agents>=1.3.0" "livekit-plugins-noise-cancellation>=1.3.0" "livekit-plugins-silero>=1.3.0"
Then restart and re-check the trace. Tell me results.
3) If you cannot upgrade now, add a defensive patch at runtime (no source edit required) — run this early in your process before agents start:
import livekit.rtc.audio_stream as _as
if not hasattr(_as.AudioStream, "_processor"):
# ensure instances created later have the attribute
_as.AudioStream._processor = None
Add that near your app startup (before LiveKit creates streams). Try this and report whether the traceback stops.
4) If the error persists after upgrade or the patch:
• Paste the exact versions from step (1).
• Paste your AgentSession creation snippet (redact keys) or the small startup code that initializes agents so I can spot where AudioStream is created.
Pick one path: confirm current versions, or try the runtime patch and tell me results — I’ll follow up with the next precise step.rich-keyboard-96538
12/15/2025, 7:45 AMtall-airline-16756
12/15/2025, 7:45 AMallow_interruptions in AgentSession is ignored in that mode.
If you’re using a non-realtime setup (VAD/STT-based turn detection), you can disable interruptions by setting allow_interruptions=False on the AgentSession.
If you need finer control with a realtime model, consider disabling the model’s automatic activity detection and using LiveKit’s VAD/turn-detection stack (Silero + STT/turn detector). That lets LiveKit control interruptions and respects allow_interruptions. Would you like steps for switching to that setup or help checking your current configuration?
Sources: Turn detection and interruptions | LiveKit Docs | Agents (Node.js) | livekit/livekit_composite | DeepWiki