AI agent: My procedure skips multiple steps or follows the wrong decision-tree branch

Issue symptoms

With my AI agent and messaging, I create a Sunshine Conversations (SunCo) action with Get User, which retrieves the externalId field and saves it as externalId. However, with that parameter, the procedure skips multiple steps or follows the wrong decision-tree branch.

Resolution steps

The user information, especially the value of externalId, might be cached and available for retrieval. The AI agent then fails to set the parameters in the conversation, even though SunCo actions trigger to do so. Because externalId isn't present as a session parameter, the procedure takes this route. This means the procedure works correctly based on the session parameter information it can or can't access.

As a best practice, use the Conversation action to Set a new parameter with the value previously set by the SunCo action:

Collect parameters using SunCo actions

Reset the values by using another conversation action at the start of the conversation

Don't set more than one parameter with the same key. For example, in AI agent actions, don't set the value of externalId to customId and externalId.

This failsafe approach ensures session parameters are available every time at the start of the conversation.

This helps avoid situations where the call to the SunCo action Get User isn't complete before the conversation starts, and the information is available for retrieval.