""" run_all_agents.py — Unified Agent Platform Launcher Launches the ScaleMate Executive SuperAgent Multi-Agent Platform on Port 8000. Interactive Swagger API Docs: http://localhost:8000/docs """ import subprocess import sys import os def main(): if os.getenv("SPACE_ID"): port = int(os.getenv("PORT", "7860")) else: port = int(os.getenv("PORT", "8000")) print(f"Starting ScaleMate Multi-Agent System on Port {port}...\n") print(f" Server URL: http://localhost:{port}") print(f" Interactive API Docs: http://localhost:{port}/docs\n") backend_dir = os.path.abspath(os.path.dirname(__file__)) try: proc = subprocess.Popen( [ sys.executable, "-m", "uvicorn", "backend.SuperAgent.main:app", "--host", "0.0.0.0", "--port", str(port), "--reload", ], cwd=os.path.abspath(os.path.join(backend_dir, "..")), ) proc.wait() except KeyboardInterrupt: print("\nShutting down Multi-Agent System...") proc.terminate() print("Server stopped.\n") if __name__ == "__main__": main()