Add unit_primitives field for locally define prompts
What does this MR do and why?
I discovered that in the current AI catalog flow's flow_v2 version (app/validators/json_schemas/ai_catalog/flow_v2.json), unit_primitives is not included for locally defined prompts. Instead, it is part of the model object. This MR adds unit_primitives as an optional field under the prompts object and removes it from the model component. For reference, see the flow register v1 example.
version: "v1"
environment: ambient
components:
- name: "code_analyzer"
type: AgentComponent
prompt_id: "my_local_prompt"
# prompt_version omitted - uses local prompt
ui_log_events: [ "on_agent_final_answer" ]
inputs: ["context:goal"]
toolset: ["read_file", "list_dir"]
prompts:
- prompt_id: "my_local_prompt"
name: "Code Analysis Assistant"
model:
params:
model_class_provider: anthropic
model: claude-sonnet-4-20250514
max_tokens: 32_768
unit_primitives: []
prompt_template:
system: "You are a helpful assistant specialized in code analysis"
user: "{{goal}}"
placeholder: history # Optional: include conversation history
params:
timeout: 180
routers:
- from: "code_analyzer"
to: "end"
flow:
entry_point: "code_analyzer"
Note: Currently, there are no flow records in production, as this feature is behind a feature flag set to false by default.
Index Scan using index_ai_catalog_items_on_item_type on public.ai_catalog_items (cost=0.15..3.17 rows=1 width=273) (actual time=0.022..0.023 rows=0 loops=1)
Index Cond: (ai_catalog_items.item_type = 2)
Buffers: shared hit=4
I/O Timings: read=0.000 write=0.000
Settings: seq_page_cost = '4', work_mem = '100MB', random_page_cost = '1.5', jit = 'off', effective_cache_size = '472585MB'
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
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.
Related to #578228