Looping Jumpblock error

To file a bug ticket, please follow the steps below:

  1. Describe what happens in as many details as possible.
  2. Describe the intended behavior.
  3. Share a link to AI Agent where this bug occurs
  4. Attach any screenshots/screen recordings to help us replicate and run tests on our end
  1. This bot I have created (in most simple terms) is a bot that has 3 workflows. Workflow 1 (start) asks the user for a CSV input which is then formatted. The workflow then jumps to workflow 2 where the first row of the CSV of leads is processed, and the AI generates an email for that lead (which is stored), workflow 2 then jumps to workflow 3 where the second row of the CSV of leads is processed, and so on (so it loops between workflow 2 and 3). The workflow then ends when theres no more leads (rows of leads) to fetch in the CSV, where the workflow condition will then end the workflow where a final CSV with all the emails is outputted. Everything works perfectly except for one problem below.

  2. So the bot utilizes an indexIncrement variable to indicate which row it is on, and right now whenever the indexIncrement variable goes to 16-18 (so when the bot is on the 17th or 19th lead in the CSV), the workflow just runs into an error and does not jump anymore. So I suspect its an error rather than a workflow issue, since the workflow works (and compeltes the loop until the last row) completly fine if I input a CSV under 17 leads, but as soon as it goes over 17 then the workflow goes to error.

  3. https://app.mindstudio.ai/agents/vendai-20-3d09d4d6 (its private right now, if mindstudio admins can still enter just enter, if you need an invite tell me please)

  4. I attached a video with a test to show the jump error
    Video of bug

Hi @IvanLE3,

Based on what you’ve described, it sounds like a timeout issue. I’d recommend slightly restructuring your agent to use the Run Workflow block, which lets you process all rows in parallel. Here’s what it would look like:

  1. Main.flow: User Input to collect the CSV, a Custom Function block to convert it to JSON, then a Run Workflow block to launch a run for each item
  2. Sub-workflow: the steps from your current workflow 2

You can read more about the block here:

If you’d like me to look into your agent, please share a remix link so I can copy it to my workspace:

  1. Click the agent’s name at the top left of the editor
  2. Go to the Remixing tab
  3. Enable remixing and copy the link
  4. Publish the agent

Hi Alex, thanks for introducing this block. I think im able to take it from here to reconfigure my AI assistant now. I’ll tell you if theres any issues regarding the jumpblock later on. Thank you so much for looking into the problem!

@Alex_MindStudio
No more issues! In fact my workflow is not alot leaner thanks to the run block. I have almost half the function blocks now (since I don’t need the increment process). I already fixed all my initial problems.

Hi @Alex_MindStudio , I do have a slight problem though. My workflow works fine (if I put my run block to sequence), but theres a problem when I put my run block to parallel. So in the end of my repeating workflow, I have a function which takes the email’s subject and body, and adds both variables to a global variable at its correct position (based on what number the lead is). However, althought the function block is said to work fine in the debugger of every iteration (where it says the infomation is saved), I can see that every 2 iterations the function block will fail and not save the email values to the global variable (althought it says its succesful). I realised that this pattern of which workflow fails to save the email values is random, and I know its a problem with the function block (the function of saving to a global variable), so my guess is that its because they are all running at once and so if the function block is being ran in many different workflows at once, then some of them glitch and don’t perform the function. Any way to solve this you think?

Not an instant problem since I can run in sequence for now (and it works fine), but I do want to solve this since running in parallel is much faster.

@Alex_MindStudio
Here is a video with a test, outlining the problem.

Hi @IvanLE3,

This could indeed be the problem, since parallel runs can be updating the global variable at the same time. Could you clarify why you’re saving the email subject and body to a global variable?

The reason I’m asking is that global variables are designed to persist data between different agent runs (not sub-workflow runs). A common example is an agent that scrapes a competitor’s website daily and saves the content to a global variable so it can compare fresh data against the previous day’s to identify any changes.

Updating a global variable within parallel sub-workflow runs isn’t recommended. If you do need to save content to a global variable, it’s best to do that after the sub-workflow finishes processing all items in your original JSON.

That said, it may not even be necessary. The output of all parallel runs gets saved to the output variable you specify in the Run Workflow block and becomes accessible in your main workflow.

Just in case, here’s a sample agent with a Run Workflow block you can copy to your workspace to review:
https://app.mindstudio.ai/agents/run-workflow-block-with-a-json-array-input-iterator-f3bfba48/remix

Hi @Alex_MindStudio ,

So my end goal is to inject two new columns into my CSV (email body and email subject) where each row has its own values. And after debugging alot with AI (and Mindstudio AI) (im not a coder btw), I realised the best way is too save all the email data to a email data global variable, then using the email data global variable to add to my original CSV (to make the final CSV global variable with the two new columns).

Edit: And now I realised that the run block already does this for you, and adds all the results into an organized variable. So I’ll use that instead, thank you!

Hi @IvanLE3,

Thanks for the clarification!

Just in case, here’s a remix link to a sample agent based on what you’ve described:
https://app.mindstudio.ai/agents/email-per-lead-000c0f82/remix