This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/document-authoring/ai/review-and-approval.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Review and approval in Document Authoring AI

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.

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 and reads the current one with editor.getEditorMode.

Tracked changes also need an author. Configure the editor author with editor.setAuthor from your signed-in user before any AI write runs in Review mode. The toolkit reads editor.getAuthor and falls back to Anonymous if none is set.

The default policy most apps want:

Editor modeRead toolsWrite tools
EditRun normallyApply immediately
ReviewRun normallyApply as tracked changes
ViewRun normallyBlock 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 for the integration details.

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 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:

FeatureControlled byWhat it creates
Direct AI editwriteMode: "apply"An immediate document change
Review-mode AI editwriteMode: "track_changes"A tracked-change revision
AI review commentreviewComments: "create" plus a write-tool reviewCommentA 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:

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, agentic tools, and Vercel AI SDK integration guides.