Skip to main content

Configuring AI Orchestration & Vector RAG

VulnerGuard features a provider-agnostic AI and Retrieval-Augmented Generation (RAG) subsystem:

  • LLMClient: Multi-provider LLM gateway supporting Anthropic Claude and OpenAI / Venice AI endpoints.
  • VectorStore: Vector embedding and similarity search engine backed by vg-vector-memory.
  • SecurityAgent: Autonomous scan planner and vulnerability correlator.

1. Multi-Provider LLM Resolution Order​

LLMClient dynamically resolves credentials from the Encrypted Admin Vault (AppSetting) first, falling back to service environment variables:

  1. Anthropic Claude (Primary Default):
    • Activated automatically whenever ANTHROPIC_API_KEY is configured.
    • Default model: claude-sonnet-4-5 (configurable via ANTHROPIC_MODEL).
    • Used for multi-tool scan sequencing, attack-surface correlation, and generating executive markdown/text summaries in analyze_results().
  2. Venice AI / OpenAI-Compatible Endpoint (Secondary / Red-Team Fallback):
    • Activated when OPENAI_API_KEY is present (and optionally LLM_BASE_URL, e.g., https://api.venice.ai/api/v1).
    • Useful for offensive payload analysis or custom self-hosted vLLM/Ollama models.
  3. Graceful Deterministic Fallback:
    • Keep your scans running even in air-gapped environments: LLMClient.is_configured() checks whether an external API key is active. If no external LLM key is configured, SecurityAgent seamlessly uses its deterministic topological planner and rule-based vulnerability synthesizer without throwing errors.

2. Updating AI Credentials Live (Zero Downtime)​

Administrators can configure or rotate AI keys at any time via the Admin Console (/admin) or REST API:

curl -X PUT https://vulnerguard.com/api/admin/settings \
-H "Authorization: Bearer <ADMIN_JWT_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"settings": {
"ANTHROPIC_API_KEY": "sk-ant-api03-<REDACTED>",
"ANTHROPIC_MODEL": "claude-sonnet-4-5",
"AGENT_AUTO_APPROVE_LOW_RISK": "true",
"AGENT_REQUIRE_APPROVAL_HIGH_RISK": "true"
}
}'

3. Vector Embeddings & RAG Pipeline​

The vg-vector-memory service maintains two 384-dimensional vector collections (security_findings and scan_history).

Embedding Generation Strategy (VectorStore.generate_embedding)​

  • Primary Semantic Encoder: Uses SentenceTransformer('all-MiniLM-L6-v2') when installed to produce dense 384-dimensional semantic vectors.
  • Lightweight Deterministic Hash Encoder: In slim container builds without GPU/PyTorch dependencies, VectorStore automatically falls back to a deterministic 384-dimensional SHA-256 token projection vector, ensuring store_finding(), store_scan_summary(), and search_similar_findings() operate in <2ms with zero GPU overhead.