Skip to main content
AI Actions provides ready-to-use AI operations for SuperDoc. Run natural-language commands to find, replace, insert tracked changes, and add comments while preserving the formatting of the content being edited—including heading levels and paragraph styles. Works with OpenAI, Anthropic, or custom providers. Includes the AI Planner for multi-step workflows and lower-level utilities for advanced use cases.

Quick start

Real-world examples:
Formatting results depend on the source DOCX styles; list indentation may vary and may require follow-up instructions.

What it does

AI Actions is SuperDoc’s high-level AI offering. It provides pre-built operations for common document automation tasks: Use insertTrackedChange when edits should be reviewed (e.g. legal or branding updates); use replace for final text changes.
  • AI-powered search, rewrites, and summaries
  • Tracked changes and comments created by an AI assistant
  • Bulk edits and repetitive automation
  • Multi-provider support (OpenAI, Anthropic, custom)
For low-level control and custom AI workflows, AI Builder is coming soon.

Capabilities

  • Natural-language operations - Find, replace, highlight, and manipulate content using plain English
  • Formatting-safe edits - Keeps existing Word headings, custom styles, and document structure intact while modifying text
  • Tracked changes & comments - AI-generated edits attributed to your configured AI user
  • Summaries & completions - Generate summaries or free-form content with streaming support
  • Provider-agnostic - Works with OpenAI, Anthropic, custom HTTP gateways, or custom providers
  • Lifecycle hooks - Real-time callbacks for streaming, errors, and readiness
  • AI Planner - Multi-step AI workflows with planning and execution capabilities
  • Advanced utilities - Lower-level exports for custom implementations and tool management
AI Actions operate on the document’s semantic structure (paragraphs, headings, lists) rather than regenerating layout, so existing styles are preserved unless explicitly changed by the instruction.

Lifecycle & readiness

Each action internally calls waitUntilReady, so explicit checks are only required when guarding UI or retry flows.

Error handling

Enable verbose logging by setting enableLogging: true. The package will emit parsing and traversal issues to console.error.

Advanced exports

The package exports additional utilities for advanced use cases:

Provider factory

AI Planner

For multi-step AI workflows with planning capabilities:

Service classes

For custom implementations, you can use the lower-level service classes:
  • AIActionsService - Core service class that provides AI-powered document actions
  • EditorAdapter - Adapter for SuperDoc editor operations, encapsulating editor-specific API calls

Tool utilities

Utilities for working with AI tools:

Type exports

The package exports TypeScript types including:
  • AIPlannerConfig, AIPlannerExecutionResult, AIPlan - Planner types
  • AIToolActions, SelectionRange, SelectionSnapshot - Tool and selection types
  • AIProviderInput, OpenAIProviderConfig, AnthropicProviderConfig, HttpProviderConfig - Provider configuration types
  • PlannerContextSnapshot, BuilderPlanResult - Advanced workflow types

Documentation

  • Configuration - Provider setup and configuration options
  • Methods - Instance methods and AI actions
  • Hooks - Lifecycle and streaming callbacks