[{"data":1,"prerenderedAt":792},["ShallowReactive",2],{"/en-us/blog/how-gitlab-duo-helps-secure-and-thoroughly-test-ai-generated-code":3,"navigation-en-us":40,"banner-en-us":440,"footer-en-us":450,"blog-post-authors-en-us-David O'Regan":690,"blog-related-posts-en-us-how-gitlab-duo-helps-secure-and-thoroughly-test-ai-generated-code":705,"assessment-promotions-en-us":744,"next-steps-en-us":782},{"id":4,"title":5,"authorSlugs":6,"body":8,"categorySlug":9,"config":10,"content":14,"description":8,"extension":27,"isFeatured":12,"meta":28,"navigation":29,"path":30,"publishedDate":20,"seo":31,"stem":35,"tagSlugs":36,"__hash__":39},"blogPosts/en-us/blog/how-gitlab-duo-helps-secure-and-thoroughly-test-ai-generated-code.yml","How Gitlab Duo Helps Secure And Thoroughly Test Ai Generated Code",[7],"david-oregan",null,"ai-ml",{"slug":11,"featured":12,"template":13},"how-gitlab-duo-helps-secure-and-thoroughly-test-ai-generated-code",false,"BlogPost",{"title":15,"description":16,"authors":17,"heroImage":19,"date":20,"body":21,"category":9,"tags":22},"Developing GitLab Duo: Secure and thoroughly test AI-generated code","Learn step-by-step how to enhance AI-generated code reliability and security using GitLab Duo and GitLab Pages (includes code samples and prompts).",[18],"David O'Regan","https://res.cloudinary.com/about-gitlab-com/image/upload/v1750097183/Blog/Hero%20Images/Blog/Hero%20Images/blog-hero-banner-1-0178-820x470-fy25_7JlF3WlEkswGQbcTe8DOTB_1750097183481.png","2024-05-30","___Generative AI marks a monumental shift in the software development industry, making it easier to develop, secure, and operate software. Our new blog series, written by our product and engineering teams, gives you an inside look at how we create, test, and deploy the AI features you need integrated throughout the enterprise. Get to know new capabilities within GitLab Duo and how they will help DevSecOps teams deliver better results for customers.___\n\nAs AI becomes increasingly integral to software development, ensuring the security and thorough testing of AI-generated code is paramount. This article is a step-by-step guide to combining [GitLab Duo](https://about.gitlab.com/gitlab-duo/), our suite of AI features to powering the DevSecOps workflow, and [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/) to secure and thoroughly test AI-generated code. You'll discover how to mitigate common risks, including how to automatically generate tests, test code, and deploy test reports – all to enhance the reliability of your AI-generated code.\n\n> Discover the future of AI-driven software development with our GitLab 17 virtual launch event. [Watch today!](https://about.gitlab.com/eighteen/)\n\n## Challenges in AI-generated code\n\nAI-generated code often faces issues such as:\n\n- Mismatched algorithms: Incorrect or suboptimal algorithms can be generated.\n- Dependency problems: AI may include dependencies that are outdated or incompatible.\n- Security vulnerabilities: AI might generate code with potential security flaws.\n\nAI-generated code often faces issues such as mismatched algorithms, dependency problems, and security vulnerabilities. A [recent study published by the Association of Computing Machinery](https://dl.acm.org/doi/pdf/10.1145/3613904.3642596) on ChatGPT’s responses to programming questions found that 52% of the answers contained incorrect information, and 77% were overly verbose. Despite these shortcomings, users preferred ChatGPT’s comprehensive and well-articulated answers 35% of the time, even overlooking misinformation 39% of the time. Addressing these challenges requires the use of advanced tools and frameworks.\n\n## GitLab’s approach to AI security and testing\n\nGitLab has a comprehensive content strategy focused on integrating security measures within the development workflow. By leveraging GitLab Duo for AI-powered code generation and GitLab Pages for embedding test reports, developers can ensure their AI-generated code is both secure and reliable.\n\nHere is a step-by-step guide to pair GitLab Duo and GitLab Pages to ensure secure and thoroughly tested AI-generated code by implementing a [Flask web server](https://flask.palletsprojects.com/en/3.0.x/).\n\n### 1. Create a new project on GitLab.com\n\n- Go to [GitLab.com](http://GitLab.com).\n- Click on the \"New project\" button.\n- Choose \"Create blank project\".\n- Enter a project name (e.g., AI_Code_Security).\n- Set the visibility level (Public, Internal, or Private).\n- Click \"Create project\".\n\n### 2. Enable GitLab Duo Code Suggestions\n\n- Navigate to your project.\n- Click on the \"Web IDE\" button to open the Web IDE.\n- Ensure that GitLab Duo features like Code Suggestions and Duo Chat are enabled. - Start coding in the [Web IDE](https://docs.gitlab.com/ee/user/project/web_ide/). As you type, GitLab Duo will provide code suggestions to help you write code more efficiently.\n\n### 3. Create a Flask web server\n\nYou can create a Flask web server using the comment (highlighted in green) in the screenshot below.\n\n![DGD testing - image 1](https://res.cloudinary.com/about-gitlab-com/image/upload/v1750097192/Blog/Content%20Images/Blog/Content%20Images/image4_aHR0cHM6_1750097192520.png)\n\n### 4. Generate tests with GitLab Duo\n\nUnit tests are essential for validating the functionality of the generated code. Use GitLab Duo’s `/tests` command to [generate testing suggestions directly in the Web IDE](https://docs.gitlab.com/ee/user/gitlab_duo_chat_examples.html#write-tests-in-the-ide). This command can be tailored with additional instructions to focus on specific aspects such as performance, regression, or using particular frameworks.\n\n#### Example usage in Web IDE:\n\n- Select the code for which you want to generate tests.\n- Use the command `/tests` followed by additional instructions if needed.\n\n![DGD testing - image 2](https://res.cloudinary.com/about-gitlab-com/image/upload/v1750097192/Blog/Content%20Images/Blog/Content%20Images/image1_aHR0cHM6_1750097192521.png)\n\n### 5. Identify issues with AI-generated code using GitLab Duo Chat\n\nUse GitLab Duo Chat to review and refine AI-generated code. For instance, let's check our Flask web server code for security vulnerabilities:\n\n```text\nPrompt: Review this code for potential security vulnerabilities and dependency issues.\n\n```\n\n![DGD testing - image 3](https://res.cloudinary.com/about-gitlab-com/image/upload/v1750097192/Blog/Content%20Images/Blog/Content%20Images/image2_aHR0cHM6_1750097192523.png)\n\nGitLab Duo Chat can help identify the vulnerabilities in the above code.\n\n### 6. Generate test reports\nAfter running your tests, generate a test report that will be deployed using GitLab Pages.\n\n```text\n\nPrompt: Write me a python script to generate a test report that will be deployed using GitLab Pages.\n\n```\n\n![DGD testing - image 4](https://res.cloudinary.com/about-gitlab-com/image/upload/v1750097192/Blog/Content%20Images/Blog/Content%20Images/image3_aHR0cHM6_1750097192525.png)\n\nWhat's happening here?\n\n- The script ensures the test_reports directory exists.\n- It runs the `test_server.py` file using `subprocess.run()`, capturing the output.\n- The raw output is saved to `test_reports/test_output.txt`.\n- An HTML report is generated, embedding the test output within `\u003Cpre>` tags for readability, and saved as `test_reports/index.html`.\n\n### 7. Deploy the test report with GitLab Pages\n\nUse [GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/) to host and display the test report. Here’s the configuration for our `.gitlab-ci.yml` file to deploy the test report.\n\n```python\n\nstages:\n  - test\n  - deploy\ntest_job:\n  stage: test\n  script:\n    - python generate_test_report.py\n  artifacts:\n    paths:\n      - test_reports/\npages:\n  stage: deploy\n  script:\n    - mv test_reports public\n  artifacts:\n    paths:\n      - public\n\n ```\n\nWith this setup, the `test_job` stage runs the Python script to generate the test report. The `pages` stage moves the `test_reports` directory to `public`, which GitLab Pages uses to serve the content.\n\n### 8. Embedding test reports in MR widgets\n\nEmbedding the [test reports in MR widgets](https://docs.gitlab.com/ee/ci/testing/unit_test_reports.html) provides immediate visibility into the testing outcomes, ensuring transparency and reliability. This can be done by including the test report as an artifact in your CI/CD pipeline configuration:\n\n```python\n\nstages:\n  - build\n  - test\n  - deploy\n\nbuild_job:\n  stage: build\n  script:\n    - echo \"Building the project...\"\n    - # Your build commands here\n\ntest_job:\n  stage: test\n  script:\n    - mkdir -p test-reports\n    - python test_server.py > test-reports/results.xml\n  artifacts:\n    when: always\n    reports:\n      junit: test-reports/results.xml\n    paths:\n      - test-reports/results.xml\n\npages:\n  stage: deploy\n  script:\n    - mkdir .public\n    - mv test-reports .public/\n  artifacts:\n    paths:\n      - .public\n\n```\nBy including the test report as an artifact and specifying it in the reports section, GitLab will automatically display the test results in the MR widgets, providing immediate visibility into the testing outcomes and enhancing transparency and reliability.\n\n### Case study: AI reliability with security policies and scanners\n\nImagine a scenario where an AI-generated code snippet introduces a dependency that has known vulnerabilities. By using GitLab Duo and its security policies, this dependency would be flagged during the code generation process. Let’s consider an example where a snippet was generated by AI:\n\n```python\n\nimport os\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route('/search')\ndef search():\n    query = request.args.get('query')\n    execute_os_command(query)\n    return 'You searched for: ' + query\n\ndef execute_os_command(command):\n    os.system(command)\n\nif __name__ == '__main__':\n    app.run()\n\n```\n\nIn this example, the search endpoint is vulnerable to OS command injection. By leveraging GitLab's Static Application Security Testing ([SAST](https://docs.gitlab.com/ee/user/application_security/sast/)) component, this vulnerability would be detected during the CI/CD pipeline.\n\n#### Integrate SAST scanning to detect vulnerabilities\n\nGitLab SAST automatically analyzes your code for security vulnerabilities. Here’s how it can be integrated into your `.gitlab-ci.yml` file to scan for issues:\n\n```python\n\nstages:\n  - build\n  - test\n  - sast\n  - deploy\n\nbuild_job:\n  stage: build\n  script:\n    - echo \"Building the project...\"\n    - # Your build commands here\n\ntest_job:\n  stage: test\n  script:\n    - python test_server.py > test-reports/results.xml\n  artifacts:\n    when: always\n    reports:\n      junit: test-reports/results.xml\n    paths:\n      - test-reports/results.xml\n\nsast_job:\n  stage: sast\n  script:\n    - echo \"Running SAST...\"\n  artifacts:\n    reports:\n      sast: gl-sast-report.json\n  only:\n    - branches\n\npages:\n  stage: deploy\n  script:\n    - mv test-reports public\n  artifacts:\n    paths:\n      - public\n\n```\n\nIn this configuration, the `sast_job` stage runs SAST to detect vulnerabilities in the code, producing a report (`gl-sast-report.json`) that will be included in the pipeline artifacts! By integrating security policies and robust testing frameworks, GitLab Duo helps customers ensure that their AI-generated code is both efficient and secure.\n\n## Get started today\nThe integration of AI in software development brings significant benefits but also introduces new challenges. By using tools like GitLab Duo and GitLab Pages, developers can ensure that their AI-generated code is secure, well-tested, and reliable. Explore these tools today and join the conversation on enhancing AI security and testing!\n\n> [Start a trial of GitLab Ultimate](https://gitlab.com/-/trial_registrations/new?glm_source=about.gitlab.com/blog&glm_content=default-saas-trial) today to access GitLab Duo and GitLab Pages.\n\n## Read more of the \"Developing GitLab Duo\" series\n\n- [Developing GitLab Duo: How we validate and test AI models at scale](https://about.gitlab.com/blog/developing-gitlab-duo-how-we-validate-and-test-ai-models-at-scale/)\n- [Developing GitLab Duo: AI Impact analytics dashboard measures the ROI of AI](https://about.gitlab.com/blog/developing-gitlab-duo-ai-impact-analytics-dashboard-measures-the-roi-of-ai/)\n- [Developing GitLab Duo: How we are dogfooding our AI features](https://about.gitlab.com/blog/developing-gitlab-duo-how-we-are-dogfooding-our-ai-features/)\n- [Developing GitLab Duo: Blending AI and Root Cause Analysis to fix CI/CD pipelines](https://about.gitlab.com/blog/developing-gitlab-duo-blending-ai-and-root-cause-analysis-to-fix-ci-cd/)\n",[23,24,25,26],"AI/ML","DevSecOps","tutorial","security","yml",{},true,"/en-us/blog/how-gitlab-duo-helps-secure-and-thoroughly-test-ai-generated-code",{"title":15,"description":16,"ogTitle":15,"ogDescription":16,"noIndex":12,"ogImage":19,"ogUrl":32,"ogSiteName":33,"ogType":34,"canonicalUrls":32},"https://about.gitlab.com/blog/how-gitlab-duo-helps-secure-and-thoroughly-test-ai-generated-code","https://about.gitlab.com","article","en-us/blog/how-gitlab-duo-helps-secure-and-thoroughly-test-ai-generated-code",[37,38,25,26],"aiml","devsecops","ZUSLbZLT6Ac9Zk0x9Bqa_JxVPl0LSmAXFjDz5OCfX9Y",{"data":41},{"logo":42,"freeTrial":47,"sales":52,"login":57,"items":62,"search":370,"minimal":401,"duo":420,"pricingDeployment":430},{"config":43},{"href":44,"dataGaName":45,"dataGaLocation":46},"/","gitlab logo","header",{"text":48,"config":49},"Get free trial",{"href":50,"dataGaName":51,"dataGaLocation":46},"https://gitlab.com/-/trial_registrations/new?glm_source=about.gitlab.com&glm_content=default-saas-trial/","free trial",{"text":53,"config":54},"Talk to sales",{"href":55,"dataGaName":56,"dataGaLocation":46},"/sales/","sales",{"text":58,"config":59},"Sign in",{"href":60,"dataGaName":61,"dataGaLocation":46},"https://gitlab.com/users/sign_in/","sign in",[63,90,185,190,291,351],{"text":64,"config":65,"cards":67},"Platform",{"dataNavLevelOne":66},"platform",[68,74,82],{"title":64,"description":69,"link":70},"The intelligent orchestration platform for DevSecOps",{"text":71,"config":72},"Explore our Platform",{"href":73,"dataGaName":66,"dataGaLocation":46},"/platform/",{"title":75,"description":76,"link":77},"GitLab Duo Agent Platform","Agentic AI for the entire software lifecycle",{"text":78,"config":79},"Meet GitLab Duo",{"href":80,"dataGaName":81,"dataGaLocation":46},"/gitlab-duo-agent-platform/","gitlab duo agent platform",{"title":83,"description":84,"link":85},"Why GitLab","See the top reasons enterprises choose GitLab",{"text":86,"config":87},"Learn more",{"href":88,"dataGaName":89,"dataGaLocation":46},"/why-gitlab/","why gitlab",{"text":91,"left":29,"config":92,"link":94,"lists":98,"footer":167},"Product",{"dataNavLevelOne":93},"solutions",{"text":95,"config":96},"View all Solutions",{"href":97,"dataGaName":93,"dataGaLocation":46},"/solutions/",[99,123,146],{"title":100,"description":101,"link":102,"items":107},"Automation","CI/CD and automation to accelerate deployment",{"config":103},{"icon":104,"href":105,"dataGaName":106,"dataGaLocation":46},"AutomatedCodeAlt","/solutions/delivery-automation/","automated software delivery",[108,112,115,119],{"text":109,"config":110},"CI/CD",{"href":111,"dataGaLocation":46,"dataGaName":109},"/solutions/continuous-integration/",{"text":75,"config":113},{"href":80,"dataGaLocation":46,"dataGaName":114},"gitlab duo agent platform - product menu",{"text":116,"config":117},"Source Code Management",{"href":118,"dataGaLocation":46,"dataGaName":116},"/solutions/source-code-management/",{"text":120,"config":121},"Automated Software Delivery",{"href":105,"dataGaLocation":46,"dataGaName":122},"Automated software delivery",{"title":124,"description":125,"link":126,"items":131},"Security","Deliver code faster without compromising security",{"config":127},{"href":128,"dataGaName":129,"dataGaLocation":46,"icon":130},"/solutions/application-security-testing/","security and compliance","ShieldCheckLight",[132,136,141],{"text":133,"config":134},"Application Security Testing",{"href":128,"dataGaName":135,"dataGaLocation":46},"Application security testing",{"text":137,"config":138},"Software Supply Chain Security",{"href":139,"dataGaLocation":46,"dataGaName":140},"/solutions/supply-chain/","Software supply chain security",{"text":142,"config":143},"Software Compliance",{"href":144,"dataGaName":145,"dataGaLocation":46},"/solutions/software-compliance/","software compliance",{"title":147,"link":148,"items":153},"Measurement",{"config":149},{"icon":150,"href":151,"dataGaName":152,"dataGaLocation":46},"DigitalTransformation","/solutions/visibility-measurement/","visibility and measurement",[154,158,162],{"text":155,"config":156},"Visibility & Measurement",{"href":151,"dataGaLocation":46,"dataGaName":157},"Visibility and Measurement",{"text":159,"config":160},"Value Stream Management",{"href":161,"dataGaLocation":46,"dataGaName":159},"/solutions/value-stream-management/",{"text":163,"config":164},"Analytics & Insights",{"href":165,"dataGaLocation":46,"dataGaName":166},"/solutions/analytics-and-insights/","Analytics and insights",{"title":168,"items":169},"GitLab for",[170,175,180],{"text":171,"config":172},"Enterprise",{"href":173,"dataGaLocation":46,"dataGaName":174},"/enterprise/","enterprise",{"text":176,"config":177},"Small Business",{"href":178,"dataGaLocation":46,"dataGaName":179},"/small-business/","small business",{"text":181,"config":182},"Public Sector",{"href":183,"dataGaLocation":46,"dataGaName":184},"/solutions/public-sector/","public sector",{"text":186,"config":187},"Pricing",{"href":188,"dataGaName":189,"dataGaLocation":46,"dataNavLevelOne":189},"/pricing/","pricing",{"text":191,"config":192,"link":194,"lists":198,"feature":278},"Resources",{"dataNavLevelOne":193},"resources",{"text":195,"config":196},"View all resources",{"href":197,"dataGaName":193,"dataGaLocation":46},"/resources/",[199,232,250],{"title":200,"items":201},"Getting started",[202,207,212,217,222,227],{"text":203,"config":204},"Install",{"href":205,"dataGaName":206,"dataGaLocation":46},"/install/","install",{"text":208,"config":209},"Quick start guides",{"href":210,"dataGaName":211,"dataGaLocation":46},"/get-started/","quick setup checklists",{"text":213,"config":214},"Learn",{"href":215,"dataGaLocation":46,"dataGaName":216},"https://university.gitlab.com/","learn",{"text":218,"config":219},"Product documentation",{"href":220,"dataGaName":221,"dataGaLocation":46},"https://docs.gitlab.com/","product documentation",{"text":223,"config":224},"Best practice videos",{"href":225,"dataGaName":226,"dataGaLocation":46},"/getting-started-videos/","best practice videos",{"text":228,"config":229},"Integrations",{"href":230,"dataGaName":231,"dataGaLocation":46},"/integrations/","integrations",{"title":233,"items":234},"Discover",[235,240,245],{"text":236,"config":237},"Customer success stories",{"href":238,"dataGaName":239,"dataGaLocation":46},"/customers/","customer success stories",{"text":241,"config":242},"Blog",{"href":243,"dataGaName":244,"dataGaLocation":46},"/blog/","blog",{"text":246,"config":247},"Remote",{"href":248,"dataGaName":249,"dataGaLocation":46},"https://handbook.gitlab.com/handbook/company/culture/all-remote/","remote",{"title":251,"items":252},"Connect",[253,258,263,268,273],{"text":254,"config":255},"GitLab Services",{"href":256,"dataGaName":257,"dataGaLocation":46},"/services/","services",{"text":259,"config":260},"Community",{"href":261,"dataGaName":262,"dataGaLocation":46},"/community/","community",{"text":264,"config":265},"Forum",{"href":266,"dataGaName":267,"dataGaLocation":46},"https://forum.gitlab.com/","forum",{"text":269,"config":270},"Events",{"href":271,"dataGaName":272,"dataGaLocation":46},"/events/","events",{"text":274,"config":275},"Partners",{"href":276,"dataGaName":277,"dataGaLocation":46},"/partners/","partners",{"backgroundColor":279,"textColor":280,"text":281,"image":282,"link":286},"#2f2a6b","#fff","Insights for the future of software development",{"altText":283,"config":284},"the source promo card",{"src":285},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758208064/dzl0dbift9xdizyelkk4.svg",{"text":287,"config":288},"Read the latest",{"href":289,"dataGaName":290,"dataGaLocation":46},"/the-source/","the source",{"text":292,"config":293,"lists":295},"Company",{"dataNavLevelOne":294},"company",[296],{"items":297},[298,303,309,311,316,321,326,331,336,341,346],{"text":299,"config":300},"About",{"href":301,"dataGaName":302,"dataGaLocation":46},"/company/","about",{"text":304,"config":305,"footerGa":308},"Jobs",{"href":306,"dataGaName":307,"dataGaLocation":46},"/jobs/","jobs",{"dataGaName":307},{"text":269,"config":310},{"href":271,"dataGaName":272,"dataGaLocation":46},{"text":312,"config":313},"Leadership",{"href":314,"dataGaName":315,"dataGaLocation":46},"/company/team/e-group/","leadership",{"text":317,"config":318},"Team",{"href":319,"dataGaName":320,"dataGaLocation":46},"/company/team/","team",{"text":322,"config":323},"Handbook",{"href":324,"dataGaName":325,"dataGaLocation":46},"https://handbook.gitlab.com/","handbook",{"text":327,"config":328},"Investor relations",{"href":329,"dataGaName":330,"dataGaLocation":46},"https://ir.gitlab.com/","investor relations",{"text":332,"config":333},"Trust Center",{"href":334,"dataGaName":335,"dataGaLocation":46},"/security/","trust center",{"text":337,"config":338},"AI Transparency Center",{"href":339,"dataGaName":340,"dataGaLocation":46},"/ai-transparency-center/","ai transparency center",{"text":342,"config":343},"Newsletter",{"href":344,"dataGaName":345,"dataGaLocation":46},"/company/contact/#contact-forms","newsletter",{"text":347,"config":348},"Press",{"href":349,"dataGaName":350,"dataGaLocation":46},"/press/","press",{"text":352,"config":353,"lists":354},"Contact us",{"dataNavLevelOne":294},[355],{"items":356},[357,360,365],{"text":53,"config":358},{"href":55,"dataGaName":359,"dataGaLocation":46},"talk to sales",{"text":361,"config":362},"Support portal",{"href":363,"dataGaName":364,"dataGaLocation":46},"https://support.gitlab.com","support portal",{"text":366,"config":367},"Customer portal",{"href":368,"dataGaName":369,"dataGaLocation":46},"https://customers.gitlab.com/customers/sign_in/","customer portal",{"close":371,"login":372,"suggestions":379},"Close",{"text":373,"link":374},"To search repositories and projects, login to",{"text":375,"config":376},"gitlab.com",{"href":60,"dataGaName":377,"dataGaLocation":378},"search login","search",{"text":380,"default":381},"Suggestions",[382,384,388,390,394,398],{"text":75,"config":383},{"href":80,"dataGaName":75,"dataGaLocation":378},{"text":385,"config":386},"Code Suggestions (AI)",{"href":387,"dataGaName":385,"dataGaLocation":378},"/solutions/code-suggestions/",{"text":109,"config":389},{"href":111,"dataGaName":109,"dataGaLocation":378},{"text":391,"config":392},"GitLab on AWS",{"href":393,"dataGaName":391,"dataGaLocation":378},"/partners/technology-partners/aws/",{"text":395,"config":396},"GitLab on Google Cloud",{"href":397,"dataGaName":395,"dataGaLocation":378},"/partners/technology-partners/google-cloud-platform/",{"text":399,"config":400},"Why GitLab?",{"href":88,"dataGaName":399,"dataGaLocation":378},{"freeTrial":402,"mobileIcon":407,"desktopIcon":412,"secondaryButton":415},{"text":403,"config":404},"Start free trial",{"href":405,"dataGaName":51,"dataGaLocation":406},"https://gitlab.com/-/trials/new/","nav",{"altText":408,"config":409},"Gitlab Icon",{"src":410,"dataGaName":411,"dataGaLocation":406},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203874/jypbw1jx72aexsoohd7x.svg","gitlab icon",{"altText":408,"config":413},{"src":414,"dataGaName":411,"dataGaLocation":406},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203875/gs4c8p8opsgvflgkswz9.svg",{"text":416,"config":417},"Get Started",{"href":418,"dataGaName":419,"dataGaLocation":406},"https://gitlab.com/-/trial_registrations/new?glm_source=about.gitlab.com/compare/gitlab-vs-github/","get started",{"freeTrial":421,"mobileIcon":426,"desktopIcon":428},{"text":422,"config":423},"Learn more about GitLab Duo",{"href":424,"dataGaName":425,"dataGaLocation":406},"/gitlab-duo/","gitlab duo",{"altText":408,"config":427},{"src":410,"dataGaName":411,"dataGaLocation":406},{"altText":408,"config":429},{"src":414,"dataGaName":411,"dataGaLocation":406},{"freeTrial":431,"mobileIcon":436,"desktopIcon":438},{"text":432,"config":433},"Back to pricing",{"href":188,"dataGaName":434,"dataGaLocation":406,"icon":435},"back to pricing","GoBack",{"altText":408,"config":437},{"src":410,"dataGaName":411,"dataGaLocation":406},{"altText":408,"config":439},{"src":414,"dataGaName":411,"dataGaLocation":406},{"title":441,"button":442,"config":447},"See how agentic AI transforms software delivery",{"text":443,"config":444},"Watch GitLab Transcend now",{"href":445,"dataGaName":446,"dataGaLocation":46},"/events/transcend/virtual/","transcend event",{"layout":448,"icon":449},"release","AiStar",{"data":451},{"text":452,"source":453,"edit":459,"contribute":464,"config":469,"items":474,"minimal":679},"Git is a trademark of Software Freedom Conservancy and our use of 'GitLab' is under license",{"text":454,"config":455},"View page source",{"href":456,"dataGaName":457,"dataGaLocation":458},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/","page source","footer",{"text":460,"config":461},"Edit this page",{"href":462,"dataGaName":463,"dataGaLocation":458},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/content/","web ide",{"text":465,"config":466},"Please contribute",{"href":467,"dataGaName":468,"dataGaLocation":458},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/CONTRIBUTING.md/","please contribute",{"twitter":470,"facebook":471,"youtube":472,"linkedin":473},"https://twitter.com/gitlab","https://www.facebook.com/gitlab","https://www.youtube.com/channel/UCnMGQ8QHMAnVIsI3xJrihhg","https://www.linkedin.com/company/gitlab-com",[475,522,574,618,645],{"title":186,"links":476,"subMenu":491},[477,481,486],{"text":478,"config":479},"View plans",{"href":188,"dataGaName":480,"dataGaLocation":458},"view plans",{"text":482,"config":483},"Why Premium?",{"href":484,"dataGaName":485,"dataGaLocation":458},"/pricing/premium/","why premium",{"text":487,"config":488},"Why Ultimate?",{"href":489,"dataGaName":490,"dataGaLocation":458},"/pricing/ultimate/","why ultimate",[492],{"title":493,"links":494},"Contact Us",[495,498,500,502,507,512,517],{"text":496,"config":497},"Contact sales",{"href":55,"dataGaName":56,"dataGaLocation":458},{"text":361,"config":499},{"href":363,"dataGaName":364,"dataGaLocation":458},{"text":366,"config":501},{"href":368,"dataGaName":369,"dataGaLocation":458},{"text":503,"config":504},"Status",{"href":505,"dataGaName":506,"dataGaLocation":458},"https://status.gitlab.com/","status",{"text":508,"config":509},"Terms of use",{"href":510,"dataGaName":511,"dataGaLocation":458},"/terms/","terms of use",{"text":513,"config":514},"Privacy statement",{"href":515,"dataGaName":516,"dataGaLocation":458},"/privacy/","privacy statement",{"text":518,"config":519},"Cookie preferences",{"dataGaName":520,"dataGaLocation":458,"id":521,"isOneTrustButton":29},"cookie preferences","ot-sdk-btn",{"title":91,"links":523,"subMenu":532},[524,528],{"text":525,"config":526},"DevSecOps platform",{"href":73,"dataGaName":527,"dataGaLocation":458},"devsecops platform",{"text":529,"config":530},"AI-Assisted Development",{"href":424,"dataGaName":531,"dataGaLocation":458},"ai-assisted development",[533],{"title":534,"links":535},"Topics",[536,541,546,551,556,559,564,569],{"text":537,"config":538},"CICD",{"href":539,"dataGaName":540,"dataGaLocation":458},"/topics/ci-cd/","cicd",{"text":542,"config":543},"GitOps",{"href":544,"dataGaName":545,"dataGaLocation":458},"/topics/gitops/","gitops",{"text":547,"config":548},"DevOps",{"href":549,"dataGaName":550,"dataGaLocation":458},"/topics/devops/","devops",{"text":552,"config":553},"Version Control",{"href":554,"dataGaName":555,"dataGaLocation":458},"/topics/version-control/","version control",{"text":24,"config":557},{"href":558,"dataGaName":38,"dataGaLocation":458},"/topics/devsecops/",{"text":560,"config":561},"Cloud Native",{"href":562,"dataGaName":563,"dataGaLocation":458},"/topics/cloud-native/","cloud native",{"text":565,"config":566},"AI for Coding",{"href":567,"dataGaName":568,"dataGaLocation":458},"/topics/devops/ai-for-coding/","ai for coding",{"text":570,"config":571},"Agentic AI",{"href":572,"dataGaName":573,"dataGaLocation":458},"/topics/agentic-ai/","agentic ai",{"title":575,"links":576},"Solutions",[577,579,581,586,590,593,597,600,602,605,608,613],{"text":133,"config":578},{"href":128,"dataGaName":133,"dataGaLocation":458},{"text":122,"config":580},{"href":105,"dataGaName":106,"dataGaLocation":458},{"text":582,"config":583},"Agile development",{"href":584,"dataGaName":585,"dataGaLocation":458},"/solutions/agile-delivery/","agile delivery",{"text":587,"config":588},"SCM",{"href":118,"dataGaName":589,"dataGaLocation":458},"source code management",{"text":537,"config":591},{"href":111,"dataGaName":592,"dataGaLocation":458},"continuous integration & delivery",{"text":594,"config":595},"Value stream management",{"href":161,"dataGaName":596,"dataGaLocation":458},"value stream management",{"text":542,"config":598},{"href":599,"dataGaName":545,"dataGaLocation":458},"/solutions/gitops/",{"text":171,"config":601},{"href":173,"dataGaName":174,"dataGaLocation":458},{"text":603,"config":604},"Small business",{"href":178,"dataGaName":179,"dataGaLocation":458},{"text":606,"config":607},"Public sector",{"href":183,"dataGaName":184,"dataGaLocation":458},{"text":609,"config":610},"Education",{"href":611,"dataGaName":612,"dataGaLocation":458},"/solutions/education/","education",{"text":614,"config":615},"Financial services",{"href":616,"dataGaName":617,"dataGaLocation":458},"/solutions/finance/","financial services",{"title":191,"links":619},[620,622,624,626,629,631,633,635,637,639,641,643],{"text":203,"config":621},{"href":205,"dataGaName":206,"dataGaLocation":458},{"text":208,"config":623},{"href":210,"dataGaName":211,"dataGaLocation":458},{"text":213,"config":625},{"href":215,"dataGaName":216,"dataGaLocation":458},{"text":218,"config":627},{"href":220,"dataGaName":628,"dataGaLocation":458},"docs",{"text":241,"config":630},{"href":243,"dataGaName":244,"dataGaLocation":458},{"text":236,"config":632},{"href":238,"dataGaName":239,"dataGaLocation":458},{"text":246,"config":634},{"href":248,"dataGaName":249,"dataGaLocation":458},{"text":254,"config":636},{"href":256,"dataGaName":257,"dataGaLocation":458},{"text":259,"config":638},{"href":261,"dataGaName":262,"dataGaLocation":458},{"text":264,"config":640},{"href":266,"dataGaName":267,"dataGaLocation":458},{"text":269,"config":642},{"href":271,"dataGaName":272,"dataGaLocation":458},{"text":274,"config":644},{"href":276,"dataGaName":277,"dataGaLocation":458},{"title":292,"links":646},[647,649,651,653,655,657,659,663,668,670,672,674],{"text":299,"config":648},{"href":301,"dataGaName":294,"dataGaLocation":458},{"text":304,"config":650},{"href":306,"dataGaName":307,"dataGaLocation":458},{"text":312,"config":652},{"href":314,"dataGaName":315,"dataGaLocation":458},{"text":317,"config":654},{"href":319,"dataGaName":320,"dataGaLocation":458},{"text":322,"config":656},{"href":324,"dataGaName":325,"dataGaLocation":458},{"text":327,"config":658},{"href":329,"dataGaName":330,"dataGaLocation":458},{"text":660,"config":661},"Sustainability",{"href":662,"dataGaName":660,"dataGaLocation":458},"/sustainability/",{"text":664,"config":665},"Diversity, inclusion and belonging (DIB)",{"href":666,"dataGaName":667,"dataGaLocation":458},"/diversity-inclusion-belonging/","Diversity, inclusion and belonging",{"text":332,"config":669},{"href":334,"dataGaName":335,"dataGaLocation":458},{"text":342,"config":671},{"href":344,"dataGaName":345,"dataGaLocation":458},{"text":347,"config":673},{"href":349,"dataGaName":350,"dataGaLocation":458},{"text":675,"config":676},"Modern Slavery Transparency Statement",{"href":677,"dataGaName":678,"dataGaLocation":458},"https://handbook.gitlab.com/handbook/legal/modern-slavery-act-transparency-statement/","modern slavery transparency statement",{"items":680},[681,684,687],{"text":682,"config":683},"Terms",{"href":510,"dataGaName":511,"dataGaLocation":458},{"text":685,"config":686},"Cookies",{"dataGaName":520,"dataGaLocation":458,"id":521,"isOneTrustButton":29},{"text":688,"config":689},"Privacy",{"href":515,"dataGaName":516,"dataGaLocation":458},[691],{"id":692,"title":693,"body":8,"config":694,"content":696,"description":8,"extension":27,"meta":700,"navigation":29,"path":701,"seo":702,"stem":703,"__hash__":704},"blogAuthors/en-us/blog/authors/david-oregan.yml","David Oregan",{"template":695},"BlogAuthor",{"name":18,"config":697},{"headshot":698,"ctfId":699},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1749659853/Blog/Author%20Headshots/oregand-headshot.png","oregand",{},"/en-us/blog/authors/david-oregan",{},"en-us/blog/authors/david-oregan","CX5gLc3Gs5FrmvpMNVkBtC5zRi3vj8l3wJGnW0iSa6Y",[706,719,731],{"content":707,"config":717},{"title":708,"description":709,"authors":710,"heroImage":712,"date":713,"body":714,"category":9,"tags":715},"10 AI prompts to speed your team’s software delivery","Eliminate review backlogs, security delays, and coordination overhead with ready-to-use AI prompts covering every stage of the software lifecycle.",[711],"Chandler Gibbons","https://res.cloudinary.com/about-gitlab-com/image/upload/v1772632341/duj8vaznbhtyxxhodb17.png","2026-03-04","AI-assisted coding tools are helping developers generate code faster than ever. So why aren’t teams _shipping_ faster?\n\nBecause coding is only 20% of the software delivery lifecycle, the remaining 80% becomes the bottleneck: code review backlogs grow, security scanning can’t keep pace, documentation falls behind, and manual coordination overhead increases.\n\nThe good news is that the same AI capabilities that accelerate individual coding can eliminate these team-level delays. You just need to apply AI across your entire software lifecycle, not only during the coding phase.\n\nBelow are 10 ready-to-use prompts from the [GitLab Duo Agent Platform Prompt Library](https://about.gitlab.com/gitlab-duo/prompt-library/) that help teams overcome common obstacles to faster software delivery. Each prompt addresses a specific slowdown that emerges when individual productivity increases without corresponding improvements in team processes.\n\n## How do you move code review from bottleneck to accelerator?\nDevelopers generate merge requests faster with AI assistance, but human reviewers can quickly become overwhelmed as code review cycles stretch from hours to days. AI can handle routine review tasks, freeing reviewers to focus on architecture and business logic instead of catching basic logical errors and API contract violations.\n\n### Review MR for logical errors\n**Complexity**: Beginner\n\n**Category**: Code Review\n\n**Prompt from library**:\n\n\n```text\nReview this MR for logical errors, edge cases, and potential bugs: [MR URL or paste code]\n```\n\n**Why it helps**: Automated linters catch syntax issues, but logical errors require understanding intent. This prompt catches bugs before human reviewers even look at the code, reducing review cycles from multiple rounds to often just one approval.\n\n### Identify breaking changes in MR\n**Complexity**: Beginner\n\n**Category**: Code Review\n\n**Prompt from library**:\n\n\n```text\nDoes this MR introduce any breaking changes?\n\nChanges:\n[PASTE CODE DIFF]\n\nCheck for:\n1. API signature changes\n2. Removed or renamed public methods\n3. Changed return types\n4. Modified database schemas\n5. Breaking configuration changes\n```\n\n**Why it helps**: Breaking changes discovered during deployment can cause rollbacks and incidents. This prompt shifts that discovery left to the MR stage, when fixes are faster and less expensive.\n\n## How can you shift security left without slowing down?\nSecurity scans generate hundreds of findings. Security teams manually triage each one while developers wait for approval to deploy. Most findings are false positives or low-risk issues, but identifying the real threats requires expertise and time. AI can prioritize findings by actual exploitability and auto-remediate common vulnerabilities, allowing security teams to focus on the threats that matter.\n\n### Analyze security scan results\n**Complexity**: Intermediate\n\n**Category**: Security\n\n**Agent**: Duo Security Analyst\n\n**Prompt from library**:\n\n\n```text\n@security_analyst Analyze these security scan results:\n\n[PASTE SCAN OUTPUT]\n\nFor each finding:\n1. Assess real risk vs false positive\n2. Explain the vulnerability\n3. Suggest remediation\n4. Prioritize by severity\n```\n\n**Why it helps**: Most security scan findings are false positives or low-risk issues. This prompt helps security teams focus on the findings that actually matter, reducing remediation time from weeks to days.\n\n### Review code for security issues\n**Complexity**: Intermediate\n\n**Category**: Security\n\n**Agent**: Duo Security Analyst\n\n**Prompt from library**:\n\n```text\n@security_analyst Review this code for security issues:\n\n[PASTE CODE]\n\nCheck for:\n1. Injection vulnerabilities\n2. Authentication/authorization flaws\n3. Data exposure risks\n4. Insecure dependencies\n5. Cryptographic issues\n```\n\n**Why it helps**: Traditional security reviews happen after code is written. This prompt enables developers to find and fix security issues before creating an MR, eliminating the back and forth that delays deployments.\n\n## How do you keep documentation current as code changes?\nCode changes faster than documentation. Onboarding new developers takes weeks because docs are outdated or missing. Teams know documentation is important, but it always gets deferred when deadlines approach. Automating documentation generation and updates as part of your standard workflow ensures docs stay current without adding manual work.\n\n### Generate release notes from MRs\n**Complexity**: Beginner\n\n**Category**: Documentation\n\n**Prompt from library**:\n\n```text\nGenerate release notes for these merged MRs:\n[LIST MR URLs or paste titles]\n\nGroup by:\n1. New features\n2. Bug fixes\n3. Performance improvements\n4. Breaking changes\n5. Deprecations\n```\n\n**Why it helps**: Manual release note compilation takes hours and often includes errors or omissions. Automated generation ensures every release has comprehensive notes without adding work to your release process.\n\n### Update documentation after code changes\n**Complexity**: Beginner\n\n**Category**: Documentation\n\n**Prompt from library**:\n\n```text\nI changed this code:\n\n[PASTE CODE CHANGES]\n\nWhat documentation needs updating? Check:\n1. README files\n2. API documentation\n3. Architecture diagrams\n4. Onboarding guides\n```\n\n**Why it helps**: Documentation drift happens because teams forget which docs need updates after code changes. This prompt makes documentation maintenance part of your development workflow, not a separate task that gets deferred.\n\n## How do you break down planning complexity?\nLarge features get stuck in planning. Teams spend weeks in meetings trying to scope work and identify dependencies. The complexity feels overwhelming, and it's hard to know where to start. AI can systematically decompose complex work into concrete, implementable tasks with clear dependencies and acceptance criteria, transforming weeks of planning into focused implementation.\n\n### Break down epic into issues\n**Complexity**: Intermediate\n\n**Category**: Documentation\n\n**Agent**: Duo Planner\n\n**Prompt from library**:\n\n```text\nBreak down this epic into implementable issues:\n\n[EPIC DESCRIPTION]\n\nConsider:\n1. Technical dependencies\n2. Reasonable issue sizes\n3. Clear acceptance criteria\n4. Logical implementation order\n```\n\n**Why it helps**: This prompt transforms a week of planning meetings into 30 minutes of AI-assisted decomposition followed by team review. Teams start implementation sooner with clearer direction.\n\n## How can you expand test coverage without expanding effort?\nDevelopers are writing code faster, but if testing doesn't keep pace, test coverage decreases and bugs slip through. Writing comprehensive tests manually is time-consuming, and developers often miss edge cases under deadline pressure. Generating tests automatically means developers can review and refine rather than write from scratch, maintaining quality without sacrificing velocity.\n\n### Generate unit tests\n**Complexity**: Beginner\n\n**Category**: Testing\n\n**Prompt from library**:\n\n```text\nGenerate unit tests for this function:\n\n[PASTE FUNCTION]\n\nInclude tests for:\n1. Happy path\n2. Edge cases\n3. Error conditions\n4. Boundary values\n5. Invalid inputs\n```\n\n**Why it helps**: Writing tests manually is time consuming, and developers often miss edge cases. This prompt generates thorough test suites in seconds, which developers can review and adjust rather than write from scratch.\n\n### Review test coverage gaps\n**Complexity**: Beginner\n\n**Category**: Testing\n\n**Prompt from library**:\n\n```text\nAnalyze test coverage for [MODULE/COMPONENT]:\n\nCurrent coverage: [PERCENTAGE]\n\nIdentify:\n1. Untested functions/methods\n2. Uncovered edge cases\n3. Missing error scenario tests\n4. Integration points without tests\n5. Priority areas to test next\n```\n\n**Why it helps**: This prompt reveals blind spots in your test suite before they cause production incidents. Teams can systematically improve coverage where it matters most.\n\n## How do you reduce mean time to resolution when debugging?\nProduction incidents take hours to diagnose. Developers wade through logs and stack traces while customers experience downtime. Every minute of debugging is a minute of lost productivity and potential revenue. AI can accelerate root cause analysis by parsing complex error messages and suggesting specific fixes, cutting diagnostic time from hours to minutes.\n\n### Debug failing pipeline\n**Complexity**: Beginner\n\n**Category**: Debugging\n\n**Prompt from library**:\n\n```text\nThis pipeline is failing:\n\nJob: [JOB NAME]\nStage: [STAGE]\nError: [PASTE ERROR MESSAGE/LOG]\n\nHelp me:\n1. Identify the root cause\n2. Suggest a fix\n3. Explain why it started failing\n4. Prevent similar issues\n```\n\n**Why it helps**: CI/CD failures block entire teams. This prompt diagnoses failures in seconds instead of the 15-30 minutes developers typically spend investigating, keeping deployment velocity high.\n\n## Moving from individual gains to team acceleration\nThese prompts represent a shift in how teams apply AI to software delivery. Rather than focusing solely on individual developer productivity, they address the coordination, quality, and knowledge-sharing challenges that actually constrain team velocity.\n\nThe [complete prompt library](https://about.gitlab.com/gitlab-duo/prompt-library/) contains more than 100 prompts across all stages of the software lifecycle: planning, development, security, testing, deployment, and operations. Each prompt is tagged by complexity level (Beginner, Intermediate, Advanced) and categorized by use case, making it easy to find the right starting point for your team.\n\nStart with prompts tagged “Beginner” that address your team’s most pressing obstacles. As your team builds confidence, explore intermediate and advanced prompts that enable more sophisticated workflows. The goal is not just faster coding — it's faster, safer, higher-quality software delivery from planning through production.",[23,716],"DevOps platform",{"featured":12,"template":13,"slug":718},"10-ai-prompts-to-speed-your-teams-software-delivery",{"content":720,"config":729},{"title":721,"description":722,"heroImage":723,"authors":724,"date":726,"body":727,"category":9,"tags":728},"AI can detect vulnerabilities, but who governs risk?","AI-assisted vulnerability detection is developing fast, but the harder challenges of enforcement, governance, and supply chain security require a holistic platform.","https://res.cloudinary.com/about-gitlab-com/image/upload/v1772195014/ooezwusxjl1f7ijfmbvj.png",[725],"Omer Azaria","2026-02-27","Anthropic recently announced Claude Code Security, an AI system that detects vulnerabilities and proposes fixes. The market reacted immediately, with security stocks dipping as investors questioned whether AI might replace traditional AppSec tools. The question on everyone's mind: If AI can write code and secure it, is application security about to become obsolete?\n\nIf security only meant scanning code, the answer might be yes. But enterprise security has never been about detection alone.\n\nOrganizations are not asking whether AI can find vulnerabilities. They are asking three much harder questions: \n\n* Is what we are about to ship safe?  \n* Has our risk posture changed as environments evolve and dependencies, third-party services, tools, and infrastructure continuously shift?  \n* How do we govern a codebase that is increasingly assembled by AI and third-party sources, and that we are still accountable for? \n\nThose questions require a platform answer: Detection surfaces risk, but governance determines what happens next. \n\n[GitLab](https://about.gitlab.com/) is the orchestration layer built to govern the software lifecycle end-to-end. It gives teams the enforcement, visibility, and auditability they need to keep pace with the speed of AI-assisted development.\n\n## Trusting AI requires governing risk\n\nAI systems are rapidly getting better at identifying vulnerabilities and suggesting fixes. This is a meaningful and welcome advancement, but analysis is not accountability.\n\nAI cannot enforce company policy or define acceptable risk on its own. Humans must set the boundaries, policies, and guardrails that agents operate within, establishing separation of duties, ensuring audit trails, and maintaining consistent controls across thousands of repositories and teams. Trust in agents comes not from autonomy alone, but from clearly defined governance set by people. \n\nIn an [agentic world](https://about.gitlab.com/topics/agentic-ai/), where software is increasingly written and modified by autonomous systems, governance becomes more important, not less. The more autonomy organizations grant to AI, the stronger the governance must be.\n\nGovernance is not friction. It is the foundation that makes AI-assisted development trustworthy at scale.\n\n## LLMs see code, but platforms see context\n\nA large language model ([LLM](https://about.gitlab.com/blog/what-is-a-large-language-model-llm/)) evaluates code in isolation. An enterprise application security platform understands context. This difference matters because risk decisions are contextual:\n\n* Who authored the change?  \n* How critical is the application to the business?  \n* How does it interact with infrastructure and dependencies?  \n* Does the vulnerability exist in code that is actually reachable in production, or is it buried in a dependency that never executes?  \n* Is it actually exploitable in production, given how the application runs, its APIs, and the environment around it?\n\nSecurity decisions depend on this context. Without it, detection produces noisy alerts that slow down development rather than reducing risk. With it, organizations can triage quickly and manage risk effectively. Context evolves continuously as software changes, which means governance cannot be a one-time decision. \n\n## Static scans can’t keep up with dynamic risk\n\nSoftware risk is dynamic. Dependencies change, environments evolve, and systems interact in ways no single analysis can fully predict. A clean scan at one moment does not guarantee safety at release.\n\nEnterprise security depends on continuous assurance: controls embedded directly into development workflows that evaluate risk as software is built, tested, and deployed.\n\nDetection provides insight. Governance provides trust. Continuous governance is what allows organizations to ship safely at scale.\n\n## Governing the agentic future\n\nAI is reshaping how software is created. The question is no longer whether teams will use AI, but how safely they can scale it.\n\nSoftware today is assembled as much as it is written, from AI-generated code, open-source libraries, and third-party dependencies that span thousands of projects. Governing what ships across all of those sources is the hardest and most consequential part of application security, and it is the part that no developer-side tool is built to address. \n\nAs an intelligent orchestration platform, GitLab is built to address this problem. GitLab Ultimate embeds governance, policy enforcement, security scanning, and auditability directly into the workflows where software is planned, built, and shipped, so security teams can govern at the speed of AI. \n\nAI will accelerate development dramatically. The organizations that benefit most from AI will not be those with the smartest assistants alone, but those that build trust through strong governance.\n\n> To learn how GitLab helps organizations [govern and ship AI-generated code](https://about.gitlab.com/solutions/software-compliance/?utm_medium=blog&utm_campaign=eg_global_x_x_security_en_) safely, [talk to our team today](https://about.gitlab.com/sales/?utm_medium=blog&utm_campaign=eg_global_x_x_security_en_)\n\n\n ## Related reading\n\n - [Integrating AI with DevOps for enhanced security](https://about.gitlab.com/topics/devops/ai-enhanced-security/)\n - [The GitLab AI Security Framework for security leaders](https://about.gitlab.com/blog/the-gitlab-ai-security-framework-for-security-leaders/)\n - [Improve AI security in GitLab with composite identities](https://about.gitlab.com/blog/improve-ai-security-in-gitlab-with-composite-identities/)",[23,26],{"featured":29,"template":13,"slug":730},"ai-can-detect-vulnerabilities-but-who-governs-risk",{"content":732,"config":742},{"title":733,"description":734,"authors":735,"category":9,"tags":737,"date":739,"heroImage":740,"body":741},"Secure and fast deployments to Google Agent Engine with GitLab","Follow this step-by-step guide to build an AI agent with Google's Agent Development Kit and deploy to Agent Engine using GitLab.",[736],"Regnard Raquedan",[23,738,109,24],"google","2026-02-26","https://res.cloudinary.com/about-gitlab-com/image/upload/v1772111172/mwhgbjawn62kymfwrhle.png","In this tutorial, you'll learn how to deploy an AI agent built with Google's Agent Development Kit ([ADK](https://google.github.io/adk-docs/)) to [Agent Engine](https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/overview) using GitLab's native Google Cloud integration and CI/CD pipelines. We'll cover IAM configuration, pipeline setup, and testing your deployed agent.\n\n## What is Agent Engine and why does it matter?\n\nAgent Engine is Google Cloud's managed runtime specifically designed for AI agents. Think of it as the production home for your agents — where they live, run, and scale without you having to manage the underlying infrastructure. Agent Engine handles infrastructure, scaling, session management, and memory storage so you can focus on building your agent — not managing servers. It also integrates natively with Google Cloud's logging, monitoring, and IAM.\n\n## Why use GitLab to deploy to Agent Engine?\n\nAI agent deployment is typically difficult to configure correctly. Security considerations, CI/CD orchestration, and cloud permissions create friction that slows down development cycles.\n\nGitLab streamlines this entire process while enhancing security:\n\n- **Built-in security scanning** — Every deployment is automatically scanned for vulnerabilities without additional configuration.\n- **Native Google Cloud integration** — Workload Identity Federation eliminates the need for service account keys.\n- **Simplified CI/CD** — GitLab's templates handle complex deployment logic.\n\n## Prerequisites\n\nBefore you begin, ensure you have:\n\n- A Google Cloud project with the following APIs enabled:\n  - Cloud Storage API\n  - Vertex AI API\n- A GitLab project for your source code and CI/CD pipeline\n- A Google Cloud Storage bucket for staging deployments\n- Google Cloud IAM integration configured in GitLab (see Step 1)\n\nHere are the steps to follow.\n\n## 1. Configure IAM integration\n\nThe foundation of secure deployment is proper IAM configuration between GitLab and Google Cloud using Workload Identity Federation.\n\nIn your GitLab project:\n\n1. Navigate to **Settings > Integrations**.\n2. Locate the **Google Cloud IAM** integration.\n3. Provide the following information:\n   - **Project ID**: Your Google Cloud project ID\n   - **Project Number**: Found in your Google Cloud console\n   - **Workload Identity Pool ID**: A unique identifier for your identity pool\n   - **Provider ID**: A unique identifier for your identity provider\n\nGitLab generates a script for you. Copy and run this script in Google Cloud Shell to establish the Workload Identity Federation between platforms.\n\n**Important:** Add these additional roles to your service principal for Agent Engine deployment:\n\n- `roles/aiplatform.user`\n- `roles/storage.objectAdmin`\n\nYou can add these roles using gcloud commands:\n\n```bash\nGCP_PROJECT_ID=\"\u003Cyour-project-id>\"\nGCP_PROJECT_NUMBER=\"\u003Cyour-project-number>\"\nGCP_WORKLOAD_IDENTITY_POOL=\"\u003Cyour-pool-id>\"\n\ngcloud projects add-iam-policy-binding ${GCP_PROJECT_ID} \\\n  --member=\"principalSet://iam.googleapis.com/projects/${GCP_PROJECT_NUMBER}/locations/global/workloadIdentityPools/${GCP_WORKLOAD_IDENTITY_POOL}/attribute.developer_access/true\" \\\n  --role='roles/aiplatform.user'\n\ngcloud projects add-iam-policy-binding ${GCP_PROJECT_ID} \\\n  --member=\"principalSet://iam.googleapis.com/projects/${GCP_PROJECT_NUMBER}/locations/global/workloadIdentityPools/${GCP_WORKLOAD_IDENTITY_POOL}/attribute.developer_access/true\" \\\n  --role='roles/storage.objectAdmin'\n```\n\n## 2. Create the CI/CD pipeline\n\nNow for the core of the deployment — the CI/CD pipeline. Create a `.gitlab-ci.yml` file in your project root:\n\n```yaml\nstages:\n  - test\n  - deploy\n\ncache:\n  paths:\n    - .cache/pip\n  key: ${CI_COMMIT_REF_SLUG}\n\nvariables:\n  GCP_PROJECT_ID: \"\u003Cyour-project-id>\"\n  GCP_REGION: \"us-central1\"\n  STORAGE_BUCKET: \"\u003Cyour-staging-bucket>\"\n  AGENT_NAME: \"Canada City Advisor\"\n  AGENT_ENTRY: \"canada_city_advisor\"\n\nimage: google/cloud-sdk:slim\n\n# Security scanning templates\ninclude:\n  - template: Jobs/Dependency-Scanning.gitlab-ci.yml\n  - template: Jobs/SAST.gitlab-ci.yml\n  - template: Jobs/Secret-Detection.gitlab-ci.yml\n\ndeploy-agent:\n  stage: deploy\n  identity: google_cloud\n  rules:\n    - if: $CI_COMMIT_BRANCH == \"main\"\n  before_script:\n    - gcloud config set core/disable_usage_reporting true\n    - gcloud config set component_manager/disable_update_check true\n    - pip install -q --no-cache-dir --upgrade pip google-genai google-cloud-aiplatform -r requirements.txt --break-system-packages\n  script:\n    - gcloud config set project $GCP_PROJECT_ID\n    - adk deploy agent_engine \n        --project=$GCP_PROJECT_ID \n        --region=$GCP_REGION \n        --staging_bucket=gs://$STORAGE_BUCKET \n        --display_name=\"$AGENT_NAME\" \n        $AGENT_ENTRY\n```\n\nThe pipeline consists of two stages:\n\n**Test stage** — GitLab's security scanners run automatically. The included templates provide dependency scanning, static application security testing (SAST), and secret detection without additional configuration.\n\n**Deploy stage** — Uses the ADK CLI to deploy your agent directly to Agent Engine. The staging bucket temporarily holds your application workload before Agent Engine picks it up for deployment.\n\n### Key configuration notes\n\n- The `identity: google_cloud` directive enables keyless authentication via Workload Identity Federation.\n- Security scanners are included as templates, meaning they run by default with no setup required.\n- The `adk deploy agent_engine` command handles all the complexity of packaging and deploying your agent.\n- Pipeline caching speeds up subsequent deployments by preserving pip dependencies.\n\n## 3. Deploy and verify\n\nWith your pipeline configured:\n\n1. Commit your agent code and `.gitlab-ci.yml` to GitLab.\n2. Navigate to **Build > Pipelines** to monitor execution.\n3. Watch the test stage complete security scans.\n4. Observe the deploy stage push your agent to Agent Engine.\n\nOnce the pipeline succeeds, verify your deployment in the Google Cloud Console:\n\n1. Navigate to **Vertex AI > Agent Engine**.\n2. Locate your deployed agent.\n3. Note the **resource name** — you'll need this for testing.\n\n## 4. Test your deployed agent\n\nTest your agent using a curl command. You'll need three pieces of information:\n\n- **Agent ID**: From the Agent Engine console (the resource name's numeric identifier)\n- **Project ID**: Your Google Cloud project\n- **Location**: The region where you deployed (e.g., `us-central1`)\n\n```bash\nPROJECT_ID=\"\u003Cyour-project-id>\"\nLOCATION=\"us-central1\"\nAGENT_ID=\"\u003Cyour-agent-id>\"\nTOKEN=$(gcloud auth print-access-token)\n\ncurl -X POST \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  \"https://${LOCATION}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/reasoningEngines/${AGENT_ID}:streamQuery\" \\\n  -d '{\n    \"input\": {\n      \"message\": \"I make $85,000 per year and I prefer cities with mild winters and a vibrant cultural scene. I also want to be near the coast if possible. What Canadian cities would you recommend?\",\n      \"user_id\": \"demo-user\"\n    }\n  }' | jq -r '.content.parts[0].text'\n```\n\nIf everything is configured correctly, your agent will respond with personalized city recommendations based on the budget and lifestyle preferences provided.\n\n## Security benefits of this approach\n\nThis deployment pattern provides several security advantages:\n\n- **No long-lived credentials**: Workload Identity Federation eliminates service account keys entirely.\n- **Automated vulnerability scanning**: Every deployment is scanned before reaching production.\n- **Complete audit trail**: GitLab maintains full visibility of who deployed what and when.\n- **Principle of least privilege**: Fine-grained IAM roles limit access to only what's needed.\n\n## Summary\n\nDeploying AI agents to production doesn't have to be complex. By combining GitLab's DevSecOps platform with Google Cloud's Agent Engine, you get:\n\n- A managed runtime that handles scaling and infrastructure\n- Built-in security scanning without additional tooling\n- Keyless authentication via native cloud integration\n- A streamlined deployment process that fits modern AI development workflows\n\nWatch the full demo:\n\n\n\u003Cfigure class=\"video_container\"> \u003Ciframe src=\"https://www.youtube.com/embed/sxVFa2Mk-x4?si=Oi3cUjhgd7FT2yEd\" frameborder=\"0\" allowfullscreen=\"true\" title=\"Deploy AI Agents to Agent Engine with GitLab\"> \u003C/iframe> \u003C/figure>\n\n> Ready to try it yourself? Use this tutorial's [complete code example](https://gitlab.com/gitlab-partners-public/google-cloud/demos/agent-engine-demo) to get started now. Not a GitLab customer yet? Explore the DevSecOps platform with [a free trial](https://about.gitlab.com/free-trial/).\n",{"featured":12,"template":13,"slug":743},"secure-and-fast-deployments-to-google-agent-engine-with-gitlab",{"promotions":745},[746,759,771],{"id":747,"categories":748,"header":749,"text":750,"button":751,"image":756},"ai-modernization",[9],"Is AI achieving its promise at scale?","Quiz will take 5 minutes or less",{"text":752,"config":753},"Get your AI maturity score",{"href":754,"dataGaName":755,"dataGaLocation":244},"/assessments/ai-modernization-assessment/","modernization assessment",{"config":757},{"src":758},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1772138786/qix0m7kwnd8x2fh1zq49.png",{"id":760,"categories":761,"header":763,"text":750,"button":764,"image":768},"devops-modernization",[762,38],"product","Are you just managing tools or shipping innovation?",{"text":765,"config":766},"Get your DevOps maturity score",{"href":767,"dataGaName":755,"dataGaLocation":244},"/assessments/devops-modernization-assessment/",{"config":769},{"src":770},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1772138785/eg818fmakweyuznttgid.png",{"id":772,"categories":773,"header":774,"text":750,"button":775,"image":779},"security-modernization",[26],"Are you trading speed for security?",{"text":776,"config":777},"Get your security maturity score",{"href":778,"dataGaName":755,"dataGaLocation":244},"/assessments/security-modernization-assessment/",{"config":780},{"src":781},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1772138786/p4pbqd9nnjejg5ds6mdk.png",{"header":783,"blurb":784,"button":785,"secondaryButton":790},"Start building faster today","See what your team can do with the intelligent orchestration platform for DevSecOps.\n",{"text":786,"config":787},"Get your free trial",{"href":788,"dataGaName":51,"dataGaLocation":789},"https://gitlab.com/-/trial_registrations/new?glm_content=default-saas-trial&glm_source=about.gitlab.com/","feature",{"text":496,"config":791},{"href":55,"dataGaName":56,"dataGaLocation":789},1772652078991]