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

# AI Retries / Prompt Edits

> Sometimes quick manual edits of (AI-generated) content are the best way to get the result you want. And that's what our in-place editing is for. But other times you need broader changes of a text, or manual edits are simply not an option - think images, videos, or audio. By enabling retry buttons for a field, you can let your reviewers request changes - by retrying or even changing a given prompt.

### Enable retry buttons

In your review template, you can enable retries in the settings of most field types like text, images, or markdown.

<img src="https://mintcdn.com/gotohuman/V7vXOF0y9-ASap_X/images/img/docs-ai-retry-setting.jpg?fit=max&auto=format&n=V7vXOF0y9-ASap_X&q=85&s=9d1beb3c27c5fd28f2e4421ba81a4967" alt="gotoHuman - Allow retries" width="576" height="178" data-path="images/img/docs-ai-retry-setting.jpg" />

### Requesting retries during reviews

In the review UI, this will add retry controls below the field.

<img src="https://mintcdn.com/gotohuman/V7vXOF0y9-ASap_X/images/img/docs-ai-controls.jpg?fit=max&auto=format&n=V7vXOF0y9-ASap_X&q=85&s=92d64d630d647099955d299f688e7274" alt="gotoHuman - Retry buttons" width="454" height="685" data-path="images/img/docs-ai-controls.jpg" />

The chat button will open a modal where the reviewer is able to iterate on the field's content (i.e. the artifact) by retrying or changing the prompt. They can always go back and forth between different generated versions of the artifact, so they can safely give it another try without losing previous results.

<img src="https://mintcdn.com/gotohuman/V7vXOF0y9-ASap_X/images/img/docs-ai-chat.jpg?fit=max&auto=format&n=V7vXOF0y9-ASap_X&q=85&s=62f18ab63966554fa78a84fd5ea24ee9" alt="gotoHuman - AI chat" width="1166" height="868" data-path="images/img/docs-ai-chat.jpg" />

### Connect to your workflow

To make the AI retry feature work, you need to support the webhook that is triggered when a reviewer requests a retry. After regenerating the artifact, you'll need to update the review request with the new artifact.

#### Allow editing the prompt (optional)

For the prompt to show up in the chat and to allow editing it, you need to pass it in your review request in the following format:

```
{  ...  "fields": {    ...    "blog": {      "ai": {        "prompt": "Write a blog post about the following..."      },      "content": "..." // the value(s) you'd usually send for this field    }  }}
```

This can simply be the initial prompt, even when you're updating the review request after a prompt edit by the reviewer (s. below). We are only processing this for the initial request.

#### Handle retry webhook

Clicking the retry button or editing the prompt will trigger the webhook you set up for this review template with a `"type": "chat"`. If you passed a prompt in your review request, the webhook will also include a `messages` array with the (maybe edited) prompt as the first message. Until we support full chat conversations, this is the only message you'll get.

<Info>
  Our n8n node handles the webhook internally, so the webhook data below will be the output of the node.
</Info>

```
[  {    "type": "chat",    "event": "retry",    "accountId": "hlSXkGN5z6CxsSA48IYj",    "formId": "OuIlLGMQCcBtwkwbZmKn",    "reviewId": "lBkTFbmXN2YfA1tCMYHm",    "fieldId": "postDraft",    "createdAt": "2025-08-12T22:27:39.051Z",    "messages": [      {        "role": "human",        "content": "You will be passed a scraped article from a company blog. I'm a fan of their product and will write a LinkedIn post for every news that is coming out. Please write an engaging post based on the article."      }    ],    "gthLinkToReview": "https://app.gotohuman.com/accounts/hlSXkGN5z6CxsSA48IYj/inbox/agents/all/reviews/lBkTFbmXN2YfA1tCMYHm"  }]
```

### Update review request

After regenerating the artifact (content) of this field in response to the retry webhook, you need to update the review request with the new artifact. For simplicity you can **send the same request** as for your inital request for review, only **adding the ID of the review** to update.

