Document Generation Overview

Document Generation enables AI Employees to produce documents asynchronously. Unlike chat (real-time) or dashboard (batch processing), document generation follows an async lifecycle where a request is submitted, processed in the background, and the result is retrieved when ready.

Async Lifecycle

Document generation follows a state machine with four statuses:

TRIGGERED → PROCESSING → COMPLETED
 → FAILED
StatusDescription
TRIGGEREDDocument generation request has been accepted
PROCESSINGThe AI Employee is actively generating the document
COMPLETEDThe document has been generated successfully
FAILEDDocument generation encountered an error

Workflow

  1. Create: Submit a document generation request with input data
  2. Poll: Retrieve the document status periodically until COMPLETED or FAILED
  3. Use: Access the generated document content from the response
  4. Iterate: Optionally regenerate or update the document

Use Cases

  • Report generation -- Generate summary reports from data
  • Email drafting -- Create personalized email content
  • Contract generation -- Produce documents from templates and data
  • Content creation -- Generate marketing copy, documentation, etc.
  • Data extraction -- Extract structured information into document form

Trigger Type

Document generation AI Employees use PersonaTriggerType.DOCUMENT_GENERATION (value 5). This trigger type determines the AI Employee's interaction pattern and the available API endpoints.

Preview and Iteration

The API supports a regeneration flow for iterating on documents:

  1. Call Regenerate (preview) to generate a new version without replacing the original
  2. Review the preview
  3. Call Update to finalize changes

This allows safe iteration without losing the previous version.

Last updated: Jul 3, 2026