https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> I'm having problems with th...
# ❓・ai-evy-support
m
@AI Evy I'm having problems with the multi-prompt agent. I can't get the agent to transition back to a previous state it came for. Is that possible? In case for example that a user wants to do multiple operations in an inbound appointment setter scenario
a
Thanks for tagging me @mrearthbound. I'll look through relevant sources and get back to you shortly.
### Answer Yes, it's possible to transition back to previous states in multi-prompt agents [(1) ]() . The multi-prompt approach allows you to create a structured tree of prompts where each node can contain clear transition logic to other nodes [(2) ]() . To implement backward transitions in your multi-prompt agent, you need to define the state transition logic properly in your prompts [(1) ]() . For example, you can structure your prompt like this:
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.
For your inbound appointment setter scenario where users want to perform multiple operations, you can add transition conditions that allow going back to previous states. The key is to define when to transition to your previous state, such as: - If the user wants to schedule another appointment, transition back to your scheduling state - If the user wants to modify existing information, transition back to your information collection state To improve transition reliability, you can use more explicit language in your prompts [(3) ]() . As one community member shared, adding phrases like "Immediately and reliably initiate the transfer" and treating transitions as "high-priority actions" can help ensure the agent follows the correct flow . Keep your general prompt short when using multi-states and write style guidelines there, while keeping each state's prompts concise [(4) ]() . Multiple transitions from one state to many states can be confusing for the LLM, so it's crucial to write conditions explicitly .
​ To learn more, see the sources I considered: [[1] Build a multi-prompt agent](https://docs.retellai.com/build/single-multi-prompt/write-multi-prompt) [[2] Prompt Overview](https://docs.retellai.com/build/single-multi-prompt/prompt-overview) [[3] Multi prompt agent not always transitioning to the next state](https://discord.com/channels/1186424376300679209/1303504848196472893) [[4] Not transitioning between states](https://discord.com/channels/1186424376300679209/1291114413662801960) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.