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())