---
title: "Static Parallel Steps"
description: "Run a fixed set of distinct Step types at the same time. Use it when each branch has a known job and input type, such as charging a payment and reserving stock for one order."
canonical_url: "https://docs.superdurable.io/design-patterns/parallel/static-parallel-steps/"
source: "docs/content/design-patterns/parallel/static.mdx"
locale: "en"
language: "python"
---

> Index of every page for AI agents: https://docs.superdurable.io/llms.txt

# Static Parallel Steps

Code on this page is in Python. Other languages: [Go](https://docs.superdurable.io/design-patterns/parallel/static-parallel-steps.go.md) · [Java](https://docs.superdurable.io/design-patterns/parallel/static-parallel-steps.java.md) · [TypeScript](https://docs.superdurable.io/design-patterns/parallel/static-parallel-steps.typescript.md) · [Rust](https://docs.superdurable.io/design-patterns/parallel/static-parallel-steps.rust.md)

Run a fixed set of distinct Step types at the same time. Use it when each branch has a known job and input type, such as charging a payment and reserving stock for one order.

**Flow graph: StaticParallelStepsFlow**

**Steps**

1. `InitStep` (start Step): Start work A and work B in parallel. Next: `WorkA`, or `WorkB`.
2. `WorkA`: Do work A. Next: the Flow completes.
3. `WorkB`: Do work B. Next: the Flow completes.

Example: [examples/python/dex_examples/patterns/parallel/static_parallel_steps_flow.py](https://github.com/superdurable/dex/tree/main/examples/python/dex_examples/patterns/parallel/static_parallel_steps_flow.py)

## How it works

In the graph, **InitStep** returns one movement for `WorkA` and one for `WorkB` in a single decision. Dex runs both at the same time, and each completes on its own. Add a join only when a later Step needs their results; see [Await Parallel Steps](https://docs.superdurable.io/design-patterns/parallel/await-parallel-steps.md).

Prefer one domain-named Step type per fixed kind of work, even when the branches look alike. The graph then shows each kind, and each can have its own options and failure route. A single Step type with a kind field hides them.

## Core implementation

**Python**

```python
class WorkA(Step[str]):
    def execute(self, context: Context, input: str) -> StepDecision:
        return graceful_complete(f"A:{input}")


class WorkB(Step[str]):
    def execute(self, context: Context, input: str) -> StepDecision:
        return graceful_complete(f"B:{input}")


class InitStep(Step[str]):
    def execute(self, context: Context, input: str) -> StepDecision:
        return go_to_many(
            StepMovement.of(WorkA, input),
            StepMovement.of(WorkB, input),
        )
```

Example: [examples/python/dex_examples/patterns/parallel/static_parallel_steps_flow.py](https://github.com/superdurable/dex/tree/main/examples/python/dex_examples/patterns/parallel/static_parallel_steps_flow.py)

## Next

- [Dynamic Parallel Steps](https://docs.superdurable.io/design-patterns/parallel/dynamic-parallel-steps.md)
- [Parallel Steps](https://docs.superdurable.io/design-patterns.md#parallel)
