colossal-xylophone-68609
04/13/2026, 4:30 PMtall-airline-16756
04/13/2026, 4:30 PMtall-airline-16756
04/13/2026, 4:31 PMlookup_order_status() and follows up with another spoken result.
• Trigger speech from inside the tool or while the tool runs using context.session.say() or session.generate_reply(), so the user hears immediate feedback while the tool executes.
• Use pre-synthesized/cached TTS to play quick audio while longer tool calls run in the background to avoid latency.
• Barge-in/interruption handling is supported so the flow stays natural if the user speaks during speech or tool execution.
If you want, tell me which implementation you’re using (server-side tools via @function_tool, or in-tool TTS calls) and I’ll give a concise code pattern you can follow.
Sources: The ReAct Pattern for Voice Agents and How AI Agents Think, Act, and Respon... | Function tool definition | LiveKit Documentation | The ReAct Pattern for Voice Agents and How AI Agents Think, Act, and Respon... | External data and RAG | LiveKit Documentation | Audio customization | LiveKit Documentation, with interactive elementscolossal-xylophone-68609
04/13/2026, 4:32 PMtall-airline-16756
04/13/2026, 4:33 PMcolossal-xylophone-68609
04/13/2026, 4:34 PMtall-airline-16756
04/13/2026, 4:34 PMcolossal-xylophone-68609
04/13/2026, 4:35 PMtall-airline-16756
04/13/2026, 4:35 PM{
"name": "lookup_order_status",
"description": "Returns the order status for a given order_id",
"parameters": {
"type": "object",
"properties": {
"order_id": {
"type": "string",
"description": "Order identifier"
}
},
"required": [
"order_id"
]
}
}
Prompt (ReAct-style) to give the model
System: You are a helpful agent. Follow the ReAct pattern: when you need external data, first produce a short user-facing message (one sentence) indicating what you're doing, then emit a tool call in JSON exactly matching the tool schema. Do not call any SDK methods yourself.
User: My order 12345 seems delayed. Can you check it?
Assistant (expected format):
1) A single short sentence for the user (what you will say aloud), e.g. "I'm checking your order status now."
2) A JSON tool invocation on the next line matching the tool schema.
Example response:
"I'm checking your order status now."
{"tool": "lookup_order_status", "arguments": {"order_id": "12345"}}
How LiveKit will handle this (sequential orchestration)
• The model should emit the short sentence followed by the JSON tool invocation (ReAct style).
• LiveKit will play the sentence as speech first, then parse the JSON and execute the tool.
• After the tool returns, LiveKit appends the tool result to the conversation and the model generates the follow-up reply (which will be played as speech).
• This achieves the user experience of “agent speaks, then tool runs, then agent reports back,” but speech playback and tool execution are performed sequentially by the platform rather than as one atomic simultaneous LLM action.
If you want, I can adapt this prompt for multiple tools or produce a Node/Python runtime snippet showing how to parse the model output and orchestrate playback → tool call → follow-up. Which would you prefer?
, with interactive elements