many-controller-54194
10/07/2025, 8:49 PMtall-airline-16756
10/07/2025, 8:49 PMtall-airline-16756
10/07/2025, 8:49 PMfunction_tool gets called properly in a declarative_flow agent without those repetitive greetings or questions. Let's walk through some helpful steps together:
• Write Clear Instructions: It's really important to provide precise instructions and docstrings. This helps guide the LLM on exactly when to invoke the tool, making everything run more smoothly.
• Control Return Values: You can return None if you want the execution to be silent, or use function_tools_executed along with cancel_tool_reply() to prevent any automatic replies that might feel redundant.
• Coordinate Speech: To avoid any overlap between on_enter and session.say, try sticking to just one method or control speech with the session state. This keeps the conversation flowing naturally.
• Handle Transitions: When your tools return new Agent instances, it helps manage state changes gracefully without triggering extra LLM responses.
• Track State: Using session.state or session.userdata is a great way to keep the flow consistent and prevent repeated actions that might confuse users.
By following these tips, you'll create a more reliable and seamless experience for your agents in declarative workflows. If you have any questions or want to dive deeper into any of these points, feel free to ask—I'm here to help!
Sources: Tool definition and use | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py | complex-agents/testing/agent.py | Pipeline nodes and hooks | LiveKit Docs