Don’t forget to subscribe to our YouTube channel to stay up-to-date.
Artificial intelligence continues to reshape content management systems, and Drupal is embracing this transformation through the Drupal AI initiative.
The video above demonstrates how to use AI Automators in Drupal CMS to automate content generation, transcribe audio files, and streamline editorial workflows.
This guide covers AI Automators within the Drupal AI module suite. Learn to set up basic and chained automators, transcribe audio, integrate AI into CKEditor, and auto-generate social media posts.
What are AI Automators?
Boost Your Web Development Skills
Get lifetime access to all live streams ad-free and a private site builder forum. Click here to join.
AI Automators link prompts to Drupal fields. When an entity is created or updated, the automator sends a prompt to an LLM, which populates fields with generated content.
For example, an automator can be created on a summary field. Using the article title as context, the prompt instructs the LLM to generate a summary. This summary is then automatically saved when the content is created or updated.
AI Automators ship in their own submodule within the Drupal AI module.
Installing Drupal AI via AI Assistant in Drupal CMS
Learn more about AI in Drupal CMS
Want to harness the power of AI to transform your Drupal workflow? Check out the Getting Started with AI in Drupal CMS course, available as part of the WebWash Premium community.
If you’re using Drupal CMS, the AI Assistant recipe simplifies the installation process.

- Navigate to Extend, then click Recommended add-ons.
- You’ll see the AI Assistant recipe in the list.
- Install the recipe by clicking the Install button.
- After installation completes, refresh your browser to see the new Assistant button in the toolbar.
If you can’t see the Assistant button, then try clearing the cache:
ddev drush cr
Installing on Drupal Core
For Drupal Core sites (non-CMS), you can manually install the Drupal AI module using Composer and enable the necessary submodules.
Run the following Composer command:
composer require 'drupal/ai:^1.2'
Configuring API Keys
The AI Assistant recipe requires an API key to communicate with your chosen LLM provider. During installation, you’ll be prompted to add your API key.

For development, storing keys in the database is acceptable. For production, configure keys as server-level environment variables. The Drupal Key module securely manages API keys.
To modify your API key:
- Navigate to Configuration > System > Keys
- Find your AI provider key (e.g., “OpenAI API Key”)
- Click Edit (the system will warn you before revealing the key)
- Update the key value or change the key provider to pull from environment variables.
Managing Default Settings
Navigate to Configuration and scroll down to the AI section to access the default settings page.
Here you can configure:
- Default Providers: Select which LLM provider to use (OpenAI, Anthropic, etc.)
- Default Models: Choose specific models for different operation types (e.g., text generation, audio transcription).
- Text to Speech Settings: Configure voice and speech generation options
- Audio Transcription Settings: Set default transcription models
The default configuration works well for most use cases, but you can override these settings at the automator level if specific fields require different models or providers.
Installing AI Automators and AI CKEditor Integration
Once you’ve downloaded the Drupal AI module or installed the AI Assistant:
- Go to Extend and click List
- Search for “AI”
- Enable AI Automator and AI CKEditor integration
Creating Basic Automators
Description Field Automator
Let’s create an automator that generates event descriptions from the event title.
First, install the Events recipe by navigating to Extend > Recommended add-ons and installing Events.
Configure the Description field automator:
- Navigate to Structure > Content types > Event > Manage fields
- Click on the Description field to edit it
- Scroll down and enable AI Automator
- Select LLM: Text as the AI automator mode
- Select Base mode for the input
- Choose Title as the base field (this provides context for the prompt)
- Add your prompt in the text area
- Scroll down to Advanced settings
- Make sure Direct is used as the Automator Worker
- Save the field settings
The {{ context }} token will be replaced with the event title value when the automator runs.

