💡 Inspiration
I have always wanted to see how cybersecurity could seamlessly interface with artificial intelligence. If teams are working remotely, they should be able to see what changes are happening in real-time. Slack is the central nervous system for most modern technology departments. The goal is to build a ChatOps tool that doesn't just block broken code, but actively mentors the engineering team.
⚙️ How I built it
GuardAgent is a fully event-driven architecture designed for speed and precision.
- Backend Infrastructure: Deployed as a serverless Python FastAPI application on Google Cloud Run for instant auto-scaling.
- Model Context Protocol (MCP): I completely architected the backend as an MCP server, implementing Server-Sent Events (SSE) transport to standardize how the AI interacts with internal developer tools.
- The AI Engine: We utilized the
google-genaiSDK to power the core logic withgemini-2.5-flash. The AI reads the raw code diffs and maps threats directly to MITRE CWE IDs. - Threat Scoring: To prioritize alerts, the AI calculates a threat severity score. The overall severity score is calculated based on the base CWE weight and the AI's confidence interval for the detected vulnerabilities:
$$ S = \sum_{i=1}^{n} (W_i \times C_i) $$
- Integrations: Connected via GitLab Webhooks to detect live code pushes, and authenticated via the GitLab API to pull exact commit diffs.
- ChatOps Interface: Built using the Slack Bolt API, leveraging rich Block Kit UI elements (including dynamic scanning visuals) to deliver interactive, highly readable alerts.
- Security & Secrets: Enforced a zero-trust architecture by vaulting all API keys, Slack tokens, and webhook signatures inside Google Secret Manager, alongside custom dependency injection to secure the MCP endpoints.
🚧 Challenges I ran into
- Model Availability: I initially engineered the platform for the brand-new
gemini-3.5-flashmodel but hit regional data center availability limits (404 NOT_FOUND) on Google Cloud. I quickly re-engineered the architecture to utilize the highly stablegemini-2.5-flashwithout losing any analysis capabilities. - Contextual Memory: Initially, the bot treated every Slack mention as a blank slate. I engineered a custom state manager mapping Slack Thread IDs (
thread_ts) to persistent Gemini Chat Sessions, allowing the AI to remember the code context across multiple follow-up questions. - Protocol Security: Implementing the MCP server required strict security controls to ensure external access to the AI toolset remained completely locked down via a custom
verify_mcp_keydependency. - Translating Syntax: Bridging standard Markdown and raw code outputs into Slack's proprietary formatting and Block Kit JSON required meticulous regex parsing to ensure the UI remained pristine.
🏆 Accomplishments that I'm proud of
- Authentic End-to-End Flow: GuardAgent authentically reaches into live GitLab repositories, parses real commits, and streams genuine diffs to the LLM. There is zero mocked data in the backend pipeline.
- MCP Integration: Successfully upgrading the bot to an official Model Context Protocol server, proving that the tool can act as a secure, standardized bridge between Slack, GitLab, and Gemini.
- Automated CWE Compliance: The bot doesn't just find bugs; it surgically identifies them and maps them to global MITRE CWE standards for instant compliance reporting.
- Interactive Mentorship: I successfully evolved the tool from a one-shot scanner into an interactive security mentor that remembers thread context and writes remediation patches on demand.
📚 What I learned
I gained deep experience designing strict system prompts to prevent LLM hallucinations, ensuring the AI only flags genuine threats rather than standard boilerplate code. I also mastered the Model Context Protocol standard, learning the complexities of bridging event-driven webhooks securely across GitLab, Google Cloud, and Slack.
🚀 What's next for GuardAgent
The next phase involves expanding webhook support to GitHub Advanced Security and giving GuardAgent the capability to automatically open functional Merge Requests with its AI-generated remediation code.
Built With
- fastapi
- framer-motion
- gemini
- gitlab-api
- google-cloud-run
- google-secret-manager
- python
- react
- slack-api
- tailwind-css
- typescript
- vertex-ai
- vite
Log in or sign up for Devpost to join the conversation.