Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
seo:
title: Use AI to turn API monitoring failures into documentation fixes
description: When Respect alerts fire, classify production versus workflow versus docs with AI, then land a small documentation PR and wait for the next green run.
---

# Use AI to turn API monitoring failures into documentation fixes

## Key takeaways

- A Respect Monitoring alert tells you that something diverged from the OpenAPI description, but it does not explain why, and it does not say whether the fix belongs in the API, the Arazzo workflow, or the documentation.
- A useful triage prompt needs three inputs: the full failure output, the matching OpenAPI or Arazzo snippet, and the current documentation section under review.
- AI triage sorts a failure into one of three buckets: a production regression, a weak success criterion in the workflow, or documentation that never matched reality.
- Once triage points at the docs, draft the fix and route it through a Git-based pull request workflow so it gets the same review as any other content change.
- Pairing scheduled Arazzo runs with a recurring AI-assisted review cadence keeps the failure-to-fix loop routine instead of a one-off cleanup.

Most docs orgs have felt this moment: a Respect Monitoring alert lands in Slack or email, the workflow name looks familiar, and the failure message reads like a foreign language. Something diverged from what the OpenAPI description promised, but the alert itself does not explain why, and it does not say whether the fix belongs in the API, in the Arazzo workflow that tests it, or in the documentation that describes it to people. This article picks up where [detecting drift between your docs and your live API](https://redocly.com/learn/ai-for-docs/ai-detect-drift-docs-live-api) leaves off, at the point where the alert has already fired and someone has to decide what to do about it.

## The gap between an alert and a fix

An unmonitored API tends to drift over time. Endpoints change behavior, a team ships a patch under pressure, and nobody circles back to the docs until a support ticket points out that the example in the reference no longer works. Respect Monitoring exists to shrink that gap: it surfaces [unexpected status codes and schema mismatches that break integrations silently](https://redocly.com/blog/respect), often well before a customer notices. Catching drift and understanding it, though, are two different problems.

Teams that have run contract tests against live APIs know the story where [dashboards stayed green while a dropped field broke the mobile app](https://redocly.com/blog/api-contract-testing-arazzo) anyway, because the assertion covered the wrong thing. The reverse also happens: [the description said one thing and the API did another](https://redocly.com/blog/catch-api-drift), and the workflow correctly flagged it, but nobody was sure whether the API had regressed or the documentation had simply gone stale first. Both stories point at the same lesson. A failing check is a signal, not a diagnosis, and turning that signal into a merged fix still takes judgment.

## What a Respect Monitoring failure contains

Before reaching for AI, it helps to look closely at what a failure gives you. Respect Monitoring [checks your API responses against what the OpenAPI description says](https://redocly.com/docs/respect), running the Arazzo workflow you configured and comparing each step's result against its declared success criteria. When a step fails, the output usually includes the workflow name, the specific step, the expected value drawn from the spec, and the value returned by the live API.

That output is useful, but it rarely tells the whole story on its own. A single failure might represent a genuine regression in production, a workflow assertion that was too strict or too loose to begin with, or documentation that quietly fell out of sync with an API that has since moved on. Reviewing some of the [common patterns for what a monitoring failure is telling you](https://redocly.com/docs/respect/use-cases) before you triage helps set expectations for how often each of these three outcomes shows up. Respect Monitoring also supports [real-time alerts via Slack or email](https://redocly.com/respect), so the failure typically reaches a team channel well before anyone has opened the workflow file directly.

## Prompting AI with the right three inputs

Handing an AI assistant the raw failure message alone is a bit like asking a colleague to fix a bug from a one-line error log. It can guess, but guessing is not the goal here. The more reliable pattern is to gather three specific things before prompting.

### The three inputs checklist

- The full failure output from Respect Monitoring, including the workflow name, step name, expected value, and actual value.
- The matching OpenAPI or Arazzo snippet: the exact schema, parameter, or success criterion the step was checking.
- The current documentation section that describes the same endpoint or workflow, copied as it exists today.

With those three in hand, a prompt along these lines gives the assistant something concrete to reason about:

```text
Here is a Respect Monitoring failure:
[paste failure output]

Here is the OpenAPI/Arazzo snippet the step is checking:
[paste snippet]

Here is the current documentation section describing this behavior:
[paste docs section]

Compare these three. Does the failure suggest the API changed and
the docs need to catch up, the workflow's success criterion is
wrong for what the API actually guarantees, or the documentation
was already inaccurate before this run? Explain your reasoning
before recommending a fix.
```

Asking for reasoning before a recommendation matters more than it might seem, since it gives a technical writer or platform engineer something to check against, rather than a fix to accept on faith.

## Letting AI triage before writing anything

With those three inputs gathered into a single prompt, AI can usually sort a failure into one of three buckets, and it helps to resist writing anything until that sorting is settled.

The first bucket is a production regression, where the API itself changed behavior in a way nobody intended, so the fix belongs in the code rather than the docs. The second is a weak success criterion, where the Arazzo workflow's definition of [what counts as a failed step in the workflow](https://redocly.com/learn/arazzo/success-criteria-and-failure-handling) was too strict, too loose, or checking the wrong field entirely, so the workflow needs adjusting instead of the docs or the API. The third is stale documentation, where the API and the workflow both behave as designed, but the written description simply never caught up.

> Before: "Response includes a `discount_code` field for all eligible orders."
> After (based on the failure and the current spec): "Response includes a `discount_code` field for orders placed after account verification. Unverified accounts receive `null`."

That kind of before/after pairing is often the clearest evidence that a failure belonged in the third bucket all along, since the documentation was describing a simpler API than the one the spec and the live behavior now agree on.

## Turning the triage into a docs pull request

Once triage points at the documentation, the next step is turning that judgment into something reviewable rather than a note in a chat thread. Draft the updated section using the same OpenAPI snippet the AI compared against, then route it through the Git-based workflow already in place for docs changes, [opening a pull request for the doc fix](https://redocly.com/docs/realm/reunite/project/pull-request/open-pull-request) so a second set of eyes can confirm the wording matches the spec before it merges. Keeping the change small and scoped to the one section the failure actually touched makes that review faster and lowers the chance of introducing a new inconsistency elsewhere on the page.

## Closing the loop on a schedule

Triage that AI has handled well once tends to be worth repeating on a schedule, rather than only when an alert happens to fire. Respect Monitoring already supports [scheduled monitoring workflows inside your project workspace](https://redocly.com/docs/realm/reunite/project/respect-monitoring), and [configuring which workflows run on a schedule](https://redocly.com/docs/realm/reunite/project/respect-monitoring/configure-respect-monitoring) makes it possible to pair that cadence with a recurring review, where someone walks through the last batch of failures, runs each one through the same three-input prompt, and opens whatever doc pull requests the triage surfaces. Some teams also find it worth revisiting how they [manage monitoring once it's
running](https://redocly.com/docs/realm/reunite/project/respect-monitoring/manage-respect-monitoring), since workflows that made sense a quarter ago may need new assertions as the API keeps changing. The goal is not to catch every instance of drift instantly, but to make the failure-to-fix loop routine enough that documentation stops falling behind unnoticed.

## FAQs

**Does a Respect Monitoring alert tell me what to fix?**
Not on its own. It tells you that a step's result diverged from what the OpenAPI description promised, but deciding whether the fix belongs in the API, the Arazzo workflow, or the documentation still takes triage.

**What should I paste into an AI assistant to triage a failure?**
Three things: the full failure output, the matching OpenAPI or Arazzo snippet the step was checking, and the current documentation section describing the same behavior. Together they give the assistant enough context to reason about the cause rather than guess at it.

**What are the possible outcomes of AI triage?**
A failure usually sorts into one of three buckets: a production regression that needs a code fix, a weak or miscalibrated success criterion in the Arazzo workflow, or documentation that never matched reality and simply needs updating.

**How does a documentation fix get merged?**
Once triage points at the docs, draft the update using the same spec snippet the AI compared against, then open a pull request for the doc fix so it goes through the same Git-based review path as any other content change.

**How often should this triage loop run?**
Rather than treating it as a one-off cleanup, pair scheduled monitoring workflows with a recurring review cadence, so each new batch of failures gets the same three-input prompt and any resulting doc pull requests get opened routinely.

**How do I get notified when a workflow fails in the first place?**
Respect Monitoring supports real-time alerts via Slack or email, so a failing step reaches a team channel as soon as it happens, well before anyone opens the workflow file directly.

## How Redocly can help

Respect Monitoring is built to produce exactly the kind of failure output this triage loop depends on, including [real-time alerts via Slack or email](https://redocly.com/respect) the moment a workflow step diverges from the OpenAPI description. Paired with Reunite's Git-based review workflow, that becomes a full path from drift and failure alerts feeding into a Git-based docs PR workflow, so a triaged failure turns into a reviewed pull request instead of a note nobody follows up on.
2 changes: 2 additions & 0 deletions learn/ai-for-docs/sidebars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
label: Use AI to find gaps in your documentation coverage
- page: ai-detect-drift-docs-live-api.md
label: Use AI to detect drift between your docs and your live API
- page: ai-turn-api-monitoring-failures-into-documentation-fixes.md
label: Use AI to turn API monitoring failures into documentation fixes
- page: ai-find-duplicate-underused-apis.md
label: Use AI to find duplicate and underused APIs in your codebase
- page: ai-build-searchable-api-catalog.md
Expand Down
Loading