Based on Anthropic’s “Building Effective Agents” framework.

Parallelization executes independent tasks simultaneously rather than sequentially, improving both speed and quality through specialized processing. Tasks that don’t depend on each other can run concurrently, with results aggregated using various strategies like sectioning different concerns or voting for consensus-based decisions.

Client
Agent
Task A
Task B
request
parallel task A
parallel task B
result A
result B
aggregated response

When to Use

Use parallelization when you have independent tasks that can run simultaneously, such as content generation with safety checking, or multiple evaluations requiring consensus. It’s ideal when specialized processing improves quality and when speed gains from concurrency outweigh coordination overhead. Avoid when tasks have dependencies or when the aggregation complexity exceeds the benefits.

Implementation

This example demonstrates sectioning parallelization where appropriateness checking and main content generation run simultaneously, combining focused attention on different concerns with improved response time.

Agent Code

import { pickaxe } from "@hatchet-dev/pickaxe";
import z from "zod";
import { appropriatenessCheckTool } from "@tools/appropriateness.tool";
import { mainContentTool } from "@tools/main-content.tool";

const SectioningAgentInput = z.object({
  message: z.string(),
});

const SectioningAgentOutput = z.object({
  response: z.string(),
  isAppropriate: z.boolean(),
});

export const sectioningAgent = pickaxe.agent({
  name: "sectioning-agent",
  executionTimeout: "2m",
  inputSchema: SectioningAgentInput,
  outputSchema: SectioningAgentOutput,
  description: "Demonstrates parallel processing with sectioning approach",
  fn: async (input, ctx) => {
    // PARALLEL EXECUTION: Both tasks run simultaneously
    const [{ isAppropriate, reason }, { mainContent }] = await Promise.all([
      appropriatenessCheckTool.run({
        message: input.message,
      }),
      mainContentTool.run({
        message: input.message,
      }),
    ]);

    // AGGREGATION: Combine results based on appropriateness check
    if (!isAppropriate) {
      return {
        response: "I can't help with that request. Please ensure your message is appropriate and respectful.",
        isAppropriate: false,
      };
    }

    return {
      response: mainContent,
      isAppropriate: true,
    };
  },
});

The pattern uses Promise.all() to execute independent tasks simultaneously, then aggregates results based on the appropriateness evaluation. This approach provides both speed benefits and specialized processing, with each tool focusing on its specific concern without coordination overhead.

This pattern works well with routing for handling different request types and can be combined with evaluator-optimizer for iterative improvement workflows where multiple evaluators provide parallel feedback.