Add REST endpoint for seeding GitLab-managed external agents
What does this MR do and why?
This MR adds REST endpoint available to Self-Managed and Dedicated administrators for seeding GitLab-managed external agents.
We plan to backport this change to 18.8, so GitLab Dedicated instance will be able to have GitLab-managed external agents seeded to their AI Catalog.
The REST API endpoint has been implemented as an Experiment following our API styleguide https://docs.gitlab.com/development/api_styleguide/#experimental-beta-and-generally-available-features to allow the endpoint to be changed or removed in future, as we plan to offer a proper foundational external agents feature in future.
The endpoint has been implemented in REST and not GraphQL as the REST API is often considered by users to be simpler, and allows better documentation currently.
References
- https://gitlab.com/gitlab-org/gitlab/-/work_items/586347#note_3055413023
- https://gitlab.com/gitlab-org/gitlab/-/work_items/586347
How to set up and validate locally
Make an API request to the new endpoint with an admin user's PAT.
curl --location --request POST 'http://gdk.test:3000/api/v4/admin/ai_catalog/seed_external_agents' \
--header 'Authorization: Bearer <admin pat>'
You should get a 201 response:
{
"message": "External agents seeded successfully"
}
Visit http://gdk.test:3000/explore/ai-catalog/agents/ and you should see the 2 external agents in the catalog:
If you already have the agents in your catalog you will instead get a 422 with:
{
"message": "Error: External agents already seeded"
}
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 #586347
