early-boots-90383
11/13/2025, 12:48 AMearly-boots-90383
11/13/2025, 1:22 AMlively-winter-88668
11/13/2025, 10:09 AMearly-boots-90383
11/21/2025, 2:55 PMlively-winter-88668
11/21/2025, 3:39 PMrequired and you have clear definitions for your tools - but I assume you are already doing that.early-boots-90383
11/21/2025, 3:47 PMearly-boots-90383
11/21/2025, 3:47 PMearly-boots-90383
11/21/2025, 3:51 PMearly-boots-90383
11/25/2025, 6:40 PMearly-boots-90383
11/25/2025, 6:42 PMlively-winter-88668
11/26/2025, 9:12 AMWhenever I use generate_reply inside a tool call it seems that the agent has no context that it already used the tool once, so it just tries to use the tool again
early-boots-90383
11/26/2025, 6:02 PMimport asyncio
from livekit.agents import function_tool, RunContext
@function_tool()
async def search_knowledge_base(
self,
context: RunContext,
query: str,
) -> str:
# Send a verbal status update to the user after a short delay
async def _speak_status_update(delay: float = 0.5):
await asyncio.sleep(delay)
await context.session.generate_reply(instructions=f"""
You are searching the knowledge base for \"{query}\" but it is taking a little while.
Update the user on your progress, but be very brief.
""")
status_update_task = asyncio.create_task(_speak_status_update(0.5))
# Perform search (function definition omitted for brevity)
result = await _perform_search(query)
# Cancel status update if search completed before timeout
status_update_task.cancel()
return resultearly-boots-90383
11/26/2025, 6:02 PMearly-boots-90383
11/26/2025, 6:05 PMlively-winter-88668
11/27/2025, 10:12 AMgenerate_reply . Seems like it was kicking off the pipeline again and deciding a function tool call was necessary. Is it feasible to add tool_choice="none" to your generate_reply call?early-boots-90383
11/27/2025, 11:05 AMearly-boots-90383
11/28/2025, 1:00 AM...
async def handle_voicemail():
await self.session.generate_reply(
instructions="""- Generate ONE short, natural voicemail message telling the person you will call back later.
- Speak the message once, then STOP.
- Do NOT repeat the message.
- Do NOT add anything else.
- Do NOT call or invoke any tool again after producing the voicemail.
- After the voicemail is spoken, the call ENDS immediately.""",
tool_choice=None,
)
while not voicemail_spoken:
await context.speech_handle.wait_if_not_interrupted([handle_voicemail()])
if context.speech_handle.interrupted:
await asyncio.sleep(1.0)
else:
await context.wait_for_playout()
await asyncio.sleep(
0.5
) # Add a natural gap to the end of the voicemail message
voicemail_spoken = True
await hangup_call()
...
I implemented this last week and I'm sure it worked... it doesn't now. context.speech_handle.interrupted is always False. Am I missing something?