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}}
) .