Update backend/agents/coordinator_agent.py

#6
by munals - opened
Files changed (1) hide show
  1. backend/agents/coordinator_agent.py +7 -10
backend/agents/coordinator_agent.py CHANGED
@@ -80,7 +80,7 @@ class CoordinatorAgent:
80
 
81
  self._groq_client = Groq(api_key=groq_api_key)
82
  self._active_backend = 'groq'
83
- self._active_model = 'openai/gpt-oss-120b'
84
 
85
  print(f'🧠 [CoordinatorAgent] Ready β€” backend=groq model={self._active_model} | ReAct loop')
86
 
@@ -119,16 +119,13 @@ class CoordinatorAgent:
119
  plan['confidence_score'] = 0.5
120
 
121
  # GR-C4: Consistency β€” threat_level must match risk_score thresholds
122
- # risk < 0.35 β†’ must be LOW
123
- # 0.35 <= risk < 0.65 β†’ must be MEDIUM
124
- # risk >= 0.65 β†’ HIGH or CRITICAL allowed
125
- expected = 'HIGH' if risk_score >= 0.65 else 'MEDIUM' if risk_score >= 0.35 else 'LOW'
126
  tl_current = plan['threat_level']
127
- if expected == 'LOW' and tl_current in ('MEDIUM', 'HIGH', 'CRITICAL'):
128
- issues.append(f'GR_C4_threat_downgraded:{tl_current}->{expected}')
129
- plan['threat_level'] = expected
130
- elif expected == 'MEDIUM' and tl_current in ('HIGH', 'CRITICAL'):
131
- issues.append(f'GR_C4_threat_downgraded:{tl_current}->{expected}')
132
  plan['threat_level'] = expected
133
 
134
  # GR-C5: Arabic alert fallback
 
80
 
81
  self._groq_client = Groq(api_key=groq_api_key)
82
  self._active_backend = 'groq'
83
+ self._active_model = 'llama-3.3-70b-versatile'
84
 
85
  print(f'🧠 [CoordinatorAgent] Ready β€” backend=groq model={self._active_model} | ReAct loop')
86
 
 
119
  plan['confidence_score'] = 0.5
120
 
121
  # GR-C4: Consistency β€” threat_level must match risk_score thresholds
122
+ # risk > 0.80 (density_pct > 80%) β†’ HIGH
123
+ # risk > 0.20 (density_pct > 20%) β†’ MEDIUM
124
+ # risk <= 0.20 (density_pct <= 20%) β†’ LOW
125
+ expected = 'HIGH' if risk_score > 0.80 else 'MEDIUM' if risk_score > 0.20 else 'LOW'
126
  tl_current = plan['threat_level']
127
+ if tl_current != expected:
128
+ issues.append(f'GR_C4_threat_corrected:{tl_current}->{expected}')
 
 
 
129
  plan['threat_level'] = expected
130
 
131
  # GR-C5: Arabic alert fallback