is there a way for the agent to calls tools using ...
# ask-ai
i
is there a way for the agent to calls tools using preemptive generaton without getting interrupted?
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you're asking whether an agent can call tools during preemptive generation and avoid being interrupted. Quick answer and next steps below. Short answer • You can initiate tool calls during preemptive generation, but those calls are speculative and can be discarded if the final user utterance differs. • To prevent interruptions during confirmed tool execution, use
context.disallow_interruptions()
inside the tool; this ensures the tool runs to completion. • There is no way to make speculative (preemptive) tool calls immune to being discarded — preemptive paths are validated after the user turn, and if invalidated they are thrown away. Follow-up question • Do you need guaranteed, irreversible actions (where interruptions must be blocked), or are you trying to reduce latency by speculatively calling safe/read-only tools? That will determine whether we recommend preemptive calls or waiting until turn confirmation. Sources: Function tool definition | LiveKit Documentation, with interactive elements