Agent tool execution w/ data messages

We’re currently sending messages to user browsers via “publish_data” (via room.local participant). For agent tools that aren’t instant, this is how we’re notifying users that the agent is doing something for them, and is how we’re delivering agent output

We’re seeing some of these drop. Noticed that if the agent is executing a tool, but isn’t finished processing, but the user has started another message and the agent responds (before the tool is finished executing), these messages get dropped and the user never receives these events.

What reasons would there be that the user doesn’t receive these messages? What are the best ways to make sure they receive all the intended messages (outside of setting it to “reliable” delivery)?

Do agent tools finish executing even when the user decides to continuing chatting?

To send data between your agent and the user’s browser we recommend RPC: Remote method calls | LiveKit Documentation. I’m not sure why you’re seeing issues with publish_data but it’s not really designed with this use case in mind (it’s designed to exchange messages with other members in the room)

Do agent tools finish executing even when the user decides to continuing chatting?

The tools are canceled so you shouldn’t rely on their execution being allowed to finish - see also Tool definition and use | LiveKit Documentation