https://discord.gg/botpress logo
Summary Agent not reseting when going through the ...
# šŸ¤help
b
Hello guys! Is anybody else having trouble with the summary agent😄 ? Whenever im testing my bot using the built in emulator, the summary agent always shows the information from all the last conversations, not just the current one. I've tried to force the data to reset by using hook code and the execute code card, but this doesn't help. I'm also making sure that the bot does go through the "Conversation end" workflow, which ends with an end node. As you can see in the images, it looks like the summary agent still activates after this end node, and the conversation variables are still being savedšŸ¤” . I have no idea why this happens and how could I fix it. Any ideas? Thank you very much. https://cdn.discordapp.com/attachments/1435042518285680691/1435042518654783598/imagen.png?ex=690a86fe&is=6909357e&hm=52e336448b3f6e94d45c03efe17dd693e95b365de9260c3f4bd0f44cd4c70471& https://cdn.discordapp.com/attachments/1435042518285680691/1435042519044980746/imagen.png?ex=690a86fe&is=6909357e&hm=9e119c55be05e1c61c97bd3b750509092fbc0fd4adc0939cadab33352322963e&
r
Yeah, this happens because the SummaryAgent runs asynchronously after the conversation technically ends so it’s still summarizing using previous conversation data before the reset completes. You’ll want to clear the conversation state before the SummaryAgent hook triggers. Try adding a bp.conversations.reset(stateId) or clearing conversation.SummaryAgent right before your End Node runs (not inside ā€œBefore Conversation Endsā€). Are you using cloud or self-hosted Botpress?
w
Do you test the published bot? The emulator has some different behaviors compared to the online bot
b
Hello Zannax and Ayo. I am using cloud botpress. I have published the bot but the behavior is still the same.
r
Since you’re on Botpress Cloud, that explains it. In the cloud version, the SummaryAgent hook always runs after the workflow ends, so you can’t control exactly when it triggers. That’s why even if your ā€œBefore Conversation Endsā€ flow clears variables, the SummaryAgent still summarizes before your reset happens. A good workaround is to clear everything at the start of a new conversation instead in your ā€œOn Conversation Startā€ workflow, just add a code card that resets conversation.SummaryAgent. That guarantees each new chat starts fresh, regardless of what happened last session. I’ve implemented this setup for other cloud bots before I can DM you the exact code snippet and steps to make it work smoothly if you’d like?
w
Please, Ayo Lyn, if you have a code snippet, it would be better to post it here instead of in DMs. This way, you'll help others who might have the same issue. Alternatively, you could post your solution in the #tutorials šŸ˜‰