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.jsongets a top-levelincludelist. Each entry names a catalog item:source(onlyai-catalog),item_type(onlyagent),item_id(a string of digits) andversion(an exactx.y.zpin).item_idhas to be a string because the Duo Workflow Service reads it as one and does not convert a YAML integer.- A
subagentsentry in anAgentComponentis now either a{name}object, as before, or the same reference shape. - Both save services return an error when the definition has an
includekey and theai_catalog_flow_agent_referencesflag 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
- Issue: #628153 (closed) (this is MR 1 of the plan in the description)
- Parent epic: &23526
- Reference limits for MR 3: !256851 (merged)
- DWS side: gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#2833 (closed)
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.rb256 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.