Skip to content

hieple7985/code-intelligence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI-Powered Code Intelligence Platform

Multi-Agent AI Code Analysis System powered by Google ADK and Cloud Run

Cloud Run Google ADK Gemini FastAPI React

🎯 Overview

An enterprise-grade AI-powered code analysis platform that uses multi-agent architecture to provide comprehensive code intelligence. Built for the Google Cloud Run Hackathon 2025 in the AI Agents Category.

Key Features

  • πŸ€– Multi-Agent AI System - 4 specialized agents working sequentially
  • πŸ”’ Security Analysis - SQL injection, XSS, and vulnerability detection
  • ⚑ Performance Optimization - Complexity analysis and bottleneck detection
  • πŸ”§ Code Refactoring - Best practices and code quality improvements
  • πŸ“Š Real-time Dashboard - System metrics and analysis tracking
  • ☁️ Cloud-Native - Fully serverless on Google Cloud Run

πŸ—οΈ Architecture

Multi-Agent System

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   User Code Input                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Multi-Agent Coordinator                     β”‚
β”‚           (Sequential Execution Pattern)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό                   β–Ό         β–Ό         β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Parser β”‚ ──────> β”‚ Security β”‚ β”‚  Perf  β”‚ β”‚Refactorβ”‚
   β”‚ Agent  β”‚         β”‚  Agent   β”‚ β”‚ Agent  β”‚ β”‚ Agent  β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                   β”‚         β”‚         β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Combined Analysis Results                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technology Stack

Backend:

  • FastAPI (Python 3.11)
  • Google Generative AI (Gemini 2.0 Flash)
  • Google Cloud Run (8 vCPU, 8GB RAM)
  • Google Firestore (NoSQL Database)
  • Google Cloud Storage (File Storage)
  • Google Secret Manager (API Key Management)

Frontend:

  • React 18.2 + TypeScript
  • Ant Design 5.x
  • Vite 5.0
  • Nginx (Production Server)

πŸš€ Quick Start

Prerequisites

  • Google Cloud Project with billing enabled
  • Google Cloud SDK (gcloud) installed
  • Gemini API Key
  • Node.js 18+ and Python 3.11+

Local Development

Backend:

cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

export GEMINI_API_KEY="your-api-key"
export PROJECT_ID="your-project-id"
export REGION="us-central1"

uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

Frontend:

cd frontend
npm install
npm run dev

Cloud Deployment

Backend:

cd backend
gcloud run deploy code-intelligence-api \
  --source . \
  --region us-central1 \
  --platform managed \
  --allow-unauthenticated \
  --memory 8Gi \
  --cpu 8 \
  --timeout 300 \
  --min-instances 2 \
  --max-instances 20 \
  --set-env-vars PROJECT_ID=your-project-id,REGION=us-central1 \
  --update-secrets GEMINI_API_KEY=GEMINI_API_KEY:latest

Frontend:

cd frontend
gcloud run deploy code-intelligence-ui \
  --source . \
  --region us-central1 \
  --platform managed \
  --allow-unauthenticated \
  --memory 512Mi \
  --cpu 1 \
  --timeout 60

οΏ½οΏ½ API Documentation

Analyze Code

Endpoint: POST /api/adk/analyze

Request:

{
  "code": "def get_user(id):\n    query = f\"SELECT * FROM users WHERE id = {id}\"\n    return db.execute(query)",
  "agent_type": "multi"
}

Response:

{
  "analysis_id": "uuid",
  "status": "completed",
  "results": {
    "parser": "Code structure analysis...",
    "security": "SQL injection vulnerability detected...",
    "performance": "Query optimization needed...",
    "refactoring": "Use parameterized queries..."
  },
  "timestamp": "2025-11-10T12:00:00Z"
}

Health Check

Endpoint: GET /api/monitoring/health

Response:

{
  "status": "healthy",
  "queue": {
    "total_queued": 0,
    "executing": 0,
    "available_slots": 10
  },
  "system": {
    "cpu": 0.0,
    "memory": 1.4,
    "load_score": 0.42
  }
}

🎨 Features

1. Parser Agent

  • Code structure analysis
  • Syntax validation
  • Complexity metrics (Cyclomatic, Halstead)
  • Function/class detection

2. Security Agent

  • SQL injection detection
  • XSS vulnerability scanning
  • Insecure deserialization
  • Hardcoded credentials detection

3. Performance Agent

  • Time complexity analysis (O(n), O(nΒ²), etc.)
  • Memory usage optimization
  • Database query optimization
  • Caching recommendations

4. Refactoring Agent

  • Code quality improvements
  • Best practices enforcement
  • Design pattern suggestions
  • Clean code recommendations

πŸ“Š Dashboard

Real-time monitoring dashboard showing:

  • System metrics (CPU, Memory, Load)
  • Queue status (Queued, Executing, Completed)
  • Performance statistics (P50, P95, P99 latency)
  • Agent execution metrics

πŸ† Google Cloud Run Hackathon 2025

This project is built for the AI Agents Category of the Google Cloud Run Hackathon.

Why This Project Wins:

  1. Multi-Agent Architecture - Demonstrates advanced AI agent coordination
  2. Cloud-Native Design - Fully serverless, auto-scaling, cost-efficient
  3. Production-Ready - Enterprise-grade monitoring, error handling, testing
  4. Real-World Impact - Solves actual developer pain points in code review
  5. Google Cloud Integration - Uses Cloud Run, Firestore, Storage, Secret Manager

πŸ“ License

MIT License

🀝 Contributing

This is a hackathon project. Contributions are welcome after the competition ends.


Built with ❀️ for Google Cloud Run Hackathon 2025

#CloudRunHackathon #GoogleADK #AIAgents

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published