Skip to main content

Overview

Parallelization is a workflow pattern where multiple tasks or processes run simultaneously instead of sequentially, allowing for more efficient use of resources and faster overall execution. It’s particularly valuable when different parts of a task can be handled independently, such as running content analysis and response generation at the same time. Parallelization

Example task

In this example, we’ll create a workflow that simultaneously checks content for issues while responding to customer inquiries. This approach is particularly effective when tasks require multiple perspectives or parallel processing streams, with the orchestrator synthesizing the results into a cohesive output. This task:
  • Uses generateText from the AI SDK to call Anthropic’s Claude models
  • Uses experimental_telemetry to surface each LLM call on the Run page in the dashboard
  • Uses batch.triggerByTaskAndWait to run customer response and content moderation tasks in parallel
  • Answers with claude-sonnet-4-5 and moderates with the faster, cheaper claude-haiku-4-5
  • Simultaneously checks for inappropriate content while generating responses

Run a test

On the Test page in the dashboard, select the handle-customer-question task and include a payload like the following:
When triggered with a question, the task simultaneously generates a response while checking for inappropriate content using two parallel LLM calls. The main task waits for both operations to complete before delivering the final response.