Triggering API call to export last_uttarance and last_response in agent step.
I’m trying to log each user question and the agent’s response to a Google Sheet using {last_utterance} and {last_response}. The problem is that when using the Agent step, the variables are updated at different times — so the bot’s response gets logged before the user’s next question is stored. This causes my logs to show mismatched Q/A pairs, especially for the first user message.
What Happens:
Inside an Agent step, the agent generates a response, which updates {last_response} immediately.
But {last_utterance} is only updated after a Listen block or after the next user input.
Because of this timing difference, the webhook logs the current answer paired with the previous question, resulting in incorrect rows in the sheet.
What I Need Help With:
A reliable way (inside or after the Agent step) to access both the current user message and the current agent response from the same turn, so I can send them together to my webhook.
Or guidance on best practices for capturing synced Q/A pairs when using the Agent step.
0 Replies