I’m trying to set up a flow that transitions from a playbook back to a flow. I’m not sure if this is the best approach, but since taking a pizza order can be complex (e.g., ‘pepperoni… no, never mind, mushroom’), I opted to handle the ordering logic within a routine playbook. (Should I be using a task instead?) After capturing the order details, I want the playbook to pass this data back into the flow. However, the transition from the playbook back to the flow isn’t working as expected. Should I avoid using playbooks altogether, or am I implementing this incorrectly?
This is my instructions in the playbook :
Hi @MCity
First question - can you please confirm that when editing your playbook, you see a tab called parameters e.g next to basics in the playbook navigation menu? Here is a screenshot from a test playbook I have:
I'm asking this because if you don't see that tab, you won't be able to implement your use-case, as you simply won't be able to pass the order_details parameter back to your flow.
This is still a private preview feature I believe, and you will need to request access to it via your sales contact.
If you do see the 'Parameters' tab, you' should be able to get this working with playbooks.
Your instructions look generally okay, but the first thing is you don't refer to parameters inside playbooks with the $session.params notation. Instead you define these as input and output parameters to the playbook. See the docs on passing parameters for details. You should change your playbook instructions accordingly. I'm also not sure how well the LLM will handle appending the additional order to the existing order details - you'll probably need to experiment with your instructions for that step.
It is then very important to provide several examples for the playbook, including the transition to the flow at the end. You'll need at least 3 examples before the LLM 'learns' how to handle the transition. You must also include the output parameters you want the playbook to pass to the flow in your examples. These are done right at the end of the playbook, should look something like this:
I can't really comment on choice of Routine vs Task playbook, as Routine playbooks are so new - they have only been available for about a week In principle, a Routine looks the the better choice for your ordering logic which is in a sequence. But just be aware this new feature may be particularly prone to bugs, so you may want to try with a task playbook instead.
While you definitely can get this to work with playbooks, you may need a lot of trail and error to refine the instructions and examples. A flow could handle the logic you have shown, and would be more reliable as it is deterministic. Either approach can work and have their trade-offs. If you need to get something working quickly, I think a flow-based agent may be more suitable.
PS I have done some testing myself, and it turns out you can only write to a session parameter from a routine playbook, not a task playbook. This is a breaking change with the introduction of routine playbooks. So you would need to use a routine for your use-case.