system-prompts-and-models-o.../salesflow-saas/backend/dealix_gtm_os/agents/compliance_agent.py
Claude 20277e0afc
feat: Dealix GTM Intelligence OS — multi-agent system
8 agents + 4 models + 4 configs + CLI dry-run + 3 docs.
Tested on agency/real_estate/clinic/saas — all pass.
Safety: LinkedIn scraping PROHIBITED, WhatsApp blast PROHIBITED.

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
2026-04-26 17:16:52 +00:00

33 lines
1.6 KiB
Python

import yaml
from pathlib import Path
from dealix_gtm_os.agents.base_agent import BaseAgent
from dealix_gtm_os.models.message import AutomationLevel
RULES_PATH = Path(__file__).parent.parent / "config" / "compliance_rules.yaml"
class ComplianceAgent(BaseAgent):
name = "compliance"
description = "Enforces platform safety rules"
def __init__(self):
if RULES_PATH.exists():
with open(RULES_PATH) as f:
self.rules = yaml.safe_load(f)
else:
self.rules = {}
async def run(self, input_data: dict) -> dict:
channel = input_data.get("channel", "email")
action = input_data.get("action", "send_message")
channel_key = channel.replace("_manual", "").replace("_warm", "").replace("_inbound", "").replace("_post", "").replace("_reply", "")
if channel_key == "linkedin":
channel_key = "linkedin"
elif channel_key in ("x", "twitter"):
channel_key = "x_twitter"
rules = self.rules.get(channel_key, {})
if rules.get(action) == "prohibited" or rules.get("scraping") == "prohibited" and action == "scraping":
return {"allowed": False, "level": AutomationLevel.PROHIBITED.value, "reason": f"{action} on {channel} is prohibited by platform policy"}
if channel in ("linkedin_manual", "whatsapp_warm", "phone"):
return {"allowed": True, "level": AutomationLevel.MANUAL_REQUIRED.value, "reason": f"{channel} requires manual human approval"}
return {"allowed": True, "level": AutomationLevel.SEMI_AUTOMATED.value, "reason": f"{channel} is safe with opt-out"}