NOTE: Make sure you uncheck the “Required field” in the Description field.
Tags Field Automator
Create a second automator to generate tags automatically:
- Edit the Tags field on the Event content type
- Enable the AI Automator option
- Select LLM: Taxonomy type and Base mode input
- Choose Title as the input field
- Add your prompt
- Set the worker to Direct
- Save the field settings
Testing Your Automators
Create a new event to test the automators:
- Navigate to Content > Add content > Event
- Add a title: “Hosting a Drupal Site on AWS and Google Cloud”
- Set the date and time for the event
- Leave Description and Tags empty
- Click Save
The save operation triggers both automators. You’ll notice a slight delay (a few seconds) as the system sends requests to the LLM and receives responses. If the save happens instantly, the automators didn’t execute.
After the page refreshes, check the event:
- Tags should be populated with relevant keywords
- The description field should contain a generated description
If you want to regenerate the content:
- Edit the event
- Delete the content from the Description or Tags fields
- Save the event
- The automators will run again and generate new content
Once content is generated, you can edit it manually without triggering the automator again. The automator only runs when the field is empty and the input field has a value.
Transcribing Audio with Automators
AI Automators support audio transcription using the speech-to-text models. This allows you to upload audio files and automatically generate text transcripts.
Creating an Audio Media Type
Drupal CMS doesn’t include an audio media type by default.
Create a media type for audio:
- Navigate to Structure > Media types > Add media type
- Name: “Audio”
- Description: “Used for audio files”
- Media source: Audio file
- Field with source information: – Create –
- Click Save
The system automatically creates a file field for audio uploads.
Configuring the Transcript Field
Add a field to store the transcript:
- Click Manage fields on the Audio media type
- Click Create a new field
- Select Text (plain, long)
- Label the field “Transcript”
- Click Continue
- Enable the AI Automator on the field
- Select LLM: Audio to Text as the automator type and Base Mode input
- The Audio file field will be automatically selected as the input
- Save the field settings
The audio-to-text type handles the complexity of sending audio files to the transcription API and returning the text result.

Testing Audio Transcription
Test the audio transcription:
- Navigate to Content > Media > Add media > Audio
- Upload an audio file
- Add a name for the media item
- Save the media
The automator sends the audio file to the default speech-to-text model configured in Drupal and populates the Transcript field. Transcription takes longer than text generation (depending on the audio file length), so expect a delay before the transcript appears.
Edit the media item to view the generated transcript. You can now reference this media item in your content and display the transcript alongside the audio file.
Integrating Automators with CKEditor
CKEditor integration allows content editors to generate AI content directly within rich text fields using an interactive interface.
Unlike field-based automators that run automatically on save, CKEditor automators are triggered manually from the toolbar. You can create multiple custom automators, each appearing as a separate option in the editor’s AI assistant menu.
In this example, let’s create some automators that will generate different levels (full and summary) of an event description for us.
Creating Full Details Automator
Create an automator that generates detailed event descriptions:
- Navigate to Configuration > AI > AI Automators > Add Automator Chain Type
- Label: “Generate FULL details”
- Click Manage fields, then Create a new field
- Select Text (plain, long)
- Label the field “Input”
- Click Continue
- Make sure the field is required.
Then create the Output field:
- Click Manage fields, then Create a new field
- Select Text (formatted, long)
- Label the field “Output”
- Click Continue
- Enable AI Automator
- Select LLM: Text as the AI Automator mode and Base mode for the input
- Select Input from as the base field and add your prompt
- Save the field
The prompt can include an example HTML structure to guide the LLM’s formatting. You can also add multiple real-world examples to improve output consistency.
Adding Automators to CKEditor
Enable the AI Automator CKEditor button:
- Navigate to Configuration > Text formats and editors
- Click Configure on the Content format
- Enable AI CKEditor by moving the button from the Available buttons to the Active toolbar.
- Click on AI tools and scroll down to AI Automators CKEditor settings
- Enable your Generate FULL details automator
- Configure the input field: Select Input (the required field you created)
- The output field should automatically be set to Output
- Set the write mode to Replace
- Save the configuration
Note: There’s a UI quirk where enabling the plugin redirects you to the top of the page. Simply scroll back down to continue configuration.

Testing the CKEditor Automator

