system-prompts-and-models-o.../salesflow-saas/scripts/grand_launch_simulation.py
2026-04-04 18:04:21 +03:00

77 lines
2.8 KiB
Python

import sys
import os
import asyncio
import logging
# Setup Path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../backend')))
from backend.app.agents.master_langgraph import CEOLangGraphOrchestrator, CEOState
# Configure Logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - [%(levelname)s] - %(message)s")
logger = logging.getLogger(__name__)
async def run_grand_launch_simulation():
"""
Simulates the full autonomous revenue lifecycle for a new enterprise prospect.
"""
logger.info("🚀 [GRAND LAUNCH SIMULATION] Starting Dealix Revenue OS...")
# Initialize Orchestrator
orchestrator = CEOLangGraphOrchestrator()
# Define Initial State for a High-Value Lead
initial_state: CEOState = {
"deal_id": "DEAL-TX-9988",
"company_name": "Al-Faisaliah Group",
"decision_maker": "Mohammed Al-Faisal",
"industry": "Real Estate / Enterprise",
"deal_stage": "Discovery",
"intent_score": 0.0,
"next_action_payload": "",
"compliance_approved": False,
"human_intervention_required": False,
"email_sent": False,
"linkedin_sent": False,
"history_log": ["Lead discovered in Saudi Business Directory."]
}
logger.info(f"📍 Targeting Prospect: {initial_state['company_name']} | Industry: {initial_state['industry']}")
# Execute LangGraph Lifecycle
# In a real environment, we'd use orchestrator.app.invoke(initial_state)
# We will simulate the node sequence here to verify logic
# Step 1: Prospecting & Research
state = orchestrator.prospecting_node(initial_state)
# Step 2: Compliance & Risk Check
state = orchestrator.compliance_node(state)
# Step 3: Human Handoff / Decision Point
state = orchestrator.human_handoff_node(state)
# Step 4: Multi-Channel Outreach (Active if no manual intervention needed)
if not state["human_intervention_required"]:
logger.info("🔥 Autonomous Outreach Triggered!")
state = orchestrator.email_outreach_node(state)
state = orchestrator.linkedin_outreach_node(state)
# Step 5: CRM Sync
state = orchestrator.sync_salesforce_node(state)
# Final Report
logger.info("✅ [SIMULATION COMPLETE] Final Deal State:")
logger.info(f" - ID: {state['deal_id']}")
logger.info(f" - Company: {state['company_name']}")
logger.info(f" - Email Sent: {state['email_sent']}")
logger.info(f" - LinkedIn Sent: {state['linkedin_sent']}")
logger.info(f" - History: {' -> '.join(state['history_log'])}")
logger.info("🇸🇦 DEAlIX REVENUE OS IS PRODUCTION READY.")
if __name__ == "__main__":
asyncio.run(run_grand_launch_simulation())