https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do i end the conversation after it transits to...
# ❓・ai-evy-support
p
@AI Evy how do i end the conversation after it transits to the desired state in the prompt tree
a
Thanks for tagging me @prism_09. I'll look through relevant sources and get back to you shortly.
### Answer To end the conversation after transitioning to a desired state in a multi-prompt agent, you need to add the End Call tool and configure termination conditions [(1) ]() . Here's how to set it up: 1. **Add End Call Tool**: Click "+ Add" in the tools section and select "End Call" from the dropdown menu . 2. **Configure Termination Conditions**: Define specific conditions under which the call should be terminated . For example, in your prompt, you can include state transition logic like this [(2) ]() :
Copy code
7. Ask if user is interested in an in person tour.
 - if yes, transition to schedule_tour.
 - if no or hesitant, call function end_call to hang up politely and say will reach out if any other interesting properties pop up.
3. **Update the Prompt**: Enhance the agent's understanding by incorporating the end call conditions into the prompt [(1) ]() . Include specific instructions such as: "If the user says 'thank you', 'goodbye', or 'bye', use the end_call tool to terminate the conversation" . You can also define when to call the function within your state logic [(2) ]() :
Copy code
3. Confirm the date, time, and timezone selected by user: "Just to confirm, you want to book the appointment at ...". Make sure this is a time from the available slots.
4. Once confirmed, call function book_appointment to book the appointment.
By default, the agent won't end the call automatically, so you'll need to configure these termination conditions to control when and how the call should be terminated [(1) ]() .
​ To learn more, see the sources I considered: [[1] End call](https://docs.retellai.com/build/single-multi-prompt/end-call) [[2] Build a multi-prompt agent](https://docs.retellai.com/build/single-multi-prompt/write-multi-prompt) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.