Test the CKEditor integration:
- Create or edit an Event
- Click on the Body field
- You’ll see an AI assistant button in the CKEditor toolbar
- Click the AI button to open a dialog
- Enter your prompt in the Input field:
Can you generate an event description using the following title:
Hosting a Drupal Site on AWS and Google Cloud

- Click Generate
- The automator processes the request and displays the result in the Output section.
- Review the generated content (always verify AI-generated content for accuracy)
- Click Save changes to editor to insert the content into the Content field
- Save the event
The generated content appears in your rich text editor with proper HTML formatting. You can edit the content before saving the event.
Creating Summary Automator
Create a second automator that generates summaries from existing content:
- Navigate to Configuration > AI > AI Automators > Add Automator Chain Type
- Label: “Generate SUMMARY details”
- Click Manage fields, then Re-use an existing field
- Add Input and Output
We need to add a third field to control the summary length.
- Click Manage fields, then Create a new field
- Select Text (plain)
- Label the field “Length”
- Click Continue
- Make sure the field is required.
Now we need to add the automator to the output field.
- Edit Output
- Enable AI Automator
- Select LLM: Text as the AI Automator mode and Advanced Mode (Token) for the input.
- Add your prompt and make sure you use tokens,
[automator_chain:field_length]or[automator_chain:field_input] - Save the field
Enable the summary automator in CKEditor:
- Go to Configuration > Text formats and editors > Content > Configure
- Enable your Generate SUMMARY details automator
- Configure the input field: Select Input (the required field you created)
- Text Selection Input: Input
- Set the write mode to Prepend
- The output field should automatically be set to Output
- Save the configuration
Test the summary generator:
- Edit an event with existing body content
- Select the text you want to summarize
- Click on AI Assistant, then select Generate SUMMARY details from the dropdown
- Enter a length value (e.g., 250)
- Paste or type content in the Input field
- Click Generate
- The summary appears in the output section, formatted as a blockquote
- Click Save changes to editor
The summary gets prepended to your existing body content, allowing you to build up the content progressively.
Building Chained Automators
Chained automators allow you to create complex workflows where one automator’s output becomes another automator’s input. This is powerful for generating multi-step content, such as full descriptions followed by summaries.
Creating the Combined Automator
Create an automator that generates both full details and a summary in one action:
- Navigate to Configuration > AI > AI Automators > Add Automator Chain Type
- Label: “Generate FULL+SUMMARY details”
- Click Manage fields, then Re-use an existing field
- Add Input and Output
Configure the full details generation:
- Create a new text formatted long field: “Generate FULL details”
- Enable AI Automator on this field
- Select LLM:Text type and Base mode
- Input field: Input
- Add the detailed description prompt (same as before)
- Set worker mode to Direct
- Save the field
Configure the summary generation:
- Create a new text formatted long field: “Generate SUMMARY details”
- Enable AI Automator on this field
- Select LLM:Text type and Base mode
- Input field: Generate Full Details (note: this uses the previous automator’s output)
- Add a summary prompt
- Set worker mode to Direct
- Save the field
Configure the output field:
- Edit the Output field AI Automator settings
- Select LLM: Text Type
- Input mode: Advanced Mode (Token)
- Add a prompt to merge both from full and summary fields
- Make sure the AI Automator run order is correct:
- First: Generate Full Details (uses Input)
- Second: Generate Summary Details (uses Generate Full Details)
- Third: Output (uses both)
Enable the “Full + Summary” automator in CKEditor:
- Go to Configuration > Text formats and editors > Content > Configure
- Enable your Generate FULL+SUMMARY details automator
- Configure the input field: Select Input (the required field you created)
- Text Selection Input: None
- Set the write mode to Replace
- The output field should automatically be set to Output
- Save the configuration
Understanding the Chain Sequence
The chained automator executes in this order:
- Input field receives the editor’s prompt
- Generate Full Details uses Input to create a detailed description
- Generate Summary Details uses Generate Full Details to create a summary
- Output field combines both outputs using tokens
This creates a workflow where a single action generates multiple pieces of content with different formatting and purposes.

