# Running Blocks in Parallel for Workflow Optimization

{% embed url="<https://youtu.be/3KlJIKmdyPU>" %}

Running independent workflow blocks in parallel can significantly reduce execution time for your AI agents. This approach is especially beneficial when multiple tasks can be performed simultaneously without waiting for each other’s results.

### Example Scenario

An AI agent is designed to:

* Scrape multiple news websites
* Query Google News
* Generate an email digest with the top stories

By default, each block runs **sequentially**, causing unnecessary delays if the blocks aren't interdependent.

### Identifying Parallel-Ready Blocks

Look for blocks that:

* Perform independent operations
* Don’t rely on each other’s output

In this example, four blocks are scraping or querying different news sources. None depend on the output of the others, making them perfect candidates for parallel execution.

### How to Run Blocks in Parallel

1. **Select Blocks**\
   Highlight the blocks you want to run in parallel.
2. **Create a Group**\
   Right-click one of the blocks and select **Create Group**.
3. **Change to Parallel Execution**\
   Click the group label to toggle from **Sequential** to **Parallel**.

Now, these blocks will execute at the same time instead of waiting on one another.

### Performance Comparison

* **Sequential Run**: \~60 seconds
* **Parallel Run**: \~25 seconds

Parallelizing the scraping and news querying tasks led to a **58% reduction** in workflow execution time.

### Benefits

* **Speed Improvements**: Reduce total run time significantly.
* **Better User Experience**: Faster responses for time-sensitive tasks.
* **Scalability**: Makes workflows more efficient as complexity grows.

### Summary

To optimize your workflows:

* Identify independent tasks
* Group them into a parallel execution block
* Re-run and measure the performance impact

Using parallel execution in MindStudio can lead to major gains in efficiency, especially for content aggregation, multi-source processing, and automation workflows.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://university.mindstudio.ai/2-workflow-mastery/running-blocks-in-parallel-for-workflow-optimization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
