https://retellai.com/?utm_source=discord&utm_medium=seo logo
is it possibile to call function, like "end_call" ...
# ❓・ai-evy-support
q
@AI Evy is it possibile to call function, like "end_call" in Conversasional Flow agents from Global prompt enstructions?
a
Thanks for tagging me @Q4. I'll look through relevant sources and get back to you shortly.
### Answer Yes, you can call functions like
end_call
from the global prompt in Conversation Flow agents. In Conversation Flow agents, tools (including
end_call
) can be configured at the global level and referenced in your global prompt. [(1) ]() [(2) ]() Here's how to approach this: 1. Add the End Call tool at the agent level - Configure the tool in the tools section of your conversation flow. [(1) ]() 2. Reference it in your global prompt - You can instruct the agent when to use the function directly in the global prompt. For example, include instructions like: "If the user says 'goodbye', use the end_call tool to terminate the conversation." [(3) ]() 3. **Best practice tip**: When referencing the function in your prompt, consider giving it an identifier (e.g.,
end_call_152
) so the AI can more reliably identify it as a function to call. [(4) ]() Additionally, for actions that should be available anytime throughout the conversation (like ending the call) , using global-level tools and referencing them in the global prompt is the recommended approach. [(5) ]() **Note on timing**: If you're using Flex Mode and the call ends abruptly without the farewell message, you may need to add explicit instructions in your global prompt to output the farewell sentence first, then trigger the end_call tool immediately after. [(6) ]()
​ To learn more, see the sources I considered: [[1] Update Conversation Flow](https://docs.retellai.com/api-references/update-conversation-flow) [[2] Create Conversation Flow](https://docs.retellai.com/api-references/create-conversation-flow) [[3] End call](https://docs.retellai.com/build/single-multi-prompt/end-call) [[4] Discord message from @_superwhale on 2025-01-24](https://discord.com/channels/1186424376300679209/1294891368505937952/1332171997744205925) [[5] CONVERSATION FLOW AGENT - GLOBAL PROMPT](https://discord.com/channels/1186424376300679209/1371534043157500025) [[6] Speak During Execution not working for End Call node](https://discord.com/channels/1186424376300679209/1451006517909258352) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
q
@AI Evy how can I add tool in conversasional flow agent?
a
Thanks for the follow-up, @Q4. I'll get back to you soon.
### Answer You can add tools to a Conversation Flow agent by including them in the
tools
array when creating or updating the conversation flow. [(1) ]() [(2) ]() Via the API (JavaScript SDK example) :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const conversationFlowResponse = await client.conversationFlow.create({
  model_choice: { model: 'gpt-4.1', type: 'cascading' },
  nodes: [
    {
      id: 'start',
      instruction: { text: 'Greet the customer and ask how you can help them.', type: 'prompt' },
      type: 'conversation',
    },
  ],
  start_speaker: 'agent',
}) ;
[(1) ]() Tool structure example from the API response:
Copy code
json
"tools": [
  {
    "type": "custom",
    "name": "get_customer_info",
    "description": "Get customer information from database",
    "tool_id": "tool_001",
    "url": "<https://api.example.com/customer%22,>
    "method": "GET"
  }
]
[(3) ]() , [(1) ]() Key tool properties: - `type`: Tool type (e.g., "custom") - `name`: Name of the tool - `description`: What the tool does - `url`: The endpoint URL for custom tools - `method`: HTTP method (GET, POST, etc.) Via the Dashboard: Head to the Dashboard, create or edit a conversation flow agent, and you can configure tools (functions) directly in the visual builder. [(4) ]() Tools can be defined at the global level (available throughout the entire flow) or within specific components. [(5) ]()
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
q
@User if I need to trigger build in tool like end call. How can i do that?
@AI Evy if I need to trigger build in tool like end call. How can i do that?
a
Thanks for the follow-up, @Q4. I'll get back to you soon.
### Answer For Conversation Flow agents, you can trigger the built-in end call functionality using an End Node. [(1) ]() How to use the End Node: The End Node is used to end the call and does not have any edges—the call terminates the moment the agent enters this node. Node Settings: - **Speak During Execution**: When enabled, a text input box appears where you can write instructions for the agent to generate an utterance like "Goodbye, have a nice day" to say while the function is being executed. You can choose between
Prompt
and
Static Sentence
. - **Global Node**: You can configure the End Node as a global node to make it accessible from anywhere in your flow. You can create multiple end nodes within a single agent to handle different termination scenarios. In your global prompt, you can define conditions that should trigger a transition to the End Node. For example, include instructions like: "If the user says 'thank you', 'goodbye', or 'bye', transition to the end call node." [(2) ]() **Best practice**: When referencing tools/functions in your prompt, use trigger words and define clear conditions for when they should be called. [(3) ]()
​ To learn more, see the sources I considered: [[1] End Node](https://docs.retellai.com/build/conversation-flow/end-node) [[2] End call](https://docs.retellai.com/build/single-multi-prompt/end-call) [[3] Prompt Engineering Guide](https://docs.retellai.com/build/prompt-engineering-guide) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
q
@AI Evy this does not work: In your global prompt, you can define conditions that should trigger a transition to the End Node. For example, include instructions like: "If the user says 'thank you', 'goodbye', or 'bye', transition to the end call node." @Omar Ashraf | Community Lead maybe you can help me on this one?
a
Thanks for the follow-up, @Q4. I'll get back to you soon.
### Answer In Conversation Flow agents, you cannot simply instruct the global prompt to "transition to the End Node"—transitions are controlled through transition conditions and Global Node configuration, not prompt instructions alone. Here's how to properly set up an End Node that can be reached from anywhere: 1. Make your End Node a Global Node [(1) ]() [(2) ]() - Check the
Global Node
checkbox in the End Node settings - When enabled, you must define a condition for when this global node should be transitioned to [(2) ]() 2. Set the Global Node condition - Configure a prompt-based transition condition like:
When user indicates they want to end the call
or
User said something about ending the conversation or saying goodbye
- This condition is evaluated whenever the agent is performing a transition from any node 3. Enable "Speak During Execution" if you want a farewell message [(1) ]() - When enabled, you can write instructions for the agent to generate an utterance like
Goodbye, have a nice day
before the call ends **Key point**: Global nodes can be transitioned to from anywhere in the call, and since they handle universal scenarios, they don't necessarily need to be connected to the rest of the graph. [(2) ]() For transition conditions, you can use prompt-based conditions like: -
When user indicates they want to end the call
-
User declines the invitation
-
User said something about saying goodbye
[(3) ]() If this still isn't working, co
uld you share more details about your current setup—specifically how you've configured the End Node and its transition conditions?
​ To learn more, see the sources I considered: [[1] End Node](https://docs.retellai.com/build/conversation-flow/end-node) [[2] Global Node](https://docs.retellai.com/build/conversation-flow/global-node) [[3] Step 3: Add transition conditions](https://docs.retellai.com/build/conversation-flow/transition-condition) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.