Search by

drupal / canvas_ai_context

Drupal-Infrastructure

Installs AI Context and gives the Drupal Canvas Page Agent tools to list and load site-specific context items.

Package info

git.drupalcode.org/project/canvas_ai_context.git

Type:drupal-recipe

pkg:composer/drupal/canvas_ai_context

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

1.0.x-dev 2026-11-11 18:37 UTC

This package is auto-updated.

Last update: 2026-11-11 13:08:16 UTC


README

Gives the Drupal Canvas Page Agent (drupal_canvas_page_agent) access to the site's AI context items, such as page building guidelines, brand guidelines and site facts.

The recipe:

  • Installs ai_agents, ai_context, canvas, canvas_ai and canvas_dev_ai, and imports their configuration. canvas_dev_ai provides the Canvas Page Agent.
  • Adds an "Available context items" default information tool to the agent. It runs ai_context:list_ai_context_items on every request and gives the agent the ID, label and purpose of each context item.
  • Adds the ai_context:load_ai_context_item_by_id tool to the agent, so it can load the full content of the items it needs. The tool's task, max_tokens and include_subcontext parameters are hidden from the agent.
  • Sets the AI Context max token budget (ai_context.settings:max_tokens), 10000 by default. The module default of 1200 truncates loaded items.
  • Registers the agent as an AI Context consumer with automatic context injection turned off, so context reaches the agent only through the list and the load tool.

The recipe replaces the agent's whole list of default information tools. Any changes made to that list on the site are lost when the recipe is applied.

Requirements

  • Grant the access published ai context permission to every role that uses the Canvas Page Agent. Without it, the agent cannot list or load context items.

Applying

drush recipe ../recipes/canvas_ai_context

To set the max token budget without the prompt:

drush recipe ../recipes/canvas_ai_context --input=canvas_ai_context.max_tokens=10000 -n