#!/usr/bin/env python3 """ Test script for the new Senior Research Analyst feature """ def test_imports(): """Test that all new components can be imported""" try: from agents import ResearchAnalystAgent, MasterOrchestrator print("✅ ResearchAnalystAgent imported successfully") from config import Config print("✅ Config imported successfully") from utils.prompts import PromptManager print("✅ PromptManager imported successfully") return True except ImportError as e: print(f"❌ Import error: {e}") return False def test_agent_initialization(): """Test that the ResearchAnalystAgent can be initialized""" try: from agents import ResearchAnalystAgent from config import Config agent = ResearchAnalystAgent(name='TestResearchAgent', model=Config.OPENAI_MODEL) print("✅ ResearchAnalystAgent initialized successfully") return True except Exception as e: print(f"❌ Agent initialization error: {e}") return False def test_research_prompts(): """Test that research prompts are available""" try: from utils.prompts import PromptManager pm = PromptManager() all_prompts = pm.get_all_prompts() research_prompts = [pid for pid, prompt in all_prompts.items() if prompt.get('category') == 'research'] print(f"✅ Found {len(research_prompts)} research prompts:") for prompt_id in research_prompts: prompt_info = all_prompts[prompt_id] print(f" - {prompt_id}: {prompt_info['name']}") return len(research_prompts) > 0 except Exception as e: print(f"❌ Research prompts test error: {e}") return False def test_orchestrator_integration(): """Test that the orchestrator can handle research targets""" try: from agents import ResearchAnalystAgent, MasterOrchestrator from config import Config # Create agents dict with research agent agents = { "research": ResearchAnalystAgent(name="ResearchAnalystAgent", model=Config.OPENAI_MODEL) } orchestrator = MasterOrchestrator(agents=agents) print("✅ MasterOrchestrator initialized with research agent") return True except Exception as e: print(f"❌ Orchestrator integration error: {e}") return False def main(): """Run all tests""" print("🧪 Testing Senior Research Analyst Feature Implementation") print("=" * 60) tests = [ ("Import Tests", test_imports), ("Agent Initialization", test_agent_initialization), ("Research Prompts", test_research_prompts), ("Orchestrator Integration", test_orchestrator_integration), ] results = [] for test_name, test_func in tests: print(f"\n🔍 Running {test_name}...") result = test_func() results.append((test_name, result)) print("\n" + "=" * 60) print("📊 Test Results Summary:") all_passed = True for test_name, result in results: status = "✅ PASS" if result else "❌ FAIL" print(f" {status} {test_name}") if not result: all_passed = False print("\n" + "=" * 60) if all_passed: print("🎉 All tests passed! Senior Research Analyst feature is ready.") print("\n🚀 New Features Available:") print(" - Senior Research Analyst Agent with R&D pipeline focus") print(" - 4 specialized research prompts") print(" - Dedicated research analysis tab in UI") print(" - Streaming support for research analysis") print(" - Export functionality for research results") else: print("⚠️ Some tests failed. Please check the implementation.") return all_passed if __name__ == "__main__": main()