File size: 1,193 Bytes
e1fcab1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
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()