How mgonzalezbaile/rag-incident-cve-analysis works
Project type and purpose
• This is a backend-only, agentic system for automated CVE (Common Vulnerabilities and Exposures) analysis and prioritization. It exposes an API, runs as a service (via Docker/Docker-Compose), and orchestrates a multi-stage reasoning workflow (agentic GraphRAG) over a Neo4j knowledge graph, LLMs, and other tools.
File structure
• Top level
• docker-compose.yml, Dockerfile & .dockerignore under cve-analysis – define two main containers (the agent service and Neo4j)
• INSTALL_AND_USAGE.md, Makefile – build & run instructions
• cve-analysis/src/cve_analysis/
• domain/ – core business logic:
– graphs/ (analyze_incident_graph + two nested sub-graphs for retrieval & prioritization)
– prompts/ (BAML template files for LLM interactions)
– tools/ (CybersecurityDatabaseTool, WebSearchTool, ToolFactory)
• infrastructure/ – adapters & entry points:
– api.py & api_middlewares.py (HTTP interface)
– db/neo4j_db.py (Neo4j driver adapter)
– bootstrap.py (dependency injection with Punq, config loading)
• data/ – scripts to generate and index CVE embeddings (offline prep for hybrid semantic search)
• Notebook folder – exploratory work
README for additional insights
• Clean/Hexagonal Architecture (Ports & Adapters): domain logic isolated from infra
• LangGraph: orchestrates the multi-stage reasoning workflow as a state machine
• BAML: abstracts LLM provider details (retry, fallback)
• Opik: observability & traceability for LLM calls
• OpenRouter: LLM selection & routing
• Punq: lightweight dependency injection