Test the chained automator:
- Edit an event
- Click the AI button in CKEditor
- Select “Generate FULL+SUMMARY details”
- Enter your prompt
- Click Generate
- Wait for all three automators to execute (this takes longer than single automators)
- The output displays the full details followed by a horizontal line, and then the summary
- Save changes to editor
AI Logging and Debugging
When working with AI Automators, logging is essential for debugging prompts, understanding what context gets passed to the LLM, and monitoring token usage.
Enabling AI Logging
Enable the AI Logging module:
- Navigate to Extend and search for “AI Logging”
- Enable the AI Logging module
- Go to Configuration > AI > AI Logging > AI Logging Settings
- Enable both Automatically Log requests and Automatically Log responses
- Save the configuration

Viewing AI Logs
Access the logs:
- Navigate to Configuration > AI > AI Logging > AI logs
- You’ll see a table of all AI requests and responses
Each log entry details the timestamp, operation type, provider, model, and status. Clicking “View” reveals the full prompt, context data, response, token usage (including cost), and execution time.
Logging is crucial for verifying prompt templates, debugging hallucinations, monitoring API costs, and troubleshooting failed requests.
For production sites, disable logging or set up log rotation to manage database size, as the AI Logging module can generate many records on high-traffic sites.

Advanced: Social Media Post Generation
You can use AI Automators to generate social media content based on your events, creating pre-show and post-show promotional posts.
Creating a Social Post Content Type
Create a custom content type for social media posts:
- Navigate to Structure > Content types > Add content type
- Name: “Social Post”
- Description: “Social media promotional posts”
- Save the content type
Add an entity reference field:
- Click Manage fields
- Create a new field: Entity reference
- Label: “Parent event”
- Reference type: Content
- Allowed content types: Event
- Save the field
Add a content field:
- Create a new field: Text formatted long
- Label: “Content”
- Enable AI Automator
- Select LLM: Text type and Advanced Mode (Token)
- Add a social media prompt
- Set worker to Direct
- Save the field
Setting Up the Social Post Automator
The automator uses entity reference tokens to access event data. Available tokens include:
[node:field_parent:entity:title]: Event title[node:field_parent:entity:field_content]: Event content field[node:field_parent:entity:field_event__date]: Event date field- Any custom fields on the Event content type
Test the social post automator:
- Navigate to Content > Add content > Social Post
- Select an existing event from the Parent Event reference field
- Leave Content empty
- Save the social post
The automator creates social media posts from event data. You can generate multiple posts for one event (e.g., pre-show, reminder, post-show) by modifying the prompt or using different automators with varied tones and purposes.
Field Widget Actions
Field Widget Actions provide an alternative to the CKEditor integration, allowing you to trigger automators directly from field widgets using action buttons.
First, install Field Widget Actions, navigate to Extend, search for “Field Widget Actions,” and then enable the module.
Enable Field Widget Actions on field:
- Edit your content type field
- Scroll to AI Automator settings
- Change the Worker from “Direct” to “Field Widget Action“
- Save the field
Configure the field widget:
- Navigate to Manage form display for your content type
- Click the settings icon for your field
- You’ll see a Field Widget Actions section
- Select the action from the drop-down and click on Add action
- Toggle Enable Automators
- Customize the button label (e.g., “Generate Content”)
- Save the form display

When you create or edit content:
- The field displays an action button
- Click the button to trigger the automator
- The generated content appears in the field
- You can edit the content before saving

This method provides editors more control over automator execution, allowing on-demand generation for fields requiring review or when automators are resource-intensive. It can also be applied to taxonomy fields for on-demand tag generation.
Summary
AI Automators provides powerful automation capabilities for the Drupal CMS through the Drupal AI module suite.
The automators attach prompts to fields, executing when content is created or updated to generate descriptions, tags, transcripts, and complex chained content.
AI Automators need careful prompt engineering and testing for quality. Use clear examples, specify formatting, and review AI content.
Context (input fields, tokens, and referenced entities) affects content quality. Start with simple automators and gradually build complex ones.
The Drupal AI module suite offers flexible AI integration.