<Tabs>
  <Tab title="n8n">
    <Check>
      See it in action in one of our n8n workflow templates: [n8n AI Email Agent](https://n8n.io/workflows/7301-classify-emails-and-send-replies-with-gpt-4o-and-gotohuman-for-supervision/), [n8n LinkedIn AI Agent](https://n8n.io/workflows/7310-scrape-blog-articles-into-ai-generated-linkedin-posts-with-gpt-4o-and-human-review/), or the more advanced [n8n AI Promo Video Creator](https://n8n.io/workflows/7196-generate-ai-promo-videos-for-products-with-gpt-4o-falai-and-human-supervision/)
    </Check>
  </Tab>

  <Tab title="Make">
    Select **Additional Fields > Add Field** and add the field **Update for Review ID**, where you can enter or map the ID of the review to update.
  </Tab>

  <Tab title="Python SDK">
    Your flow will typically look like this:
  </Tab>

  <Tab title="JS/TS SDK">
    <img src="https://mintcdn.com/gotohuman/V7vXOF0y9-ASap_X/images/img/docs-ai-retry-n8n-loop.jpg?fit=max&auto=format&n=V7vXOF0y9-ASap_X&q=85&s=48ea5006a7c04c35d907d02eba4430c4" alt="gotoHuman - n8n loop" width="1668" height="893" data-path="images/img/docs-ai-retry-n8n-loop.jpg" />
  </Tab>

  <Tab title="HTTP">
    Switch node with these rules:
  </Tab>

  <Tab title>
    * `{{ $json.response }}` is equal to "approved"
    * `{{ $json.response }}` is equal to "rejected"
    * `{{ $json.type }}` is equal to "chat"
  </Tab>

  <Tab title>
    "Retry" Set Fields node (Manual mapping):
  </Tab>

  <Tab title>
    * "prompt" (String) = `{{ $json.messages[0].content }}`
    * "reviewToUpdate" (String) = `{{ $json.reviewId }}`
  </Tab>

  <Tab title>
    AI Draft Node:
  </Tab>

  <Tab title>
    * It can simply reference `{{ $json.prompt }}` because the "Set Initial Prompt" node and the "Retry" node both expose a "prompt" field
  </Tab>

  <Tab title>
    gotoHuman node:
  </Tab>

  <Tab title>
    * "Update for Review ID" = `{{ $('Retry').isExecuted ? $('Retry').item.json.reviewToUpdate : null }}`
  </Tab>

  <Tab title>
    Read more in our [n8n integration guide](/Integrations/n8n).
  </Tab>

  <Tab title>
    Select **Show advanced settings** to show the field **Update for Review ID**, where you can enter or map the ID of the review to update.
  </Tab>

  <Tab title>
    Read more in our [Make integration guide](/Integrations/make-com).
  </Tab>

  <Tab title>
    ```
      review = gotoHuman.create_review("ib41P20UBPLpEfwH7CkL") // ID of form/review template  review.update_for_review("iVcm4fwRPihAdVnZ7v0d") // <-- ID of the review  review.add_field_data("blog", "My blog post regenerated by the LLM to be shorter.")  review.add_field_data("imageOptions", [        {          "url": "https://cdn.example.com/my-regenerated-image3.jpg"        },        {          "url": "https://cdn.example.com/my-regenerated-image4.jpg"        }      ])  // add other fields  try:      response = review.send_request()      print("Review sent successfully:", response)  except Exception as e:      print("An error occurred:", e)
    ```
  </Tab>

  <Tab title>
    Create a request with the formId of the form you created. Pass the field values and optionally some meta data.
  </Tab>

  <Tab title>
    ```
      const reviewRequest = gotoHuman.createReview("ib41P20UBPLpEfwH7CkL") // ID of form/review template      .updateForReview("iVcm4fwRPihAdVnZ7v0d") // <-- ID of the review      .addFieldData("blog", "My blog post regenerated by the LLM to be shorter.")      .addFieldData("imageOptions", [        {          "url": "https://cdn.example.com/my-regenerated-image3.jpg"        },        {          "url": "https://cdn.example.com/my-regenerated-image4.jpg"        }      ])      // add other fields  await reviewRequest.sendRequest()
    ```
  </Tab>

  <Tab title>
    The structure of your API request is
  </Tab>

  <Tab title>
    ```
    {  "formId": "ib41P20UBPLpEfwH7CkL", // ID of form/review template  "updateForReviewId": "iVcm4fwRPihAdVnZ7v0d", // <-- ID of the review  "fields": {      "blog": "My blog post regenerated by the LLM to be shorter.",      "imageOptions": [        {          "url": "https://cdn.example.com/my-regenerated-image3.jpg"        },        {          "url": "https://cdn.example.com/my-regenerated-image4.jpg"        }      ],      // add other fields  }}
    ```
  </Tab>
</Tabs>
