numerous-planet-40727
10/14/2025, 8:46 PMtall-airline-16756
10/14/2025, 8:46 PMtall-airline-16756
10/14/2025, 8:47 PMinterrupted: true flag on the ChatMessage object and truncates the message to show exactly what was said before the interruption.
Here’s a friendly step-by-step to help you customize this:
1. Keep an eye on conversation events or use helpful hooks like on_user_turn_completed.
2. Check if the message carries the interrupted: true flag.
3. If it does, simply add your preferred marker (like "...") to the message content.
4. Make sure the updated message is nicely inserted back into the chat context.
By following this approach, you can beautifully tailor how interrupted messages look while keeping the content accurate. If you have any questions along the way, I’m here to help!
Sources: livekit-agents/livekit/agents/voice/agent_activity.py | Pipeline nodes and hooks | LiveKit Docs | agents/src/voice/agent_activity.tsnumerous-planet-40727
10/14/2025, 8:49 PMtall-airline-16756
10/14/2025, 8:50 PMon_user_turn_completed callback is designed specifically for the human (user) side and doesn’t apply to the agent. It gets triggered right when the user's turn wraps up, just before the agent starts crafting its response.
If you're looking to keep an eye on when the agent finishes speaking or generating a reply, you might want to explore other options like state change events or setting up some custom instrumentation within different lifecycle methods. I hope this helps you move forward smoothly!
Sources: Pipeline nodes and hooks | LiveKit Docs | External data and RAG | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py | Logs, metrics, and telemetry | LiveKit Docsnumerous-planet-40727
10/14/2025, 9:09 PMtall-airline-16756
10/14/2025, 9:10 PMturn_ctx parameter in on_user_turn_completed is actually a mutable copy of the full ChatContext up to, but not including, your latest message. This means you can tweak the chat history or context before the agent crafts its response, which is pretty handy.
Once the callback finishes, your latest message gets added to this context, and then the agent generates its reply based on the updated information. Just a heads-up: any changes you make to turn_ctx only affect the current response and won’t stick around unless you decide to manage that explicitly. I hope this helps clarify things!
Sources: Pipeline nodes and hooks | LiveKit Docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti... | agents/src/voice/agent_activity.ts | External data and RAG | LiveKit Docsnumerous-planet-40727
10/14/2025, 10:15 PMon_user_turn_completed it'd be the user's message, not the agent's (and so would never be interrupted)tall-airline-16756
10/14/2025, 10:17 PMinterrupted: true and shortened to include only the part spoken before the interruption. This is managed by the framework to keep the conversation context clear and accurate.
If you'd like to tailor this behavior to better fit your needs, here are some options you can explore:
1. You can control interruption permissions for each message using options like allow_interruptions.
2. It’s possible to modify message content during processing callbacks, such as onUserTurnCompleted, though this mainly applies to user messages rather than agent messages.
3. Session-level configuration parameters are available to adjust how interruptions behave overall.
4. You can also trigger interruptions programmatically using the interrupt() method.
While directly editing interrupted agent messages once they’re part of the chat context isn’t supported, you do have some flexibility to influence interruption handling and customize the chat context during processing. If you’d like, I’m here to help you implement any specific customization you have in mind—just let me know!
Sources: agents/src/voice/agent_activity.ts | livekit-agents/livekit/agents/voice/speech_handle.py | Turn detection and interruptions | LiveKit Docs | Agent Session & Activity Management | livekit/livekit_composite | DeepWiki