nutritious-solstice-434
09/16/2025, 5:27 PMtall-airline-16756
09/16/2025, 5:27 PMtall-airline-16756
09/16/2025, 5:27 PMtall-airline-16756
09/16/2025, 6:03 PMnutritious-solstice-434
09/16/2025, 8:09 PMtall-airline-16756
09/16/2025, 8:10 PMon_user_turn_completed Node: This node is really helpful because it lets you modify the user's message or add extra context (like tool outputs) right before the LLM crafts a response.
2. Call `update_chat_ctx()`: To make sure the injected context sticks around beyond the current turn, don’t forget to explicitly call update_chat_ctx() after you add the tool outputs.
3. Check Context Injection: Double-check that you’re adding the tool outputs to the turn_ctx in the right way. Here’s a quick example:
async def on_user_turn_completed(self, turn_ctx, new_message):
tool_output = await my_tool_function(new_message.text_content())
turn_ctx.add_message(role="assistant", content=f"Tool result: {tool_output}")
await self.update_chat_ctx(turn_ctx)
1. Verify Realtime Model Requirements: If you’re working with a realtime model like Gemini Live, just make sure the last message in the context comes from the user—that’s essential for generating a response.
2. Monitor Logs: Keep an eye on your logs for any errors or warnings that might give clues about why the tool outputs aren’t being processed.
If any part of this feels unclear or if you’d like a hand implementing these steps, please don’t hesitate to reach out. I’m here to support you!
Sources: Docs::Agents | Pipeline nodes and hooks | LiveKit Docs | tests/test_agent_session.py