hello mr ai, so i am creating an ai that will auto...
# ask-ai
a
hello mr ai, so i am creating an ai that will automatically book appointments, i have a few function calls and for somereason whenever it reaches the part where it needs to ask for phone number the agent begin to bug out responding to itself and slowly deteriorate and it winds up looping "waiting for user response"
t
Thanks for reaching out, RAGE. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm sorry to hear you're having trouble with the agent looping and deteriorating during function calls. This can sometimes happen due to how the system manages errors or recursion, but don’t worry—we can work through this together. Here are a few steps that might help: • First, make sure the maximum number of tool steps (
max_tool_steps
) is set correctly. This helps prevent infinite loops by stopping processing if the limit is reached. • Next, take a look at the function calls for any invalid arguments. The system is built to handle errors like
ValidationError
or
ValueError
smoothly by logging them and continuing without crashing. • You can also use the
ToolError
exception to let the AI model know about functional issues, so it can adjust its responses accordingly. • It might be helpful to try some external monitoring or testing tools, like
FunctionCallAssert
, to check and debug your function calls in a controlled way. If you’re still seeing issues after trying these, feel free to share more details about your function logic. I’m here to help you get this sorted out! Sources: livekit-agents/livekit/agents/voice/run_result.py | Troubleshooting & Common Issues | livekit/livekit_composite | DeepWiki
a
i dont believe it is the function call, i informed it to get individual details from the caller before calling the function with all those details
this is part of my system prompt the second it asks for phone number it starts bugging out, any issue?: 1. Find available time: - Ask about their preferred day and time (accept vague answers like "sometime this week" or specific ones like "Tuesday at 2 PM") - Use get_slots to check availability - If their first choice is unavailable, present 2 to 3 alternative slots clearly: "I have Tuesday at 10 AM, Wednesday at 2 PM, or Thursday at 9 AM available. Which works best?" - If no slots exist in their timeframe, ask if they'd like to try a different day 2. Gather customer details one at a time (only after time is confirmed): - Full name - Phone number (After received number, read it back for confirmation) - Address (number and street name, no need for city/state/zip) - Brief description of the plumbing issue 3. Address verification: - After they spell the address, read it back only once: "Just to confirm, that's [address]?" - Wait for explicit confirmation before proceeding, if customer disagrees, ask them to repeat
t
It sounds like the issue might be related to how the agent manages state and confirmation when asking for the phone number. Let’s walk through some common causes and ways to address them: • State Management: It’s important to make sure the agent updates and keeps track of the phone number in a structured user data object once it’s received. Without this, the agent might keep asking for the same information, which can be frustrating. • Confirmation Logic: Using a dedicated function (like
updatePhone
) to capture and confirm the phone number can really help. This function should check that the input is valid and ask for clear confirmation before saving it. • Workflow Orchestration: Double-check that the agent only moves forward after successfully capturing and confirming the phone number. This helps avoid any premature steps that might cause the conversation to loop. • Prompt Dependency: Try not to rely only on the system prompt for collecting data. Instead, setting up clear workflows with definite state updates can make the process smoother and less confusing. Take a moment to review your implementation with these points in mind. If you’re still running into issues, feel free to share more details about how the agent behaves during this step—I’m here to help you get to the bottom of it! Sources: Building the all-in-one platform for voice AI agents | Building the all-in-one platform for voice AI agents | Building the all-in-one platform for voice AI agents | examples/src/restaurant_agent.ts | examples/voice_agents/restaurant_agent.py