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

# Suggest a Fix

> Ask for a prompt change that would make a failed test attempt pass.

Preparing a suggestion takes time, especially for agents with long prompts, so this starts the work and waits up to 105 seconds. If the suggestion is ready in that time it is returned directly; if not, the response is `status: running` and you fetch it with Get Suggested Fix.

Pass `wait=0` to skip the wait and always get `status: running` straight away. This is the recommended pattern, because the request never depends on how long preparation takes.

Asking again while a suggestion is already being prepared joins the one in progress instead of starting another, and a suggestion prepared within the last 10 minutes is returned immediately, so repeating a request after a timeout is instant. Suggestions are available for failed attempts only.



## OpenAPI

````yaml POST /test-suites/{id}/attempts/{attemptId}/suggest-fix
openapi: 3.1.0
info:
  title: RevRing Voice AI API
  description: >-
    RevRing Voice AI platform API for managing AI voice agents, phone calls, SIP
    trunks, and analytics. Build intelligent voice applications that can handle
    inbound and outbound phone calls with AI-powered conversational agents.
  version: 1.0.0
  contact:
    name: RevRing Support
    url: https://revring.ai
servers:
  - url: https://api.revring.ai/v1
    description: Production API
security:
  - apiKeyAuth: []
tags:
  - name: Messaging Connections
    description: Connect messaging providers so agents can send text messages
  - name: Messages
    description: Send text messages and read your message log
  - name: Conversations
    description: List and clear managed conversation threads
  - name: SIP Trunks
    description: Manage SIP trunks for connecting agents to the phone network
  - name: Agents
    description: Manage AI voice agents and their configuration
  - name: Agent Folders
    description: Organize agents into folders for dashboard navigation
  - name: Calls
    description: Manage and query phone calls
  - name: Analytics
    description: Get analytics and metrics about your calls
  - name: Knowledge Bases
    description: >-
      Manage knowledge bases and sources for agent retrieval-augmented
      generation
  - name: Test Suites
    description: Manage test suites, test cases, and test runs for agent evaluation
  - name: Voices
    description: Browse the voices available to your organization for agent speech
paths:
  /test-suites/{id}/attempts/{attemptId}/suggest-fix:
    parameters:
      - name: id
        in: path
        required: true
        description: Test suite ID
        schema:
          type: string
          format: uuid
      - name: attemptId
        in: path
        required: true
        description: Test attempt ID, from a test run's `attempts`
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Test Suites
      summary: Suggest a Fix
      description: >-
        Ask for a prompt change that would make a failed test attempt pass.


        Preparing a suggestion takes time, especially for agents with long
        prompts, so this starts the work and waits up to 105 seconds. If the
        suggestion is ready in that time it is returned directly; if not, the
        response is `status: running` and you fetch it with Get Suggested Fix.


        Pass `wait=0` to skip the wait and always get `status: running` straight
        away. This is the recommended pattern, because the request never depends
        on how long preparation takes.


        Asking again while a suggestion is already being prepared joins the one
        in progress instead of starting another, and a suggestion prepared
        within the last 10 minutes is returned immediately, so repeating a
        request after a timeout is instant. Suggestions are available for failed
        attempts only.
      operationId: suggestFix
      parameters:
        - name: wait
          in: query
          required: false
          description: >-
            Set to `0` to return immediately instead of waiting for the
            suggestion.
          schema:
            type: string
            enum:
              - '0'
      responses:
        '200':
          description: >-
            The suggestion, when it was ready in time. The suggestion fields are
            also present at the top level of `data`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/SuggestedFix'
        '202':
          description: >-
            The suggestion is being prepared. Poll Get Suggested Fix until
            `status` is `ready`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/SuggestedFix'
        '400':
          description: The attempt did not fail, so there is nothing to fix
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          $ref: '#/components/responses/NotFoundError'
components:
  schemas:
    SuggestedFix:
      type: object
      description: A proposed prompt change that would make a failed test pass.
      properties:
        status:
          type: string
          enum:
            - idle
            - running
            - ready
            - failed
          description: >-
            `idle` = none requested for this attempt. `running` = being
            prepared. `ready` = `result` holds the suggestion. `failed` = could
            not be prepared, request another.
        result:
          type: object
          nullable: true
          description: The suggestion. Present when `status` is `ready`, otherwise null.
          properties:
            analysis:
              type: string
              description: Why the test failed
            changesSummary:
              type: array
              items:
                type: string
              description: Plain-language summary of what was changed
            suggestedPrompt:
              type: string
              description: The complete corrected prompt, ready to save to the agent
            currentPrompt:
              type: string
              description: >-
                The agent prompt the suggestion was written against, for
                comparison
            rubricIssues:
              type: array
              items:
                type: string
              description: Problems found in the test's pass criteria, if any
  responses:
    UnauthorizedError:
      description: Authentication required or API key invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: unauthorized
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: not_found
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Generate API keys from the RevRing
        dashboard.

````