i have a long running tool so from inside the too...
# ask-ai
b
i have a long running tool so from inside the tool i want to add a message from agent side saying "this might take a few seconds please wait "
t
Thanks for reaching out, Aman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
When you want to send a message from the agent side during a long-running process, here are some friendly ways to keep your users in the loop: • Verbal Status Updates: You can use
agent.say()
to gently let users know there’s a little wait ahead, like saying, "This might take a few seconds, please wait." • Frontend UI Updates: Sending structured status updates through RPC is a great way to keep the client application informed. • Simulated Typing: Adding typing indicators or sounds can really help users feel that something’s happening behind the scenes. • Dynamic Thinking Messages: Creating dynamic interim messages is another wonderful approach to keep users updated in real-time. If you’d like, I’m more than happy to walk you through detailed steps for any of these methods—just let me know! Sources: Tool definition and use | LiveKit docs | examples/voice_agents/long_running_function.py | External data and RAG | LiveKit Docs | complex-agents/exa-deep-researcher/agent/handlers/rpc.py | meditation_assistant/README.mdoc
b
actually i am talking about a voice agent with liveapi
t
When working with a voice agent using LiveAPI, you can keep your users informed during a long-running process by sending verbal updates through the
session.generate_reply()
method. This is a great way to provide live spoken feedback while the background task is running. Here’s a friendly guide on how to do it: • Send Verbal Updates: Simply use
session.generate_reply()
to share messages like "This might take a few seconds, please wait." at important moments during the process. • Handle Interruptions: You can use
run_ctx.speech_handle.wait_if_not_interrupted()
to let users interrupt the agent if they need to. • Dynamic Updates: For more complex workflows, consider managing a queue of status messages to generate natural, flowing updates dynamically. If you’d like, I’d be happy to provide detailed code examples or help you further with the implementation. Just let me know! Sources: LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py | Agent speech and audio | LiveKit docs | complex-agents/exa-deep-researcher/agent/voice/queue.py | External data and RAG | LiveKit Docs
b
{"message": "Error in _realtime_reply_task\nTraceback (most recent call last):\n File \"/Users/dj/Documents/recivo/voice_agent/.venv/lib/python3.12/site-packages/livekit/agents/utils/log.py\", line 16, in async_fn_logs\n return await fn(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/dj/Documents/recivo/voice_agent/.venv/lib/python3.12/site-packages/livekit/agents/voice/agent_activity.py\", line 1942, in _realtime_reply_task\n generation_ev = await self._rt_session.generate_reply(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nlivekit.agents.llm.realtime.RealtimeError: generate_reply timed out waiting for generation_created event.", "level": "ERROR", "name": "livekit.agents", "pid": 23546, "job_id": "AJ_U6dQYRDQmpoD", "timestamp": "2025-11-17T110829.874514+00:00"}
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!