https://retellai.com/?utm_source=discord&utm_medium=seo logo
tool_call_invocation out of order
# ❓・bug-report
e
Hi! I have created a multi-state agent where the first state just transition to another 2 states based on the value of a dynamic variable. It works fine on both Test LLM and Test Audio tabs, but when I get the call using the API this first transition is at the end of transcript_with_tool_calls.
r
Hi @erichideyuki , please try to use phrases such as "immediately and reliably call xx function" in the state to make its success rate higher. We see LLM sometimes will miss calling a function if not given specific instruction.
e
Hi @retellai, The problem is not calling the transition or not, its the order. It has been called at the beginning but it is at the end of the array
p
@AI Evy how to explain the context of the conversation so that the voice AI generates better answers
a
Thanks for tagging me @prism_09. I'll look through relevant sources and get back to you shortly.
### Answer To improve conversation context and generate better answers with voice AI, there are several key elements to consider: 1. Design clear entry points that set the tone and expectations immediately [(1) ]() 2. Maintain context handling across conversation turns to avoid making users feel like they're starting over at each step 3. Implement guided prompts that offer helpful options without sounding overly scripted or robotic 4. Use personalization by tailoring conversations based on user history, preferences, and real-time data when possible 5. Focus on intent clarity to help users articulate their needs naturally The system should be able to maintain memory across turns so conversations don't feel like starting over at every step . For example, in a healthcare setting, the AI voice agent should be able to greet patients warmly, recognize why they're calling, confirm key details without unnecessary repetition, and offer clear next steps—making the call feel natural, fast, and respectful . Additionally, the Large Language Models (LLMs) powering the voice agent should be able to: - Maintain long contextual memory for extended conversations [(2) ]() - Process extensive documents with large context windows - Focus on maintaining alignment and safety in long conversations
​ To learn more, see the sources I considered: [[1] Conversational Design](https://www.retellai.com/glossary/conversational-design) [[2] Choosing the Best LLM for Your AI Voice Agents | Retell AI](https://www.retellai.com/blog/choosing-the-best-llm-for-your-voice-ai-agents) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
p
@AI Evy what is a suitable prompt to prevent the agent from mishearing out of context words
a
Thanks for the follow-up, @prism_09. I'll get back to you soon.
### Answer To prevent the agent from mishearing out of context words, you can implement a constrained framework within the conversation flow feature that establishes clearer guidelines for responses [(1) ]() . Here are some key approaches: 1. Use structured conversation management to ensure better control over dialogue paths 2. Implement clarifying questions when inputs are unclear. For example: "Could you specify what kind of help you need—billing, technical support, or something else?" 3. Design specific paths for interactions to ensure users receive accurate information tailored to their queries 4. Configure fallback mechanisms for incomplete inputs [(2) ]() Additionally, you can improve accuracy by: - Using session variables to store the user's initial request - Linking follow-up queries to the stored context - Implementing adaptive workflows to guide users back to the expected path [(1) ]() For complex interactions, consider using the conversational flow approach rather than single or multi-prompt methods, as it provides the most control over dialogue paths .
​ To learn more, see the sources I considered: [[1] Retell AI’s Advanced Conversation Flow | Retell AI](https://www.retellai.com/blog/unlocking-complex-interactions-with-retell-ais-conversation-flow) [[2] 5 Useful Prompts for AI Agent Builders | Retell AI](https://www.retellai.com/blog/5-useful-prompts-for-building-ai-voice-agents-on-retell-ai) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.