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
| Status | Description |
|---|---|
TRIGGERED | Document generation request has been accepted |
PROCESSING | The AI Employee is actively generating the document |
COMPLETED | The document has been generated successfully |
FAILED | Document generation encountered an error |
Workflow
- Create: Submit a document generation request with input data
- Poll: Retrieve the document status periodically until
COMPLETEDorFAILED - Use: Access the generated document content from the response
- 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:
- Call
Regenerate(preview) to generate a new version without replacing the original - Review the preview
- Call
Updateto finalize changes
This allows safe iteration without losing the previous version.
Related
- Document Generation API -- API endpoints
- AI Employee Overview -- AI Employee architecture
- Workflow Overview -- How workflows process document requests