billions-lawyer-8588
08/12/2025, 5:33 PMtall-airline-16756
08/12/2025, 5:33 PMtall-airline-16756
08/12/2025, 5:34 PMpublish_dtmf
method to send DTMF codes and publish_data
to log these actions right in the chat context. This way, all those DTMF codes get nicely recorded in the conversation history.
await room.local_participant.publish_dtmf(code=code, digit=str(code))
await room.local_participant.publish_data(f"{code}", topic="dtmf_code")
2. Log Tool Execution: Whenever tools run, their outputs get added to the chat context. For example, DTMF codes sent by the agent show up as function calls along with their outputs.
tool_output = perform_tool_executions(...)
chat_ctx.items.extend(tool_messages)
3. Use Chat Context Events: The chatCtx
captures everything — messages, function calls, and more — so IVR navigation and tool usage are all recorded seamlessly.
4. Implement Cooldown for DTMF Codes: Just a heads-up: it’s a good idea to have a 3-second cooldown between DTMF presses to avoid any rapid-fire issues.
By following these steps, you’ll have a full and clear record of agent actions included automatically in the conversation history and transcripts. Pretty handy, right?
Sources: complex-agents/ivr-agent/README.md | livekit-agents/livekit/agents/voice/agent.py | Events and error handling | LiveKit Docsbillions-lawyer-8588
08/12/2025, 5:36 PMtall-airline-16756
08/12/2025, 5:37 PMsession.history.items
list includes messages and tool usage, like function calls and their outputs. That said, it’s not totally clear from the docs whether IVR navigation actions (like DTMF signals) are included.
If capturing those IVR navigation actions is important to you, you might want to set up some custom tracking or do a bit of extra testing to see how it’s handled. Checking any IVR-specific docs could also help clarify this.billions-lawyer-8588
08/12/2025, 5:47 PMtall-airline-16756
08/12/2025, 5:47 PMadd_message()
method from the ChatContext
class. This lets you specify who’s sending the message and what the message is all about.
Here’s a quick example to get you started:
Sources: examples/drive-thru/test_agent.py