Nested Branching
Does anyone have a good example of how to do nested branching? I am seeing (probably old) info out there that says to create nested workflows, but its not working at all and I spent a good deal of my afternoon on this. My flow is simple and I would think this would be simple too. Agent calls tool that wraps a workflow. First step as an A or B path. If A it needs to run another tool and then it has another A B branch.
.branch([
[async ({ inputData }: { inputData: { intent: string } }) => inputData.intent === 'create', fullStep],
[async ({ inputData }: { inputData: { intent: string } }) => inputData.intent === 'refine', individualStep],
]);
Basically i fullStep to branch again. I may be bleary-eyed from staring at this, but its just not making sense right now..
Thanks!
2 Replies
You can use workflows in the place that you are using step inside the branch.
It would be something like:
π Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10153
π If you're experiencing an error, please provide a minimal reproducible example to help us resolve it quickly.
π Thank you @Neeman for helping us improve Mastra!
GitHub
Nested Branching Β· Issue #10153 Β· mastra-ai/mastra
This issue was created from Discord post 1439767057217486960: Does anyone have a good example of how to do nested branching? I am seeing (probably old) info out there that says to create nested wor...
Stack Overflow
How to create a Minimal, Reproducible Example - Help Center
Stack Overflow | The Worldβs Largest Online Community for Developers