import sys import os import asyncio import json # Add project root to path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from services.elephant_alpha_orchestrator import elephant_orchestrator from services.elephant_service import elephant_service async def test_orchestration(): print("--- Testing Elephant Alpha Orchestration ---") # Check service availability status = elephant_service.check_connection() print(f"Elephant Service Status: {'OK' if status else 'ERROR'}") if not status: print("Skipping orchestration test due to service error.") return # Simulate a business event business_context = { "task_type": "price_optimization", "urgency": "high", "market_situation": "Competitor A dropped price of core 10 products by 20%", "inventory_level": "healthy" } print("Sending context to Elephant Alpha Orchestrator...") try: decision = await elephant_orchestrator.analyze_and_coordinate(business_context) print("\n--- Strategic Decision ---") print(f"Priority: {decision.priority}") print(f"Reasoning: {decision.reasoning}") print(f"Agents Required: {decision.agents_required}") print("\nExecution Plan:") for step in decision.execution_plan: print(f"- {step.get('agent')}: {step.get('action')}") except Exception as e: print(f"Orchestration failed: {e}") if __name__ == "__main__": asyncio.run(test_orchestration())