Accept AI Catalog agent references in custom flow schema

What does this MR do and why?

First step of #628153 (closed): custom flows will be able to use AI Catalog agents as sub-agents through an include section in the flow YAML. This MR makes Rails accept that shape and gates it behind a feature flag. Nothing resolves the references yet.

  • flow_v2.json gets a top-level include list. Each entry names a catalog item: source (only ai-catalog), item_type (only agent), item_id (a string of digits) and version (an exact x.y.z pin). item_id has to be a string because the Duo Workflow Service reads it as one and does not convert a YAML integer.
  • A subagents entry in an AgentComponent is now either a {name} object, as before, or the same reference shape.
  • Both save services return an error when the definition has an include key and the ai_catalog_flow_agent_references flag is off. The schema file is static JSON, so the flag check is in the services.

The Duo Workflow Service already accepts this shape at save-time validation (ai-assist#2833). It also enforces that a subagent reference repeats an entry in the top-level include list exactly, so the schema being looser here is safe: a definition that references an agent only from subagents fails the DWS call in the save services.

Planned follow-ups from the issue: a resolver for each reference (MR 2), the save-time permission and visibility checks (MR 3), the dependency rows (MR 4, needs #628830 (closed)), and the documentation (MR 5).

References

Screenshots or screen recordings

No UI change.

How to set up and validate locally

The specs cover the schema and both services:

bundle exec rspec ee/spec/models/ai/catalog/item_version_spec.rb \
  ee/spec/services/ai/catalog/flows/create_service_spec.rb \
  ee/spec/services/ai/catalog/flows/update_service_spec.rb

256 examples, 0 failures.

To see the flag gate from a console: create a flow whose definition has an include entry with Feature.disable(:ai_catalog_flow_agent_references), and the save returns "Referencing AI Catalog items with include is not available".

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Angus Ryer

Merge request reports

Loading
Loading