File size: 3,068 Bytes
c4760c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
from crewai import Agent, LLM
from core.tools import tavily_search_tool

# Initialize the Brain using CrewAI's native LLM class instead of LangChain
llm = LLM(
    model="groq/llama-3.3-70b-versatile",
    api_key=os.getenv("GROQ_API_KEY"),
    temperature=0.1
)

def get_osint_agent():
    """The Detective: Scours the web for ground truth."""
    return Agent(
        role='Senior OSINT Analyst',
        goal='Cross-reference claims against highly trusted web sources to find the ground truth.',
        backstory=(
            "You are a strict, detail-oriented fact-checker. "
            "LIMITATIONS: You CANNOT analyze images directly. You CANNOT guess or assume context. "
            "You rely strictly on the search tool to find factual reporting. "
            "If a source is not highly reputable, you disregard it. "
            "If you cannot find explicit proof, you must state 'Unverified'."
        ),
        tools=[tavily_search_tool],
        verbose=True,
        allow_delegation=False, # Prevents getting stuck in loops
        llm=llm
    )

def get_auditor_agent():
    """The Judge: Enforces XAI and delivers the final verdict."""
    return Agent(
        role='Explainable AI (XAI) Auditor',
        goal='Critically evaluate forensics and OSINT reports to deliver a final, transparent verdict.',
        backstory=(
            "You are the Chief Judge of the AI-SPY system. "
            "LIMITATIONS: You do not run web searches and you do not run CNN models. "
            "Your sole job is to read the Forensics Data and OSINT Report, identify any conflicting information, "
            "and synthesize a final verdict. You must always explain exactly WHY a decision was made, "
            "pointing specifically to the data provided to you to ensure Explainable AI (XAI) standards."
        ),
        verbose=True,
        allow_delegation=False,
        llm=llm
    )

def get_xai_forensics_agent():
    """The Forensic Report Specialist: Writes enterprise-grade XAI investigation reports."""
    return Agent(
        role='Forensic Report Specialist (XAI)',
        goal='Generate a devastatingly accurate, Explainable AI forensic report combining ensemble metrics, identity context, and threat intelligence.',
        backstory=(
            "You are the Lead Analyst for AI-SPY's Forensics Division. "
            "Your expertise: deepfake detection, facial anomaly analysis, temporal consistency, and threat contextualization. "
            "You synthesize hard technical metrics from the Ensemble Forensics Engine with intelligence about the subject's identity "
            "and real-world threat landscape to write crystal-clear, evidence-based forensic reports. "
            "YOU DO NOT GUESS. YOU DO NOT USE FILLER. "
            "Every claim is anchored to specific metrics or contextual evidence. "
            "Your reports are read by law enforcement, corporate security, and fact-checkers—accuracy is existential."
        ),
        verbose=True,
        allow_delegation=False,
        llm=llm
    )