C3 AI Documentation Home

Document Generation in Workflows

Document Generation (DocGen) lets you create dynamic, professional documents as part of automated workflows. Describe the document you need to the Workflow Agent, and it builds the template, data collection, AI-generated content, and formatting automatically.

For background on workflow concepts like nodes, edges, and state, see C3 AI Workflows Overview.

DocGen supports the following capabilities:

  • Create reports, proposals, and analysis documents from workflow data
  • Mix user inputs with AI-generated content automatically
  • Embed images directly into generated documents
  • Format documents with tables, visualizations, and styled content
  • Export in Markdown, HTML, or DOCX
  • Scale to handle hundreds of documents in batch workflows

Create a document workflow

This section walks you through creating a workflow that generates documents. If you are new to workflows, complete the basic tutorial in Configure Workflows through the UI first.

Describe your document to the agent

In the Workflow Agent chat, describe the document you need. Be specific about inputs, sections, and AI-generated content:

Text
Create a workflow that generates engineering reports. 
It should ask for project name, type, budget, and timeline.
Generate an executive summary and risk assessment with AI.
Return as a downloadable document.

The agent asks clarifying questions about which sections need user input compared to AI generation. This helps it configure the data flow correctly.

Review the generated workflow

After the agent builds your workflow, review the canvas to verify the node configuration. The agent typically creates the following node structure:

  1. A User Input node to collect your data (project name, budget, timeline)
  2. An LLM Caller node to generate AI content (executive summary, risk assessment)
  3. A Document Generation node to render the final output

To inspect or modify any node, select it on the canvas and use the Configuration tab. For details on node configuration panels, see the node configuration section in C3 AI Workflows Configuration Guide.

Run and test

  1. Select Run.
  2. Provide the input data when prompted.
  3. Review the generated document in the execution results.

To hide intermediate outputs from the results page, use the eye icon on each node. For details on output visibility, see the hidden output toggle section in C3 AI Workflows Configuration Guide.

Template syntax

DocGen uses document templates with placeholders that get replaced at runtime. Two backend Types handle this:

The template syntax includes:

SyntaxPurposeExample
{{variable}}Replaced with data from workflow state{{project_name}}
<ai-block>...</ai-block>Processed by LLM and replaced with generated content<ai-block title="Executive summary">Write an executive summary</ai-block>

Everything outside these markers remains unchanged in the final document.

Configure output format

DocGen supports three output formats: Markdown, HTML, and DOCX. The Workflow Agent selects a default based on your description, but you can change it in the document node configuration.

To change the output format:

  1. Select the document generation node on the canvas.
  2. Open the Configuration tab.
  3. Select the output format from the dropdown.
  4. Select Save.

Troubleshoot document generation

If your document fails to generate, check the following:

  1. Verify all required variables have values. Open the node and check the Variables tab for missing inputs.
  2. Check the Issues footer bar at the bottom of the canvas for validation errors.
  3. Review execution logs for detailed error messages.

For detailed debugging steps, see the debug broken workflows section in C3 AI Workflows Configuration Guide.

See also

Was this page helpful?