Skip to main content

AI Generator

The AI Generator activity sends a prompt to a large language model (LLM) and stores the text response in a workflow context variable for use by downstream activities.

Purpose

Use the AI Generator activity to:

  • Generate narrative text (summaries, commentary, recommendations) from workflow data
  • Transform structured data into human-readable output using an LLM
  • Build dynamic prompts from workflow variables and pass the AI response to a Save File or messaging activity
  • Classify, extract, or reformat text as part of a data pipeline

Configuration

System Prompt

The system-level instruction that defines the AI's role and behaviour for this call. Supports interpolation.

Example:

You are a financial analyst writing concise executive commentary.
Always write in third person. Limit responses to 3 paragraphs.

Prompt

The user-level message or question sent to the model. Fully supports interpolation — embed workflow variables directly in the prompt:

Write a variance commentary for {{var:EntityName}} for {{var:Period}}.
Actual revenue: {{var:ActualRevenue}}
Budget revenue: {{var:BudgetRevenue}}
Variance: {{var:Variance}}

LLM

The language model deployment to use. The dropdown lists the LLM configurations available in the system. Default: gpt-5-mini.

Response Context Key

The workflow context variable name where the AI's text response is stored.

Default key: AiWorkflowActivity_ResponseContextKey

Rename to something meaningful (e.g. ExecutiveCommentary, ClassificationResult).

Behavior

  1. System Prompt and Prompt are interpolated against the current workflow context.
  2. The request is sent to the configured LLM.
  3. The response text is stored in the workflow context under the Response Context Key.
  4. The activity returns Success.

Usage Patterns

Generate Commentary Then Save to File

Model Query ──> AI Generator ──> Save File
(reads data) └── Prompt: "Write commentary for {{var:Period}}" └── Contents: {{var:Commentary}}
Response Key: Commentary

Classify Input Then Branch

AI Generator ──> If ({{var:Classification}} == "URGENT")
└── Prompt: "Classify the following text as URGENT or NORMAL: {{var:InputText}}"
Key: Classification

Usage Notes

  • The system prompt and prompt both support full interpolation. You can embed any workflow context variable, including multi-line text from previous activities.
  • The response is stored as raw text. For structured output (JSON, tables), instruct the model to produce a specific format in the system prompt, then parse it with a Script activity.
  • If the selected LLM deployment is configured as an agent, the activity uses the agent execution path, which may behave differently from a standard chat completion call.
  • Prompt length, model context window limits, and response token limits apply. Very long prompts or responses may be truncated.

Best Practices

  • Be specific in the system prompt about format, length, and tone. Generic system prompts produce inconsistent output.
  • Rename the Response Context Key — the default is long and will conflict if you use more than one AI Generator activity in the same workflow.
  • Test prompts with representative data before deploying to production. LLM responses are non-deterministic; verify the output format is stable enough for downstream use.
  • For structured extraction tasks, ask the model to respond in JSON and parse with a Script activity rather than relying on free-form text parsing.

JSON Reference

{
"discriminator": "AiWorkflowActivity",
"activityId": "<uuid>",
"name": "AI Generator",
"positionX": 0,
"positionY": 0,
"advanceRule": 2,
"chatDeploymentName": null,
"systemPrompt": "You are a financial analyst.",
"prompt": "Write a commentary for {Period}.",
"responseContextKey": "AiWorkflowActivity_ResponseContextKey"
}
PropertyTypeDescription
chatDeploymentNamestring | nullCorresponds to the LLM field. The name of the LLM deployment to use. null uses the default deployment.
systemPromptstringCorresponds to the System Prompt field. System-level instruction defining the AI's role. Supports {variable} interpolation.
promptstringCorresponds to the Prompt field. The user-level message sent to the model. Supports {variable} interpolation.
responseContextKeystringCorresponds to the Response Context Key field. The workflow context key where the AI's text response is stored.