Custom function not executing despite being configured as tool in state

Hi Retell team,

I’m experiencing an issue where my agent is not executing a custom function that’s properly configured in my conversation flow.

Setup:

  • Agent: Joyce_F7_Demo_Agent (agent_e1b1ca969508451092330afd75)

  • Custom Function: send_data_to_make

  • State: “send_data_to_make”

  • The function is added as a Tool in this state

  • The state prompt explicitly instructs the agent to execute the function before ending the call

Problem: When calls reach this state, the agent calls end_call immediately without executing send_data_to_make first.

Evidence from Detail Logs: The logs show:

Calling tool: end_call

But they never show:

Calling tool: send_data_to_make

What I’ve verified: :white_check_mark: Custom function is configured correctly with proper API endpoint, headers, and JSON schema :white_check_mark: Function is listed as a Tool (Optional) in the state :white_check_mark: State prompt explicitly says “MUST execute send_data_to_make function” :white_check_mark: Agent successfully executes other tools like end_call :white_check_mark: Custom Analysis data IS being extracted (caller_name, caller_email, etc. all appear in call logs)

What’s not working: :cross_mark: The custom function never executes :cross_mark: No webhook data is sent with the extracted variables

Can you help me understand why the agent is skipping this custom function? Is there a configuration issue I’m missing, or is this a platform bug?

Thank you!

Based on your description, there are several potential issues that could prevent your custom function from executing in the conversation flow:

1. Tool Configuration in State

When you add a tool as “Optional” in a state, the LLM decides whether to call it based on the conversation context and prompt instructions.(1) If the agent is calling end_call immediately, the LLM may be prioritizing that function over your custom function.

2. Prompt Engineering

The effectiveness of function calling depends heavily on how you describe when the function should be called in your prompt.(2) Simply stating “MUST execute” may not be sufficient. You should explicitly describe the conditions under which the function should be invoked.(3)

3. Function Execution Timing

If both send_data_to_make and end_call are available as tools in the same state, the LLM might choose to call end_call first, especially if the conversation context suggests the call should end.(3)

Recommended Solutions:

A. Separate the Functions into Different States

Create a dedicated state for send_data_to_make that transitions to the final state with end_call. This ensures the data-sending function executes before the call ends.(1)

B. Improve Your Prompt

Update your state prompt to be more explicit about when to call the function. For example:

When user provided the city name, please get the weather for that city by calling the `get_weather` function.

(2)

C. Configure Speech Behavior

In your custom function configuration, ensure you’ve properly set “Speak During Execution” and “Speak After Execution” settings.(2) These control whether the agent speaks when the function is called and after it completes.(1)

D. Verify Dynamic Variables

If your custom function uses dynamic variables extracted from the conversation, ensure they’re being mapped correctly. There have been cases where variables extracted as separate values need to be referenced directly (like {{make}}) rather than with dot notation (like {{vehicle.make}}).(4)

E. Check HTTP Method Configuration

Verify that your custom function is configured with the correct HTTP method (POST, GET, PUT, PATCH, or DELETE).(1)(2) There was a reported case where a trailing slash in the URL caused the request to be sent as GET instead of POST.(5)

Recent Platform Issues

Note that there was a reported issue on July 22, 2025, where conversation flow function nodes were not working properly on telephony/voice calls (though they worked fine in text chat).(6) This issue was identified and the team was working on a fix.(6) If you’re experiencing this issue recently, it may be related to that platform issue.

Next Steps:

  1. Try separating your send_data_to_make function into its own state before the end-call state
  2. Review your function’s parameter schema to ensure it’s valid JSON
  3. Check that your endpoint URL doesn’t have a trailing slash
  4. Verify your dynamic variable mapping if you’re using extracted variables

If these suggestions don’t resolve the issue, I recommend reaching out through the official support channels: