Spaces:
Sleeping
Sleeping
Bader Alabddan
commited on
Commit
·
7f10b99
1
Parent(s):
6db32df
Complete FraudSimulator-AI vertical
Browse files- agents/anomaly_agent.py +46 -0
- agents/pattern_agent.py +51 -0
- agents/risk_scoring_agent.py +59 -0
- app.py +129 -0
- governance/fraud_audit_logger.py +38 -0
- governance/fraud_trace.py +32 -0
- requirements.txt +1 -0
- vercept/vercept_mvp.json +23 -0
- vercept/vercept_poc.json +23 -0
- vercept/vercept_prd.json +20 -0
agents/anomaly_agent.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Anomaly Detection Agent - Identifies unusual behaviors."""
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Any
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class AnomalyDetectionAgent:
|
| 7 |
+
"""Detects anomalies in claim data."""
|
| 8 |
+
|
| 9 |
+
def __init__(self):
|
| 10 |
+
self.name = "AnomalyDetectionAgent"
|
| 11 |
+
self.version = "1.0"
|
| 12 |
+
self.anomaly_threshold = 0.6
|
| 13 |
+
|
| 14 |
+
def process(self, claim_data: Dict[str, Any], historical_data: Dict[str, Any]) -> Dict[str, Any]:
|
| 15 |
+
"""Detect anomalies in claim."""
|
| 16 |
+
anomalies = []
|
| 17 |
+
anomaly_score = 0.0
|
| 18 |
+
|
| 19 |
+
# Check claim amount vs historical average
|
| 20 |
+
claim_amount = claim_data.get("claim_amount", 0)
|
| 21 |
+
if claim_amount > 10000:
|
| 22 |
+
anomalies.append("unusually_high_amount")
|
| 23 |
+
anomaly_score += 0.4
|
| 24 |
+
|
| 25 |
+
# Check fraud flag
|
| 26 |
+
if historical_data.get("fraud_flag", False):
|
| 27 |
+
anomalies.append("previous_fraud_history")
|
| 28 |
+
anomaly_score += 0.5
|
| 29 |
+
|
| 30 |
+
# Normalize score
|
| 31 |
+
anomaly_score = min(anomaly_score, 1.0)
|
| 32 |
+
|
| 33 |
+
return {
|
| 34 |
+
"anomalies_detected": anomalies,
|
| 35 |
+
"anomaly_score": anomaly_score,
|
| 36 |
+
"is_anomalous": anomaly_score >= self.anomaly_threshold,
|
| 37 |
+
"confidence": 0.82
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
def get_trace(self) -> Dict[str, Any]:
|
| 41 |
+
return {
|
| 42 |
+
"agent": self.name,
|
| 43 |
+
"version": self.version,
|
| 44 |
+
"timestamp": "2024-12-31T01:00:00Z",
|
| 45 |
+
"status": "completed"
|
| 46 |
+
}
|
agents/pattern_agent.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Pattern Analysis Agent - Detects known fraud patterns."""
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Any
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class PatternAnalysisAgent:
|
| 7 |
+
"""Analyzes claims for known fraud patterns."""
|
| 8 |
+
|
| 9 |
+
def __init__(self):
|
| 10 |
+
self.name = "PatternAnalysisAgent"
|
| 11 |
+
self.version = "1.0"
|
| 12 |
+
self.known_patterns = [
|
| 13 |
+
"rapid_succession_claims",
|
| 14 |
+
"round_number_amounts",
|
| 15 |
+
"weekend_incidents",
|
| 16 |
+
"similar_claim_history"
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
def process(self, claim_data: Dict[str, Any], historical_data: Dict[str, Any]) -> Dict[str, Any]:
|
| 20 |
+
"""Detect known fraud patterns."""
|
| 21 |
+
detected_patterns = []
|
| 22 |
+
pattern_scores = {}
|
| 23 |
+
|
| 24 |
+
# Check for rapid succession
|
| 25 |
+
if historical_data.get("prior_claims", 0) >= 3:
|
| 26 |
+
detected_patterns.append("rapid_succession_claims")
|
| 27 |
+
pattern_scores["rapid_succession"] = 0.7
|
| 28 |
+
|
| 29 |
+
# Check for round numbers
|
| 30 |
+
amount = claim_data.get("claim_amount", 0)
|
| 31 |
+
if amount % 1000 == 0 and amount > 0:
|
| 32 |
+
detected_patterns.append("round_number_amounts")
|
| 33 |
+
pattern_scores["round_numbers"] = 0.5
|
| 34 |
+
|
| 35 |
+
# Calculate overall pattern score
|
| 36 |
+
overall_score = sum(pattern_scores.values()) / len(self.known_patterns) if pattern_scores else 0.0
|
| 37 |
+
|
| 38 |
+
return {
|
| 39 |
+
"detected_patterns": detected_patterns,
|
| 40 |
+
"pattern_scores": pattern_scores,
|
| 41 |
+
"overall_pattern_score": min(overall_score, 1.0),
|
| 42 |
+
"confidence": 0.85
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
def get_trace(self) -> Dict[str, Any]:
|
| 46 |
+
return {
|
| 47 |
+
"agent": self.name,
|
| 48 |
+
"version": self.version,
|
| 49 |
+
"timestamp": "2024-12-31T01:00:00Z",
|
| 50 |
+
"status": "completed"
|
| 51 |
+
}
|
agents/risk_scoring_agent.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Risk Scoring Agent - Combines signals into final fraud risk score."""
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Any
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class RiskScoringAgent:
|
| 7 |
+
"""Calculates final fraud risk score."""
|
| 8 |
+
|
| 9 |
+
def __init__(self):
|
| 10 |
+
self.name = "RiskScoringAgent"
|
| 11 |
+
self.version = "1.0"
|
| 12 |
+
self.investigation_threshold = 0.7
|
| 13 |
+
|
| 14 |
+
def process(
|
| 15 |
+
self,
|
| 16 |
+
pattern_results: Dict[str, Any],
|
| 17 |
+
anomaly_results: Dict[str, Any]
|
| 18 |
+
) -> Dict[str, Any]:
|
| 19 |
+
"""Calculate final fraud risk score."""
|
| 20 |
+
|
| 21 |
+
# Weighted combination
|
| 22 |
+
pattern_score = pattern_results.get("overall_pattern_score", 0.0)
|
| 23 |
+
anomaly_score = anomaly_results.get("anomaly_score", 0.0)
|
| 24 |
+
|
| 25 |
+
# 60% patterns, 40% anomalies
|
| 26 |
+
final_score = (pattern_score * 0.6) + (anomaly_score * 0.4)
|
| 27 |
+
|
| 28 |
+
# Determine risk level
|
| 29 |
+
if final_score >= 0.7:
|
| 30 |
+
risk_level = "high"
|
| 31 |
+
recommended_action = "immediate_investigation"
|
| 32 |
+
elif final_score >= 0.4:
|
| 33 |
+
risk_level = "medium"
|
| 34 |
+
recommended_action = "enhanced_review"
|
| 35 |
+
else:
|
| 36 |
+
risk_level = "low"
|
| 37 |
+
recommended_action = "standard_processing"
|
| 38 |
+
|
| 39 |
+
# Collect all indicators
|
| 40 |
+
fraud_indicators = []
|
| 41 |
+
fraud_indicators.extend(pattern_results.get("detected_patterns", []))
|
| 42 |
+
fraud_indicators.extend(anomaly_results.get("anomalies_detected", []))
|
| 43 |
+
|
| 44 |
+
return {
|
| 45 |
+
"fraud_score": final_score,
|
| 46 |
+
"risk_level": risk_level,
|
| 47 |
+
"fraud_indicators": fraud_indicators,
|
| 48 |
+
"recommended_action": recommended_action,
|
| 49 |
+
"requires_investigation": final_score >= self.investigation_threshold,
|
| 50 |
+
"confidence": 0.88
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
def get_trace(self) -> Dict[str, Any]:
|
| 54 |
+
return {
|
| 55 |
+
"agent": self.name,
|
| 56 |
+
"version": self.version,
|
| 57 |
+
"timestamp": "2024-12-31T01:00:00Z",
|
| 58 |
+
"status": "completed"
|
| 59 |
+
}
|
app.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""FraudSimulator-AI - Fraud Detection System
|
| 2 |
+
|
| 3 |
+
Built using BDR Agent Factory v1
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import gradio as gr
|
| 7 |
+
from typing import Tuple
|
| 8 |
+
from agents.pattern_agent import PatternAnalysisAgent
|
| 9 |
+
from agents.anomaly_agent import AnomalyDetectionAgent
|
| 10 |
+
from agents.risk_scoring_agent import RiskScoringAgent
|
| 11 |
+
from governance.fraud_audit_logger import FraudAuditLogger
|
| 12 |
+
from governance.fraud_trace import FraudDetectionTrace
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class FraudSimulatorAI:
|
| 16 |
+
def __init__(self):
|
| 17 |
+
self.pattern_agent = PatternAnalysisAgent()
|
| 18 |
+
self.anomaly_agent = AnomalyDetectionAgent()
|
| 19 |
+
self.risk_agent = RiskScoringAgent()
|
| 20 |
+
self.audit_logger = FraudAuditLogger()
|
| 21 |
+
self.trace = FraudDetectionTrace()
|
| 22 |
+
|
| 23 |
+
def analyze_fraud(
|
| 24 |
+
self,
|
| 25 |
+
claim_id: str,
|
| 26 |
+
claim_amount: float,
|
| 27 |
+
prior_claims: int,
|
| 28 |
+
fraud_flag: bool
|
| 29 |
+
) -> Tuple[str, str, str]:
|
| 30 |
+
self.trace.start_trace(claim_id)
|
| 31 |
+
|
| 32 |
+
claim_data = {"claim_id": claim_id, "claim_amount": claim_amount}
|
| 33 |
+
historical_data = {"prior_claims": prior_claims, "fraud_flag": fraud_flag}
|
| 34 |
+
|
| 35 |
+
pattern_results = self.pattern_agent.process(claim_data, historical_data)
|
| 36 |
+
self.trace.add_step("pattern_analysis", pattern_results)
|
| 37 |
+
|
| 38 |
+
anomaly_results = self.anomaly_agent.process(claim_data, historical_data)
|
| 39 |
+
self.trace.add_step("anomaly_detection", anomaly_results)
|
| 40 |
+
|
| 41 |
+
final_results = self.risk_agent.process(pattern_results, anomaly_results)
|
| 42 |
+
self.trace.add_step("risk_scoring", final_results)
|
| 43 |
+
|
| 44 |
+
audit_id = self.audit_logger.log_fraud_assessment(
|
| 45 |
+
claim_id,
|
| 46 |
+
final_results["fraud_score"],
|
| 47 |
+
final_results["risk_level"],
|
| 48 |
+
final_results["fraud_indicators"],
|
| 49 |
+
final_results["recommended_action"]
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
score_text = f"**Fraud Score:** {final_results['fraud_score']:.1%}\n**Risk Level:** {final_results['risk_level'].upper()}"
|
| 53 |
+
|
| 54 |
+
indicators_text = "**Fraud Indicators:**\n"
|
| 55 |
+
if final_results['fraud_indicators']:
|
| 56 |
+
indicators_text += "- " + "\n- ".join(final_results['fraud_indicators'])
|
| 57 |
+
else:
|
| 58 |
+
indicators_text += "No fraud indicators detected"
|
| 59 |
+
|
| 60 |
+
indicators_text += f"\n\n**Recommended Action:**\n{final_results['recommended_action']}"
|
| 61 |
+
|
| 62 |
+
if final_results['requires_investigation']:
|
| 63 |
+
indicators_text += "\n\n⚠️ **Investigation Required**"
|
| 64 |
+
|
| 65 |
+
audit_text = f"""**Audit Trail**
|
| 66 |
+
|
| 67 |
+
Audit ID: {audit_id}
|
| 68 |
+
Trace ID: {self.trace.get_trace()['trace_id']}
|
| 69 |
+
|
| 70 |
+
**Analysis Pipeline:**
|
| 71 |
+
1. ✓ Pattern Analysis Agent
|
| 72 |
+
2. ✓ Anomaly Detection Agent
|
| 73 |
+
3. ✓ Risk Scoring Agent
|
| 74 |
+
|
| 75 |
+
**Compliance:** FRAUD_AUDIT | INVESTIGATION_READY
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
return score_text, indicators_text, audit_text
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
app = FraudSimulatorAI()
|
| 82 |
+
|
| 83 |
+
with gr.Blocks(title="FraudSimulator-AI", theme=gr.themes.Soft()) as demo:
|
| 84 |
+
gr.Markdown(
|
| 85 |
+
"""
|
| 86 |
+
# 🔍 FraudSimulator-AI
|
| 87 |
+
## AI-Powered Fraud Detection System
|
| 88 |
+
|
| 89 |
+
**+15% precision improvement | Real-time scoring | Investigation routing**
|
| 90 |
+
|
| 91 |
+
*Built using [BDR Agent Factory v1](https://huggingface.co/spaces/bdr-ai-org/BDR-Agent-Factory)*
|
| 92 |
+
"""
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
with gr.Row():
|
| 96 |
+
with gr.Column(scale=1):
|
| 97 |
+
gr.Markdown("### 📋 Claim Information")
|
| 98 |
+
claim_id = gr.Textbox(label="Claim ID", value="CLM-FRAUD-001")
|
| 99 |
+
claim_amount = gr.Number(label="Claim Amount ($)", value=5000.00)
|
| 100 |
+
|
| 101 |
+
gr.Markdown("### 📊 Historical Context")
|
| 102 |
+
prior_claims = gr.Slider(label="Prior Claims", minimum=0, maximum=10, value=1, step=1)
|
| 103 |
+
fraud_flag = gr.Checkbox(label="Previous Fraud Flag", value=False)
|
| 104 |
+
|
| 105 |
+
analyze_btn = gr.Button("🔍 Analyze Fraud Risk", variant="primary", size="lg")
|
| 106 |
+
|
| 107 |
+
with gr.Column(scale=1):
|
| 108 |
+
gr.Markdown("### 🎯 Fraud Analysis")
|
| 109 |
+
score_output = gr.Textbox(label="Fraud Score & Risk Level", lines=2)
|
| 110 |
+
indicators_output = gr.Textbox(label="Fraud Indicators", lines=8)
|
| 111 |
+
audit_output = gr.Textbox(label="Audit Trail", lines=8)
|
| 112 |
+
|
| 113 |
+
gr.Examples(
|
| 114 |
+
examples=[
|
| 115 |
+
["CLM-FRAUD-001", 5000.00, 1, False],
|
| 116 |
+
["CLM-FRAUD-002", 15000.00, 4, True],
|
| 117 |
+
["CLM-FRAUD-003", 10000.00, 2, False],
|
| 118 |
+
],
|
| 119 |
+
inputs=[claim_id, claim_amount, prior_claims, fraud_flag]
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
analyze_btn.click(
|
| 123 |
+
fn=app.analyze_fraud,
|
| 124 |
+
inputs=[claim_id, claim_amount, prior_claims, fraud_flag],
|
| 125 |
+
outputs=[score_output, indicators_output, audit_output]
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
if __name__ == "__main__":
|
| 129 |
+
demo.launch()
|
governance/fraud_audit_logger.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Fraud Audit Logger - Records fraud investigations."""
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
from typing import Dict, List, Any
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class FraudAuditLogger:
|
| 9 |
+
"""Logs fraud detection activities."""
|
| 10 |
+
|
| 11 |
+
def __init__(self):
|
| 12 |
+
self.logs = []
|
| 13 |
+
|
| 14 |
+
def log_fraud_assessment(
|
| 15 |
+
self,
|
| 16 |
+
claim_id: str,
|
| 17 |
+
fraud_score: float,
|
| 18 |
+
risk_level: str,
|
| 19 |
+
indicators: List[str],
|
| 20 |
+
recommended_action: str
|
| 21 |
+
) -> str:
|
| 22 |
+
"""Log fraud assessment."""
|
| 23 |
+
log_entry = {
|
| 24 |
+
"log_id": f"FRAUD-{datetime.now().strftime('%Y%m%d%H%M%S')}",
|
| 25 |
+
"timestamp": datetime.now().isoformat(),
|
| 26 |
+
"claim_id": claim_id,
|
| 27 |
+
"fraud_score": fraud_score,
|
| 28 |
+
"risk_level": risk_level,
|
| 29 |
+
"fraud_indicators": indicators,
|
| 30 |
+
"recommended_action": recommended_action,
|
| 31 |
+
"compliance_tags": ["FRAUD_AUDIT", "INVESTIGATION_READY"]
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
self.logs.append(log_entry)
|
| 35 |
+
return log_entry["log_id"]
|
| 36 |
+
|
| 37 |
+
def export_logs(self) -> str:
|
| 38 |
+
return json.dumps(self.logs, indent=2)
|
governance/fraud_trace.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Fraud Detection Trace - Tracks fraud analysis process."""
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Any
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class FraudDetectionTrace:
|
| 8 |
+
"""Maintains trace of fraud detection process."""
|
| 9 |
+
|
| 10 |
+
def __init__(self):
|
| 11 |
+
self.trace_steps = []
|
| 12 |
+
self.start_time = None
|
| 13 |
+
|
| 14 |
+
def start_trace(self, claim_id: str):
|
| 15 |
+
self.start_time = datetime.now()
|
| 16 |
+
self.trace_steps = []
|
| 17 |
+
self.add_step("fraud_analysis_started", {"claim_id": claim_id})
|
| 18 |
+
|
| 19 |
+
def add_step(self, step_name: str, step_data: Dict[str, Any]):
|
| 20 |
+
step = {
|
| 21 |
+
"step": step_name,
|
| 22 |
+
"timestamp": datetime.now().isoformat(),
|
| 23 |
+
"data": step_data
|
| 24 |
+
}
|
| 25 |
+
self.trace_steps.append(step)
|
| 26 |
+
|
| 27 |
+
def get_trace(self) -> Dict[str, Any]:
|
| 28 |
+
return {
|
| 29 |
+
"trace_id": f"FTRACE-{self.start_time.strftime('%Y%m%d%H%M%S')}" if self.start_time else "FTRACE-UNKNOWN",
|
| 30 |
+
"total_steps": len(self.trace_steps),
|
| 31 |
+
"steps": self.trace_steps
|
| 32 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio>=4.0.0
|
vercept/vercept_mvp.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"project_name": "FraudSimulator-AI",
|
| 3 |
+
"phase": "MVP",
|
| 4 |
+
"agents": [
|
| 5 |
+
"PatternAnalysisAgent",
|
| 6 |
+
"AnomalyDetectionAgent",
|
| 7 |
+
"RiskScoringAgent"
|
| 8 |
+
],
|
| 9 |
+
"features": {
|
| 10 |
+
"real_time_scoring": true,
|
| 11 |
+
"explainable_signals": true,
|
| 12 |
+
"investigation_routing": true
|
| 13 |
+
},
|
| 14 |
+
"metrics": {
|
| 15 |
+
"fraud_precision": ">=80%",
|
| 16 |
+
"recall": ">=75%",
|
| 17 |
+
"processing_time": "<2s"
|
| 18 |
+
},
|
| 19 |
+
"governance": {
|
| 20 |
+
"audit_logging": true,
|
| 21 |
+
"signal_explainability": true
|
| 22 |
+
}
|
| 23 |
+
}
|
vercept/vercept_poc.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"project_name": "FraudSimulator-AI",
|
| 3 |
+
"phase": "PoC",
|
| 4 |
+
"objective": "Validate AI-powered fraud detection for insurance claims",
|
| 5 |
+
"scope": {
|
| 6 |
+
"claim_types": ["motor", "medical"],
|
| 7 |
+
"detection_methods": ["pattern_analysis", "anomaly_detection"]
|
| 8 |
+
},
|
| 9 |
+
"agents": [
|
| 10 |
+
{
|
| 11 |
+
"name": "PatternAnalysisAgent",
|
| 12 |
+
"responsibility": "Detect known fraud patterns"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"name": "AnomalyDetectionAgent",
|
| 16 |
+
"responsibility": "Identify unusual claim behaviors"
|
| 17 |
+
}
|
| 18 |
+
],
|
| 19 |
+
"success_criteria": [
|
| 20 |
+
"Fraud detection precision >=70%",
|
| 21 |
+
"False positive rate <20%"
|
| 22 |
+
]
|
| 23 |
+
}
|
vercept/vercept_prd.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"project_name": "FraudSimulator-AI",
|
| 3 |
+
"phase": "PRD",
|
| 4 |
+
"business_kpis": [
|
| 5 |
+
"+15% fraud detection precision improvement",
|
| 6 |
+
"Reduced investigation costs"
|
| 7 |
+
],
|
| 8 |
+
"compliance": [
|
| 9 |
+
"Fraud investigation audit trail",
|
| 10 |
+
"Regulatory reporting ready"
|
| 11 |
+
],
|
| 12 |
+
"deployment": {
|
| 13 |
+
"environment": "secure enterprise API",
|
| 14 |
+
"access_control": "role-based"
|
| 15 |
+
},
|
| 16 |
+
"scalability": {
|
| 17 |
+
"batch_processing": true,
|
| 18 |
+
"real_time_api": true
|
| 19 |
+
}
|
| 20 |
+
}
|