https://retellai.com/?utm_source=discord&utm_medium=seo logo
My conversation node is not calling my custom func...
# ❓・ai-evy-support
e
@AI Evy My conversation node is not calling my custom function any tips?
a
Thanks for tagging me @ezzy. I'll look through relevant sources and get back to you shortly.
### Answer When a conversation node has functions attached, the LLM decides when to call the function based on the conversation context. [(1) ]() The agent converses with the user while also being able to perform tasks like calling APIs, transferring calls, or sending SMS. Here are common issues and solutions: 1. Update your node instruction to explicitly guide the LLM The node's prompt instruction must guide the LLM on when to use the function. For example:
Copy code
Help the user check their order status. If the user provides an order number,
call the check_order_status function to look up the order.
2. Be explicit about when each function should be called The LLM uses the instruction and function descriptions to decide when to invoke a function. You should define clear triggers and specify exact conditions for tool usage in your prompts. [(2) ]() Reference tools by their exact names. 3. Avoid adding too many functions to a single node Adding many functions can make it harder for the LLM to choose the right one. [(1) ]() If you have many functions, consider splitting them across multiple conversation nodes. 4. Consider using a function node for guaranteed execution If a function must always run at a certain point in the flow (e.g., always fetch user data before greeting) , use a function node instead. Function nodes execute deterministically on node entry, while node functions are LLM-driven and called when the LLM decides it's appropriate. 5. Separate functions into different states Create a dedicated state for your custom function that transitions to the final state. [(3) ]() This ensures the function executes before moving to the next step. 6. Verify dynamic variable mapping If your custom function uses dynamic variables extracted from the conversation, ensure they're being mapped correctly. Variables extracted as separate values need to be referenced directly (like
{{make}}
) rather than with dot notation (like
{{vehicle.make}}
) .
​ To learn more, see the sources I considered: [[1] Node Functions](https://docs.retellai.com/build/conversation-flow/conversation-node-functions) [[2] Prompt Engineering Guide](https://docs.retellai.com/build/prompt-engineering-guide) [[3] Custom function not executing despite being configured as tool in state](https://community.retellai.com/t/custom-function-not-executing-despite-being-configured-as-tool-in-state/705) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.