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 byvg-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:
- Anthropic Claude (Primary Default):
- Activated automatically whenever
ANTHROPIC_API_KEYis configured. - Default model:
claude-sonnet-4-5(configurable viaANTHROPIC_MODEL). - Used for multi-tool scan sequencing, attack-surface correlation, and generating executive markdown/text summaries in
analyze_results().
- Activated automatically whenever
- Venice AI / OpenAI-Compatible Endpoint (Secondary / Red-Team Fallback):
- Activated when
OPENAI_API_KEYis present (and optionallyLLM_BASE_URL, e.g.,https://api.venice.ai/api/v1). - Useful for offensive payload analysis or custom self-hosted vLLM/Ollama models.
- Activated when
- 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,SecurityAgentseamlessly uses its deterministic topological planner and rule-based vulnerability synthesizer without throwing errors.
- Keep your scans running even in air-gapped environments:
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,
VectorStoreautomatically falls back to a deterministic 384-dimensional SHA-256 token projection vector, ensuringstore_finding(),store_scan_summary(), andsearch_similar_findings()operate in<2mswith zero GPU overhead.