---
title: "Review and approval in Document Authoring AI"
canonical_url: "https://www.nutrient.io/guides/document-authoring/ai/review-and-approval/"
md_url: "https://www.nutrient.io/guides/document-authoring/ai/review-and-approval.md"
last_updated: "2026-06-12T18:57:15.093Z"
description: "Control how AI-generated edits apply in Edit, Review, and View mode."
---

# Review and approval

AI edits should respect the same review rules as everything else in your editor. The toolkit leaves that policy to your app. The model can request a write, but your code decides what to do with the request based on the editor’s current [`DocAuthEditorMode`](https://www.nutrient.io/api/document-authoring/types/docautheditormode/).

Document Authoring has three editor modes: Edit for full editing, Review for editing with tracked changes, and View for read-only viewing. Your app sets the mode with [`editor.setEditorMode`](https://www.nutrient.io/api/document-authoring/types/docautheditor/#seteditormode) and reads the current one with [`editor.getEditorMode`](https://www.nutrient.io/api/document-authoring/types/docautheditor/#geteditormode).

Tracked changes also need an author. Configure the editor author with [`editor.setAuthor`](https://www.nutrient.io/api/document-authoring/types/docautheditor/#setauthor) from your signed-in user before any AI write runs in Review mode. The toolkit reads [`editor.getAuthor`](https://www.nutrient.io/api/document-authoring/types/docautheditor/#getauthor) and falls back to `Anonymous` if none is set.

The default policy most apps want:

| Editor mode | Read tools   | Write tools                            |
| ----------- | ------------ | -------------------------------------- |
| Edit        | Run normally | Apply immediately                      |
| Review      | Run normally | Apply as tracked changes               |
| View        | Run normally | Block and ask the user to switch modes |

Read tools and `readWorkflowInput` never mutate the document, so they’re always safe to run.

## Mode policy in tool execution

Derive `writeMode` from the editor mode rather than asking the model to choose. The example below uses `isAiWriteToolName` to check capability and `executeTool` to run the call. How your app sends the error back to the model loop depends on your framework; see [Vercel AI SDK integration](https://www.nutrient.io/guides/document-authoring/ai/integrations/vercel-ai-sdk.md) for the integration details.

```ts

import { isAiWriteToolName } from "@nutrient-sdk/document-authoring-ai";

const editorMode = editor.getEditorMode();
const isWriteTool = isAiWriteToolName(rawCall.name);

if (isWriteTool && editorMode === "view") {
  return {
    ok: false,
    error: "The document is in View mode. Switch to Edit or Review mode before editing.",
  };
}

const executed = await toolkit.executeTool(rawCall, {
  writeMode: isWriteTool && editorMode === "review"? "track_changes"
    : "apply",
});

```

The returned `executed.execution` reports how the write landed: `effect: "applied"` for Edit mode and `effect: "applied_with_tracked_changes"` for Review mode.

## Review comments and tracked changes

Review comments are ordinary document [comment threads](https://www.nutrient.io/api/document-authoring/types/programmatic/commentthread/) created from a write tool’s optional `reviewComment` argument. They’re separate from Review mode and separate from tracked changes.

This distinction matters when you set up policy:

| Feature             | Controlled by                                                | What it creates                               |
| ------------------- | ------------------------------------------------------------ | --------------------------------------------- |
| Direct AI edit      | `writeMode: "apply"`                                         | An immediate document change                  |
| Review-mode AI edit | `writeMode: "track_changes"`                                 | A tracked-change revision                     |
| AI review comment   | `reviewComments: "create"` plus a write-tool `reviewComment` | A comment thread anchored to the changed text |

You can use review comments in either write mode. In Edit mode, the comment explains an already-applied edit. In Review mode, the comment explains the tracked-change suggestion. When `reviewComments` is disabled, `reviewComment` isn’t included in the tool schema, so the model won’t include it in calls, and the write result has no `reviewComment` field.

## Workflows

`applyWorkflowOutput` takes the same `writeMode` option, so workflow edits route through the same modes:

```ts

await toolkit.applyWorkflowOutput(workflow, output, {
  writeMode: editor.getEditorMode() === "review"? "track_changes"
    : "apply",
});

```

Workflows currently don’t consume `reviewComment`. Use agentic write tools when you want the model to attach reviewer-facing motivation comments to individual edits.

For where this fits into the rest of the integration, refer to the [overview](https://www.nutrient.io/guides/document-authoring/ai/overview.md), [agentic tools](https://www.nutrient.io/guides/document-authoring/ai/agentic-tools.md), and [Vercel AI SDK integration](https://www.nutrient.io/guides/document-authoring/ai/integrations/vercel-ai-sdk.md) guides.
---

## Related pages

- [Agentic tools](/guides/document-authoring/ai/agentic-tools.md)
- [Document Authoring AI](/guides/document-authoring/ai/overview.md)
- [Quick start](/guides/document-authoring/ai/quick-start.md)
- [Workflows](/guides/document-authoring/ai/workflows.md)

