Add ability to version bump agents
What does this MR do and why?
This MR adds the ability to version bump agents.
The feature is behind a flag that is disabled by default.
How to set up and validate locally
Enable these two flags:
Feature.enable(:global_ai_catalog)
Feature.enable(:ai_catalog_enforce_readonly_versions)
Visit GraphQL Explorer: http://gdk.test:3000/-/graphql-explorer
Create a new agent:
mutation {
aiCatalogAgentCreate(input: {
projectId: "gid://gitlab/Project/1000000"
name: "My name"
description: "My description"
release: true
public: false
systemPrompt: "My system prompt"
userPrompt: "My user prompt"
}) {
errors
item {
id
latestVersion {
versionName
}
}
}
}
Using the id of the agent you just created, use the aiCatalogAgentUpdate mutation to do a series of updates to the systemPrompt, changing its value for each update to create more versions.
You will see each released version is a "patch" release. You can also change versionBump to MINOR or MAJOR.
mutation {
aiCatalogAgentUpdate(input: {
id: "gid://gitlab/Ai::Catalog::Item/140"
name: "My name"
release: true
versionBump: PATCH
public: true
systemPrompt: "New system prompt"
}) {
errors
item {
id
name
versions {
count
nodes {
releasedAt
released
versionName
...on AiCatalogAgentVersion {
systemPrompt
}
}
}
}
}
}
Now make a series of update mutation calls, but only change the versionBump argument to PATCH, MINOR or MAJOR. Notice that now you can't version bump its versionName as the version has been released.
Now make another update mutation call, this time change systemPrompt and have release: false so that you create a new draft version.
Now make a series of update mutation calls, but only change the versionBump argument to PATCH, MINORorMAJOR. Notice that you can version bump its versionName` as the version is a draft version.
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 #560254 (closed)