This module allows AI agents to create, list, and update Drupal Views. It provides AI tools for common Views operations like adding fields, filters, and displays, enabling agents to manage views based on natural language requests.
Let an AI Agent list, create, and update Drupal Views on your behalf.
Project Overview
AI Agents provides configured agents (a system prompt, a set of tools, a chosen provider/model) that can reason and act through a tool-calling loop. Until now, an agent had no way to work with the Views system: creating a listing, adding a field or filter, or adjusting a display all required a site builder to do it by hand in the Views UI.
AI Agents Views closes that gap with a set of AI function-call tools for common Views operations, plus a ready-to-use Views Agent that composes them: list existing views, create a new view, add a display, add or remove handlers (fields, filters, sorts, arguments, relationships), update handler options, and update display-level plugin settings (title, path, access, style, row, and more).
This project is the implementation delivered for [META] Drupal AI Views Agent, the meta issue proposing AI-driven Views configuration across the Drupal AI ecosystem. The Views Agent itself was developed in Add views agent, a child issue of that meta issue.
Note: this module is experimental. Review any view it produces before relying on it in production.
Core Functionality
- List views: enumerate existing views, or show the full config for one.
- Create a view: a new View entity for a given entity type, with sensible defaults.
- Create a display: add a display (e.g. page, block) to an existing view.
- Create a handler: add a field, filter, sort, argument, relationship, header, footer, or empty-text handler to a display.
- Update handler options: reconfigure an existing handler (e.g. a filter's operator/value, a sort's order).
- Remove a handler: take a handler back off a display.
- Update display plugins: set display-level options such as title, path, access, pager, style, and row.
- List a sample view: show core's own
frontpage(public) orcontent(admin) view as a worked example. Available as a tool for any agent to use, though not part of the shipped Views Agent's own tool set; its system prompt gives worked config examples directly instead. - A shipped Views Agent config entity composes the view, display, and handler tools above into one ready-to-use agent, with a system prompt covering key Views concepts, worked config examples for common display options, and guardrails (e.g. it will not delete a view or change an existing view's base table).
Example use case
A site builder asks the Views Agent: Create an admin listing of all content, showing title, type, and status, sortable by last updated, gated behind the content overview permission. The agent creates the view, adds the display, adds the three fields and a sort, sets the access permission, and reports back what it built, all through the same tools a developer would otherwise call by hand, or via the Views UI.
Requirements
- Drupal core ^10.3 || ^11
- AI Agents (
ai_agents) - Views UI (
views_ui, Drupal core), required for theadminister viewspermission the tools check against
Installation
Install as you would normally install a contributed Drupal module:
composer require 'drupal/ai_agents_views-ai_agents_views' drush en ai_agents_views
Enabling the module installs the shipped Views Agent config entity automatically.
Usage
- Grant the acting user (or the agent's configured account) the
administer viewspermission. - Invoke the Views Agent through the AI Agents system (chat, or any integration that can call a configured agent) with a natural-language request.
- The agent plans and calls the tools it needs (creating the view, adding the display, fields, filters, and sorts) and reports the result.
- Review the resulting view in the Views UI as you would any other.
Sample prompt
Create an entity type node listing view with the default display, title field with label Title, sort in descending order by created date, filter by published status 1, and filter by type article. Grant 'access content' permission. Create a page display with URL 'content-listing'.
The individual tools are also available to any other agent: add them to a custom agent's tool list to compose your own Views-editing behavior.
Views Agent development assistant (submodule)
An optional submodule, views_agent_dev_assistant, adds a ready-to-use chat interface for the Views Agent: an orchestrator agent that also reaches the Content Type, Field, and Taxonomy agents, wrapped in an AI Assistant, with a chatbot block placed in the Gin toolbar so a site builder can describe what they want in plain English instead of calling tools directly.
Enabling it is one command:
drush en views_agent_dev_assistantIts module dependencies (ai_assistant_api, ai_chatbot, gin_toolbar, block) install automatically. The Gin admin theme is the one prerequisite it cannot install for you, since a module's dependencies can only list other modules, not themes: install it first at /admin/appearance, or with drush theme:install gin. If Gin is installed after this submodule is enabled instead, its chatbot block is created automatically as soon as Gin is available, with no reinstall needed.
Demo & further reading
- Drupal Views AI Agent module: a video demo of the agent building a view.
- Introducing the Drupal AI Views Agent: a write-up of the design and the technical challenges involved in building the agent.
Similar Projects
- AI Agents: provides the agent framework and tool-calling loop that this project supplies Views tools for.
- [META] Drupal AI Views Agent: the ecosystem-wide meta issue this project implements.
- AI Agents Experimental Collection: provides a submodule ai_agents_views provides same functionality using Tool API.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the AI ecosystem
Most installed first
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.0-beta2 | Pre-release | 10–11 | Fixed the exported config for the agent. | Aug 30, 2026 | |
| 1.0.0-beta1 | Pre-release | 10–11 | First beta release | Aug 6, 2026 | |
| 1.0.x-dev | Dev | 10–11 | Initial dev release. | Aug 6, 2026 |