> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrubbe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analyse Incidents with Ezra's AI Pipeline

> Use Ezra's four-stage reasoning pipeline to analyse incidents, generate audience-targeted reports, and feed outcomes back to improve future analysis.

Ezra is Scrubbe's AI reasoning engine. When you point it at an incident, it runs a four-stage pipeline — ingesting signals, forming hypotheses, mapping impact, and generating remediation options — then surfaces its findings as a structured analysis. From that analysis, you can produce a written report for either an engineering audience or a leadership audience, and feed the eventual outcome back so Ezra learns from each event. This guide walks through the full Ezra workflow: analysing an incident, reading the output, generating reports, and closing the learning loop.

## Prerequisites

* A valid API key with Ezra access enabled
* An incident ticket with sufficient detail — `techDescription`, `impactSummary`, and `blastRadius` all improve Ezra's output (see [Manage Incidents](/guides/manage-incidents))

***

## Trigger an analysis

Submit an incident to Ezra for analysis. This initiates the four-stage reasoning pipeline. The call is asynchronous — Ezra processes the incident and stores the result for retrieval.

```bash theme={null}
curl -X POST https://api.scrubbe.io/api/v1/ezra/analyse \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "incidentId": "<incidentId>"
  }'
```

The response confirms the analysis has been queued and returns the `incidentId` as a reference key.

<Tip>Trigger analysis as soon as an incident is created — Ezra can begin forming hypotheses while your team is still responding, giving you early direction on likely root causes.</Tip>

***

## Retrieve the analysis

Once Ezra has completed the pipeline, fetch the full analysis by incident ID. The output includes hypotheses, impact assessment, and ranked remediation options.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/ezra/analysis/<incidentId> \
  -H "Authorization: Bearer <token>"
```

If the analysis is still processing, the response will indicate a pending state. Poll this endpoint until the status is complete.

***

## List all analyses

Review all Ezra analyses across your workspace — useful for retrospectives and identifying recurring patterns.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/ezra/analyses \
  -H "Authorization: Bearer <token>"
```

***

## Generate a report

Turn an Ezra analysis into a written report tailored to your audience. Choose `ENGINEER` for a technical deep-dive or `LEADERSHIP` for an executive-level summary.

<Tabs>
  <Tab title="Engineer report">
    The engineer report includes technical hypotheses, root cause reasoning, system-level impact, and specific remediation steps.

    ```bash theme={null}
    curl -X POST https://api.scrubbe.io/api/v1/ezra/report \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{
        "analysisId": "<analysisId>",
        "audience": "ENGINEER"
      }'
    ```
  </Tab>

  <Tab title="Leadership report">
    The leadership report uses plain language to describe the business impact, customer effect, and resolution timeline — no internal technical detail.

    ```bash theme={null}
    curl -X POST https://api.scrubbe.io/api/v1/ezra/report \
      -H "Authorization: Bearer <token>" \
      -H "Content-Type: application/json" \
      -d '{
        "analysisId": "<analysisId>",
        "audience": "LEADERSHIP"
      }'
    ```
  </Tab>
</Tabs>

<Note>The `analysisId` comes from the analysis response, not the `incidentId`. Retrieve the analysis first to get the correct ID.</Note>

***

## Submit an outcome

After the incident is resolved, tell Ezra what actually happened. This feedback feeds back into Ezra's reasoning model, improving the quality of future analyses for similar incidents.

```bash theme={null}
curl -X POST https://api.scrubbe.io/api/v1/ezra/learn \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "incidentId": "<incidentId>",
    "outcome": "RESOLVED"
  }'
```

| Outcome value | When to use                                                     |
| ------------- | --------------------------------------------------------------- |
| `RESOLVED`    | The incident was fully mitigated and systems returned to normal |
| `MITIGATED`   | Impact was reduced but the underlying issue persists            |
| `DEGRADED`    | Ezra's remediations partially helped but the situation worsened |
| `WORSENED`    | Actions taken made the incident worse                           |
| `NEUTRAL`     | The outcome was unrelated to Ezra's suggestions                 |

<Tip>Submitting outcomes is the single most effective way to improve Ezra's analysis quality over time. Make it part of your post-incident checklist.</Tip>

***

## View learned patterns

Ezra identifies recurring patterns across incidents — similar failure modes, common root causes, and high-frequency service interactions. Use these patterns to prioritise reliability investments.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/ezra/patterns \
  -H "Authorization: Bearer <token>"
```

***

## Recommended Ezra workflow

<Steps>
  <Step title="Create the incident">
    Open a ticket via `POST /api/v1/incident-ticket` with as much technical context as available.
  </Step>

  <Step title="Trigger analysis">
    Call `POST /api/v1/ezra/analyse` with the `incidentId` immediately after creation.
  </Step>

  <Step title="Read the analysis">
    Poll `GET /api/v1/ezra/analysis/:incidentId` until complete, then review Ezra's hypotheses and remediation options with your team.
  </Step>

  <Step title="Generate reports">
    Produce an `ENGINEER` report for the response team and a `LEADERSHIP` report for stakeholders via `POST /api/v1/ezra/report`.
  </Step>

  <Step title="Close the loop">
    After resolution, submit the outcome via `POST /api/v1/ezra/learn` so Ezra can incorporate the result into future reasoning.
  </Step>
</Steps>
