### Answer
To stop a custom function from continuously sending emails, you need to check several areas:
1. Review your custom function configuration:
- Check the "Speak during execution" and "Speak after execution" settings in your custom function configuration [(1) ](
) . If "Speak after execution" is enabled, the agent may continue calling functions repeatedly .
- Disable "Speak after execution" if you don't want the agent to continue processing after the function completes .
2. Check your prompt instructions:
- Review your agent's prompt to ensure it doesn't contain instructions that would cause repeated email sending [(2) ](
) [(1) ](
) .
- Update your prompt to be more specific about when the email function should be called [(1) ](
) .
3. Verify your endpoint response:
- Ensure your custom function endpoint returns a proper response with status code between 200-299 [(2) ](
) [(1) ](
) .
- The response should indicate successful completion to prevent retries .
4. Check retry behavior:
- Retell will retry failed requests up to 2 times . If your endpoint is failing, it may cause multiple attempts.
- Verify your endpoint is handling requests properly and returning success responses .
5. Review function timeout:
- The request will timeout in your specified timeout period, or 2 minutes if not specified . Ensure your function completes within the timeout window .
If the issue persists, you may need to temporarily disable the custom function in your agent