trax/launch_research_agent.py

45 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
"""Launcher for the Perplexity Research Agent using Streamlit."""
import subprocess
import sys
from pathlib import Path
def main():
"""Launch the research agent Streamlit app."""
# Get the project root directory
project_root = Path(__file__).parent
app_path = project_root / "src" / "research_agent_app.py"
if not app_path.exists():
print(f"❌ Research agent app not found at: {app_path}")
sys.exit(1)
print("🧠 Launching Perplexity Research Agent...")
print("📱 Opening Streamlit interface...")
print("🌐 The app will open in your default browser")
print("🔑 Make sure OPENROUTER_API_KEY is set in your environment")
print()
try:
# Launch Streamlit app
subprocess.run([
sys.executable, "-m", "streamlit", "run", str(app_path),
"--server.port", "8501",
"--server.address", "localhost",
"--browser.gatherUsageStats", "false"
], check=True)
except KeyboardInterrupt:
print("\n👋 Research agent stopped by user")
except subprocess.CalledProcessError as e:
print(f"❌ Failed to launch research agent: {e}")
sys.exit(1)
except FileNotFoundError:
print("❌ Streamlit not found. Install with: uv pip install streamlit")
sys.exit(1)
if __name__ == "__main__":
main()