A long-running backend action must remain understandable even if the caller interrupts, changes their mind, or hangs up. Keeping the conversation responsive is useful, but it does not make the action durable or reversible.
LiveKit's current function-tool documentation discusses background execution and interruption behavior. Verify the behavior of the installed version and tool design. Treat cancellation of local execution separately from cancellation of an external business operation.
Define an action contract before execution
Record authorized intent, client, request identifier, permitted scope, deadline policy, current status, and destination reference. Decide whether the operation is a lookup, reversible draft, or consequential commitment.
Expose truthful progress to the conversation: submitted, waiting, confirmed, rejected, or uncertain. Do not turn a polite “I'm checking” message into a claim that a booking has been reserved. If work must continue beyond the call, persist it through an application-owned durable process.
Work through a fictional slow scheduling action
A caller agrees to a visit while a scheduling service responds slowly. The caller then asks to use another date. The old create request may already be accepted remotely.
The application must reconcile the first request before creating another commitment or cancelling anything under policy. Simply cancelling an in-memory task cannot prove the remote appointment never existed. The agent should explain the actual pending state and use staff review if necessary.
| Long-running fixture | Required behavior |
|---|---|
| Slow read-only lookup | Useful waiting or fallback response |
| Consequential write submitted | Durable action identity |
| Caller interrupts | Defined local and remote semantics |
| Result arrives after hangup | Stored outcome and owned follow-up |
| Deadline expires | Uncertain or failed state, not invented success |
Bound work without hiding uncertainty
Use explicit deadlines and retry rules appropriate to the service. A timeout can protect conversational responsiveness while leaving remote outcome unknown. Track those cases in a queue that operators can reconcile.
Background execution improves interaction flow but adds race conditions and state coordination. Blocking until completion is simpler while risking long silence or abandoned calls. Choose based on action consequence and the business's follow-up capability rather than one universal tool policy.
Test delayed success, explicit rejection, lost response, and a second conflicting request. Review caller-disconnect recovery for work that outlives the media session.
Questions about long-running actions
Does interrupting speech cancel a booking?
Do not assume that. Verify the implemented cancellation boundary and inspect any submitted remote operation.
Can the agent promise completion after the call?
Only when durable processing and an owned communication process support that promise.
What should the tool return when outcome is unknown?
A clear uncertain state with an action reference and next process, so the agent can avoid false confirmation and staff can recover the request.