While testing an Autonomous AI Agent flow in Webex Connect, I ran into a small but annoying problem that is worth fixing early.
The issue shows up in the Append Conversation node. If the AI Agent sends back text that contains quotation marks, the flow may fail instead of continuing normally. At first glance it looks strange, because the bot response itself is valid text, but the node does not always handle those quotes cleanly.
In the default Cisco template, the AI Agent response is passed straight into Append Conversation. That works fine until the reply includes something like "example text" inside the message. Once that happens, the node can throw an error and break the flow.
The good news is that the fix is simple. Before the response reaches Append Conversation, the text just needs to be cleaned up. Let's do it now.
Open your Flow in the Flow Editor and click Edit. Find the Send Bot Response node and remove its onSuccess connection. Then move the AI Agent node and the Send Bot Response node one step to the left so there is room to insert another node between them and the rest of the flow.
Add an Evaluate node to your flow. From the Node Palette, drag an Evaluate node onto the canvas and place it to the right of Send Bot Response. Connect the onSuccess outcome from Send Bot Response to this new Evaluate node.
Create a variable for the raw response. Open the properties of the Evaluate node. In Custom Variables, add a new variable called rawMessage. Save it.
Next, go to Transition Actions and create an action with these settings:
- Time: On-enter
- Action: Set variable
- Variable:
rawMessage - Value:
$(n1695.TextResponse)
This stores the original AI bot response $(n1695.TextResponse) in a variable rawMessage so it can be processed safely. Be careful with node numbers!!! In your flow they may be different!!! n1695 is the number of the AI Agent node in our flow used for this post.
Escape the quotation marks. Now open the Configuration tab in the Evaluate node and paste in the following JavaScript (where message is a custom variable in the flow - it should be created in advance, of course):
var message = rawMessage.replace(/"/g, '\\"');
message;
1;
What this does is straightforward: it looks through the AI response and replaces every double quote with an escaped version. That makes the text safe to pass forward.
Below the script, set the output like this:
- Script Output:
1 - Branch Name:
success
Then save the node.
Connect the success outcome of the Evaluate node to Append Conversation. Any unsuccessful outcomes from the Evaluate node should go to Close Task.
Update Append Conversation. Open the Append Conversation node. In the Text field, remove:
$(n1695.TextResponse)
and replace it with:
$(message)
That is the key part of the fix. Instead of sending the raw AI response into the conversation, you are now sending the cleaned version.
Save the node.
Save the flow and check for warnings. If everything was configured correctly, there should not be any. Then click Make Live to activate the updated version.
Why this matters
This is one of those small fixes that can save a lot of time during testing. Without it, the flow may appear to work most of the time and then suddenly fail when the AI returns a sentence with quotation marks. That makes troubleshooting harder than it needs to be.
By adding a short Evaluate step and escaping the quotes before the text reaches Append Conversation, you make the flow much more stable and predictable.
If you are building Autonomous AI Agent flows in Webex Connect, it is worth putting this fix in place before you spend time testing the rest of the logic.








No comments:
Post a Comment