---
title: "Adding Steps"
description: "Each saga step has: Name : Identifier for the step Agent : The agent that executes the step Compensate : The agent that undoes the step Steps execute in the order they're added: Steps are sequential — each step runs only"
resource: https://www.aiagents.nexus/docs/manual/sagas/adding-steps
generated: { by: "process:nexus-agent-assets", at: 2026-09-07T09:13:03Z }
status: stable
---

# Adding Saga Steps

## Step Structure

Each saga step has:
- **Name**: Identifier for the step
- **Agent**: The agent that executes the step
- **Compensate**: The agent that undoes the step

## Adding Steps via CLI

```bash
naos saga add-step <saga-name> <step-name> --compensate <compensation-agent>
```

## Step Order

Steps execute in the order they're added:

```bash
naos saga add-step my-saga step-1 --compensate undo-1  # Runs first
naos saga add-step my-saga step-2 --compensate undo-2  # Runs second
naos saga add-step my-saga step-3 --compensate undo-3  # Runs third
```

## Step Dependencies

Steps are sequential — each step runs only after the previous step succeeds:

```
step-1 ✓ → step-2 ✓ → step-3 ✓ → saga complete
```

If any step fails, compensation runs in reverse:

```
step-1 ✓ → step-2 ✓ → step-3 ✗
                         ↓
              undo-2 ✓ → undo-1 ✓ → saga rolled back
```

## Steps Without Compensation

If a step doesn't need compensation (e.g., a read-only operation):

```bash
naos saga add-step my-saga read-data  # No --compensate flag
```

Steps without compensation are skipped during rollback.
