-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
67 lines (55 loc) · 1.76 KB
/
main.py
File metadata and controls
67 lines (55 loc) · 1.76 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"""Main entry point for the AI debugging system."""
import argparse
import sys
import uvicorn
from dotenv import load_dotenv
load_dotenv()
from leader_agent.server import create_leader_app
from debugger_agent.server import create_debugger_app
from fixer_agent.server import create_fixer_app
class ServerConfig:
"""Configuration for the server."""
HOST = "0.0.0.0"
LEADER_PORT = 8000
DEBUGGER_PORT = 8001
FIXER_PORT = 8002
def parse_args():
"""Parse command line arguments."""
parser = argparse.ArgumentParser(
description="AI Debugging System - Agent Server"
)
parser.add_argument(
"agent",
choices=["leader", "debugger", "fixer"],
help="Which agent server to run"
)
parser.add_argument(
"--port",
type=int,
help="Port to run the server on (defaults to predefined ports)"
)
return parser.parse_args()
def main():
"""Main function to run the agent server."""
args = parse_args()
agent_type = args.agent.lower()
# Determine which agent to run and on which port
if agent_type == "leader":
app = create_leader_app()
port = args.port or ServerConfig.LEADER_PORT
agent_name = "Leader"
elif agent_type == "debugger":
app = create_debugger_app()
port = args.port or ServerConfig.DEBUGGER_PORT
agent_name = "Debugger"
elif agent_type == "fixer":
app = create_fixer_app()
port = args.port or ServerConfig.FIXER_PORT
agent_name = "Fixer"
else:
print(f"Error: Invalid agent type '{agent_type}'")
sys.exit(1)
print(f"Starting {agent_name} Agent server on port {port}...")
uvicorn.run(app, host=ServerConfig.HOST, port=port)
if __name__ == "__main__":
main()