Inconsistent Datastore Execution When Triggering Flows via Playbook Redirection

I am facing an inconsistent behavior when integrating Playbooks and Flows with Datastore execution in a Conversational Agent.

Current production setup:
My production chatbot uses a single flow with a default welcome intent and standard routing. In this flow, the datastore is configured together with a custom payload to display the first knowledge search result, and a webhook is executed to return buttons with links to the documents retrieved from the storage bucket. This setup works correctly in production.

New requirement:
I needed to introduce a document filter to distinguish between two different knowledge bases: Course training documents and Expert books.

What was attempted:

  1. I initially modified the webhook logic to handle multiple datastore IDs and dynamically decide which knowledge base to query based on the user conversation.

  2. I then restructured the flow by adding a start page and specific pages per question. Although the conversation navigation worked, the datastore was no longer executed in the same way as in the production chatbot.

  3. I attempted to reproduce the same behavior using a new agent with Playbooks. The idea was to route questions about courses or books to a secondary playbook that would call the datastore tool directly. This approach did not work.

  4. I then tried a hybrid approach:

    • A Playbook introduces the conversation and asks the user which knowledge base they want to search.

    • Based on the answer, the Playbook redirects the conversation to a Flow.

    • This Flow is configured exactly the same as the production flow (datastore, custom payload, webhook).

Observed behavior:

  • The solution worked once during an initial test in the Toggle Simulator.

  • When tested in the standard integration chat (messenger), it did not work.

  • After that, the same configuration also stopped working in the Toggle Simulator.

  • The behavior became inconsistent and non-deterministic.

The Playbook only redirects to the Flow. Inside the Flow, I adjusted the welcome intent to closely match the production chatbot behavior. All configurations were kept the same.

As a troubleshooting attempt, I added an “end flow” transition in the datastore step to return control to the Playbook, but this change did not resolve the issue. The problem also occurred before this modification.

Expected behavior:
The Flow triggered by the Playbook should execute the datastore in the same way as the production chatbot, returning consistent knowledge results and webhook responses.

Actual behavior:
When the Flow is triggered via Playbook redirection, the datastore does not execute as expected, even though the configuration is identical to the production setup.

At this point, I am unable to identify what differs internally between the working production Flow and the Flow invoked by the Playbook, and why the datastore execution behaves inconsistently across environments. Can someone, please, help me?

To solve the “non-deterministic” behavior, you need to ensure the Flow has a clear, forced trigger for the Data Store.

Solution A: Use a “Bridge” Page (Recommended)

Don’t rely on the Flow’s “Start” page to trigger the Data Store immediately upon redirection. Instead:

Redirect the Playbook to the Flow.

On the Start Page: Use a “Transition Route” with a condition like true to move immediately to a specific Search Page.

On the Search Page: Explicitly trigger the Data Store. This ensures the Flow state is “Settled” before the Datastore logic is invoked.

Solution B: Pass the Query Explicitly

Instead of letting the Data Store “guess” the query from the conversation history, capture the user’s last request in the Playbook and pass it as a Session Parameter.

In your Playbook, ensure the LLM captures the $last_user_utterance.

In the Flow’s Data Store configuration, map the Query field specifically to that parameter rather than the default “Conversation History.”

Solution C: Check the “Data Store Response” Settings

In the Flow, check the Agent Responses section of the Data Store handler.

Ensure that the “Transition” after a successful Data Store hit is clearly defined.

If the Playbook redirected to the Flow, the Flow might be waiting for a “User Input” that it thinks it hasn’t received yet. Setting a “Query” parameter manually (as in Solution B) bypasses this.

Datastore execution is tied to NLU-triggered intent resolution

In your production setup, everything works because:

  • User input →

  • Intent matched in Flow

  • Datastore step executes

  • Knowledge result is injected into the response →

  • Webhook post-processes it

This full chain depends on intent resolution happening at Flow entry.