Skip to main content

AI Chat with Workflows

When combined with the Workflows feature, the AI Services module introduces new activities that allow workflows to interact directly with AI chat services.

AI Completion using Profile Task

This activity lets you request AI completions using an existing AI Profile, and store the response in a workflow property. To use it, search for the AI Completion using Profile task in your workflow and specify a unique Result Property Name. The generated response will be saved in this property.

For example, if the Result Property Name is AI-CrestApps-Step1, you can access the response later using:

{{ Workflow.Output["AI-CrestApps-Step1"].Content }}

To prevent naming conflicts with other workflow tasks, it's recommended to prefix your Result Property Name with AI-.

AI Completion using Direct Config Task

This activity allows you to request AI completions by defining the configuration directly within the workflow, without relying on a predefined AI Profile. To use it, search for the AI Completion using Direct Config task in your workflow and specify a unique Result Property Name. The generated response will be saved in this property.

For example, if the Result Property Name is AI-CrestApps-Step1, you can access the response later using:

{{ Workflow.Output["AI-CrestApps-Step1"].Content }}

As with other AI tasks, it's recommended to prefix your Result Property Name with AI- to avoid conflicts.

Chat Session Workflow Events

The AI Services module triggers workflow events at key points in the chat session lifecycle. These events include full Session and Profile objects in their input dictionaries, enabling rich workflow automation.

AI Chat Session Closed

Triggered when a chat session is closed (either naturally or by inactivity timeout).

Input PropertyTypeDescription
SessionIdstringThe unique session identifier.
ProfileIdstringThe AI profile identifier.
SessionAIChatSessionThe full session object with extracted data and metadata.
ProfileAIProfileThe full AI profile configuration.
ClosedBecauseFarewellDetectedboolWhether the session closed due to farewell intent detection.

AI Chat Session Post-Processed

Triggered after post-session processing completes on a closed session.

Input PropertyTypeDescription
SessionIdstringThe unique session identifier.
ProfileIdstringThe AI profile identifier.
SessionAIChatSessionThe full session object.
ProfileAIProfileThe full AI profile configuration.
ResultsDictionaryPost-session processing results keyed by task name.

AI Chat Session Field Extracted

Triggered each time a data extraction field value is collected from the conversation.

Input PropertyTypeDescription
SessionIdstringThe unique session identifier.
ProfileIdstringThe AI profile identifier.
SessionAIChatSessionThe full session object.
ProfileAIProfileThe full AI profile configuration.
ChangesList<ExtractedFieldChange>The field changes extracted in this turn.

Each ExtractedFieldChange has:

  • Key: The field name.
  • Value: The extracted value.
  • PreviousValue: The previous value (if updated).

AI Chat Session All Fields Extracted

Triggered once when all configured data extraction fields have been collected for a session. Unlike the per-field event, this fires only when every entry in the profile's data extraction configuration has at least one value.

Input PropertyTypeDescription
SessionIdstringThe unique session identifier.
ProfileIdstringThe AI profile identifier.
SessionAIChatSessionThe full session object.
ProfileAIProfileThe full AI profile configuration.