feat(agents): add prompts for explain vulnerability tool

What does this merge request do and why?

Related to Migrate Duo Chat Tools: ExplainVulnerability (gitlab-org/gitlab#475046 - closed)

Based on gitlab-org/gitlab!164210 (merged) in GitLab rails.

In this MR, we:

  • Migrate the ExplainVulnerability tool to use the AIGW

How to set up and validate locally

  • Run AI Gateway with Anthropic debug: ANTHROPIC_LOG=debug poetry run ai_gateway
  • Enable prompt_migration_explain_vulnerability feature flag on Rails (::Feature.enable(:prompt_migration_explain_vulnerability))
  • Perform /vulnerability_explain slash command in Duo Chat, eg.. /vulnerability_explain #include <stdio.h> int main(int argc, char *argv[]) { char buf[8]; memcpy(&buf, "123456789"); printf("hello, world!"); }
  • Verify that /v1/prompts/chat/explain_vulnerability endpoint is called in the AIGW
  • Verify that the correct prompt is sent to Anthropic

Merge request reports

Loading