https://discord.gg/botpress logo
How to end autonomous mode?
# 🤝help
r
How to end conversation in autonomous mode for example after 5 messages?
p
You can look at the length of the history variable (found in the json object in the studio) in a transition card or in the An's instructions. Hope this helps!
r
Thank you! Is there any example of the condition? Cannot find history variable...
p
here it is {{event.state.session.history}} Happy Bot Building!
r
Is there any .lenght or similar function to get the lenght/size of that array?
p
yes .length should work
n
@rapid-apartment-53649 ¿Pudiste resolver esto?
p
Another way to end the autonomous node is to make a subworkflow called end that contains nothing but an end node instead of an exit node. Then instruct the AN when to call global.end.
n
Hi. Sorry, I'm having a bit of trouble with this part; I'm not that technically savvy. Do you insert the {{event.state.session.history}} condition directly into the standalone node instructions? Could you provide an example of what I would need to do to stop responding if the user has asked three questions?