Problem/Motivation

The AI ecosystem is gaining first-class support for guardrails and guardrail sets.
In particular, work in the LiteLLM provider adds support for syncing guardrails from
the proxy and attaching an ai_guardrail_set to a request.

However, ai_search_block does not currently provide a UI for selecting
guardrail sets on the block configuration form. That means site builders cannot apply
guardrail policies to AI Search Block requests in a clean, reusable way, even when the
underlying AI provider supports them.

This should be solved directly in ai_search_block so site builders can:

  • attach one or more existing guardrail sets to a block,
  • quickly create a new set if none exists yet, and
  • understand clearly which safety rules are active for that block.

Proposed solution

Add a dedicated Guardrails section to the AI Search Block configuration form.

  • Add a selector for existing ai_guardrail_set entities.
  • Support selecting one or multiple sets.
  • Provide an inline link such as Create guardrail set / Manage guardrail sets.
  • Show a short description/help text so the purpose of the selected sets is obvious.
  • When multiple sets are selected, merge their referenced guardrails in a deterministic way and deduplicate duplicates.
  • Pass the effective guardrail set(s) along with AI Search Block requests through the AI API layer.

For the UI itself, a compact and clean approach would be preferable over a large multi-select.
For example, an entity autocomplete with tagging support, or another equally tight UI pattern.

Acceptance criteria

  • An administrator can configure an AI Search Block and attach one or more guardrail sets.
  • The block form includes a clear link to create/manage guardrail sets.
  • The selected guardrail sets are saved in block configuration and export correctly.
  • Requests made by ai_search_block include the configured guardrail information so compatible providers can apply it.
  • If multiple sets are selected, duplicate guardrails are not applied twice.
  • If no guardrail sets exist yet, the UI provides a clear empty state instead of a confusing field.
  • No WSOD or fatal error occurs if guardrail entities are missing, deleted, or temporarily unavailable.

Possible follow-up work

  • Show a summary of the selected guardrail sets directly in the form.
  • Add per-block overrides later if there is a real use case.

Comments

nikro created an issue. See original summary.

nikro’s picture

I'm picking this up, as soon as we release 1.2.x as per - https://www.drupal.org/project/ai_search_block/issues/3582387#comment-16...
So that we can start a good prep for 1.3.x and this being a good candidate.

arianraeesi’s picture