Complete setup, API reference, custom agents, and production deployment
Required: AVIP needs API keys for full functionality. Without them, features are limited.
Free tier: 15 req/min, 1500 req/day
GEMINI_API_KEY=your-key-here
Increases rate limit from 5 to 50 req/30s
NVD_API_KEY=your-key-here
GPT-4o or GPT-4o-mini for LLM features
OPENAI_API_KEY=sk-...
Sonnet or Opus for reasoning tasks
ANTHROPIC_API_KEY=sk-ant-...
git clone https://github.com/Purushothaman-natarajan/Exploit2Patch.git cd Exploit2Patch # Create .env with your API keys echo "GEMINI_API_KEY=your-key" > .env # Run the launcher chmod +x run.sh ./run.sh
Create a .env file in the project root:
# Required for LLM features GEMINI_API_KEY=AIza...Get from: https://aistudio.google.com/apikey # Optional: Increases NVD rate limit from 5 to 50 req/30s NVD_API_KEY=your-nvd-key-here # Alternative LLM providers (optional) OPENAI_API_KEY=sk-... ANTHROPIC_API_KEY=sk-ant-... # Security (optional) JWT_SECRET=your-secret-key CORS_ORIGINS=https://your-domain.com
Note: Without GEMINI_API_KEY, the pipeline runs but LLM features (Playbook generation) are disabled. NVD queries are rate-limited to 5 per 30 seconds.
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check, config, agent status |
/ws | WebSocket | Live event streaming |
/runs | GET | List all pipeline runs |
/runs/{id} | GET | Get run details and files |
/runs/{id}/file | GET | Read file content (query: path=) |
/agent/research | POST | Run research agent only |
/agent/ingest/{id} | POST | Generate ingestion scripts |
/agent/remediate/{id} | POST | Create remediation plans |
/agent/playbook/{id} | POST | Generate final playbook |
/pipeline/run | POST | Run full 4-agent pipeline |
/pipeline/batch | POST | Process multiple CVEs |
# Health check curl http://localhost:8000/health # Research a CVE curl -X POST http://localhost:8000/agent/research \ -H "Content-Type: application/json" \ -d '{"cve_id": "CVE-2024-4577"}' # Full pipeline (Windows x64) curl -X POST http://localhost:8000/pipeline/run \ -H "Content-Type: application/json" \ -d '{ "cve_id": "CVE-2024-4577", "os_type": "windows", "architecture": "x64" }' # By product (auto-searches NVD) curl -X POST http://localhost:8000/pipeline/run \ -H "Content-Type: application/json" \ -d '{ "product": "Notepad++", "os_type": "windows" }' # Batch process multiple CVEs curl -X POST http://localhost:8000/pipeline/batch \ -H "Content-Type: application/json" \ -d '{ "cve_ids": ["CVE-2024-4577", "CVE-2024-3001"], "os_type": "windows" }' # Read a generated file curl "http://localhost:8000/runs/20260326_120000_abc123/file?path=research/research.json"
Connect to ws://localhost:8000/ws for real-time pipeline events:
| Event | Source | Data |
|---|---|---|
pipeline_start | pipeline | run_id, cve |
pipeline_end | pipeline | run_id, tokens_used |
agent_start | *_agent | run_id, cve, os, product |
agent_end | *_agent | run_id, cves, scripts, plans |
tool_call | *_agent | tool, action, search, cve |
tool_result | *_agent | tool, count, validated, cves_found |
token_usage | system | provider, tokens, total |
const ws = new WebSocket('ws://localhost:8000/ws');
ws.onopen = () => console.log('Connected to event stream');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'backlog') {
console.log('History:', data.events.length, 'events');
data.events.forEach(handleEvent);
} else {
handleEvent(data);
}
};
function handleEvent(ev) {
console.log(`${ev.event_type} from ${ev.source}:`, ev.data);
if (ev.event_type === 'agent_start') {
updateUI('Agent started:', ev.data.cve);
}
if (ev.event_type === 'tool_result') {
updateProgress(ev.data);
}
if (ev.event_type === 'pipeline_end') {
showResults(ev.data);
}
}Extend AVIP with your own agents. Here's a complete example:
from __future__ import annotations from typing import Dict, Any from src.events.bus import EventType, Event class MyCustomAgent: def __init__(self): self.name = "my_custom_agent" async def analyze(self, data: Dict[str, Any], emit_fn) -> Dict[str, Any]: # Emit start event await emit_fn(self.name, EventType.AGENT_START, { "task": data.get("task"), "run_id": data.get("run_id") }) # Do work... await emit_fn(self.name, EventType.TOOL_CALL, { "tool": "my_tool", "action": "analyze" }) # Emit result result = {"analysis": "completed", "items": 42} await emit_fn(self.name, EventType.TOOL_RESULT, result) # Emit end await emit_fn(self.name, EventType.AGENT_END, { "run_id": data.get("run_id"), "status": "success" }) return result
# Import your agent from src.agents.my_agent import MyCustomAgent # Initialize agent _my_agent = MyCustomAgent() # Add endpoint @app.post("/agent/custom") async def custom_analysis(data: CustomInput): async def _emit(source, etype, payload): await event_bus.emit(Event( event_type=etype, source=source, data=payload )) result = await _my_agent.analyze( data={"task": data.task, "run_id": _make_run_id()}, emit_fn=_emit ) return {"status": "ok", "result": result}
Settings in backend/src/config.py:
| Setting | Default | Description |
|---|---|---|
llm.provider | gemini | LLM: gemini, openai, anthropic, ollama |
llm.model | gemini-1.5-flash | Model name |
llm.temperature | 0.3 | Response creativity (0-1) |
llm.max_tokens | 2048 | Max response length |
url_trust.min_score | 30 | Minimum trust score threshold |
url_trust.blocked | blogs, forums | Blocked domain patterns |
nvd.max_results | 20 | Max CVEs from NVD search |
nvd.rate_limit | 5 | Requests per 30 seconds |
execution.default_os | windows | Default OS type |
execution.default_arch | x64 | Default architecture |
FROM python:3.11-slim WORKDIR /app COPY backend/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY backend/ . ENV PYTHONPATH=/app EXPOSE 8000 CMD ["uvicorn", "src.api.main:app", "--host", "0.0.0.0"]
# Production keys (use secrets management!) GEMINI_API_KEY=production-key NVD_API_KEY=production-nvd-key # Security JWT_SECRET=secure-random-secret ALLOWED_ORIGINS=https://app.your-domain.com # Performance UVICORN_WORKERS=4 MAX_CONCURRENT_PIPELINES=10 # Storage RUNS_DIR=/data/avip/runs
apiVersion: apps/v1
kind: Deployment
metadata:
name: avip-backend
spec:
replicas: 3
selector:
matchLabels:
app: avip-backend
template:
spec:
containers:
- name: backend
image: your-registry/avip:latest
ports:
- containerPort: 8000
env:
- name: GEMINI_API_KEY
valueFrom:
secretKeyRef:
name: avip-secrets
key: gemini-api-key
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
cpu: "1000m"pip install -r requirements.txt.env file existsGEMINI_API_KEY is setpip install reportlabStart Backend: cd backend && python -m uvicorn src.api.main:app --port 8000
Start Frontend: cd frontend && python -m http.server 5173
Run Tests: cd backend && python -m pytest tests/
View Logs: Check terminal output or browser console
Stop: Ctrl+C or taskkill /F /IM python.exe
Reset: Delete runs/ folder to clear history