-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_project.py
More file actions
198 lines (158 loc) Β· 5.62 KB
/
setup_project.py
File metadata and controls
198 lines (158 loc) Β· 5.62 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/usr/bin/env python3
"""
Project Setup Script
Automatically creates the project directory structure for the Multi-Agent Software Development System.
"""
import os
from pathlib import Path
def create_project_structure():
"""Create the project folder structure and necessary files."""
# Define the root directory (current directory where script is run)
root_dir = Path.cwd()
# Define folder structure
folders = [
"agents",
"tools",
"utils",
"workspace",
]
# Create directories
print("π Creating directories...")
for folder in folders:
folder_path = root_dir / folder
folder_path.mkdir(exist_ok=True)
print(f" β Created: {folder}")
# Create __init__.py files in each module folder
print("\nπ Creating __init__.py files...")
for folder in folders:
init_file = root_dir / folder / "__init__.py"
if not init_file.exists():
init_file.write_text("")
print(f" β Created: {folder}/__init__.py")
else:
print(f" βΉ Already exists: {folder}/__init__.py")
# Create main.py
print("\nπ Creating main.py...")
main_py_path = root_dir / "main.py"
if not main_py_path.exists():
main_py_content = '''#!/usr/bin/env python3
"""
Multi-Agent Software Development System - Main Orchestrator
"""
from agents.planner import PlannerAgent
from agents.coder import CoderAgent
from agents.reviewer import ReviewerAgent
from config import Config
def main():
"""Main entry point for the orchestrator."""
config = Config()
# Initialize agents
planner = PlannerAgent(config)
coder = CoderAgent(config)
reviewer = ReviewerAgent(config)
# Example: Process user request
user_request = "Create an arXiv CS Daily webpage"
print(f"π Starting Multi-Agent System")
print(f"π User Request: {user_request}")
print("-" * 50)
# Step 1: Planning
print("\\nπ Step 1: Planning Phase...")
plan = planner.generate_plan(user_request)
print(f"β Plan generated: {plan}")
# Step 2: Code Generation
print("\\nπ Step 2: Code Generation Phase...")
for task in plan.get("tasks", []):
print(f" Executing: {task}")
code = coder.generate_code(task)
print(f" β Generated code for: {task}")
# Step 3: Review (Optional)
print("\\nπ Step 3: Review Phase (Optional)...")
print("β System ready for code review")
print("\\n" + "=" * 50)
print("β
Multi-Agent System Execution Complete!")
if __name__ == "__main__":
main()
'''
main_py_path.write_text(main_py_content)
print(f" β Created: main.py")
else:
print(f" βΉ Already exists: main.py")
# Create config.py
print("\nπ Creating config.py...")
config_py_path = root_dir / "config.py"
if not config_py_path.exists():
config_py_content = '''"""
Configuration Module
Loads environment variables and project settings.
"""
import os
from pathlib import Path
from dotenv import load_dotenv
# Load environment variables from .env
load_dotenv()
class Config:
"""Configuration class for the Multi-Agent System."""
# LLM Configuration
LLM_PROVIDER = os.getenv("LLM_PROVIDER", "deepseek")
LLM_API_KEY = os.getenv("LLM_API_KEY", "")
LLM_MODEL = os.getenv("LLM_MODEL", "deepseek-chat")
LLM_BASE_URL = os.getenv("LLM_BASE_URL", "https://api.deepseek.com")
# Project Paths
PROJECT_ROOT = Path(__file__).parent
WORKSPACE_DIR = PROJECT_ROOT / "workspace"
# Agent Configuration
PLANNER_MODEL = os.getenv("PLANNER_MODEL", "deepseek-chat")
CODER_MODEL = os.getenv("CODER_MODEL", "deepseek-chat")
REVIEWER_MODEL = os.getenv("REVIEWER_MODEL", "deepseek-chat")
# Logging
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
def __init__(self):
"""Initialize configuration and validate required settings."""
if not self.LLM_API_KEY:
raise ValueError(
"LLM_API_KEY not found in environment variables. "
"Please set it in .env file."
)
# Ensure workspace directory exists
self.WORKSPACE_DIR.mkdir(exist_ok=True)
if __name__ == "__main__":
config = Config()
print(f"Project Root: {config.PROJECT_ROOT}")
print(f"Workspace Dir: {config.WORKSPACE_DIR}")
print(f"LLM Provider: {config.LLM_PROVIDER}")
print(f"LLM Model: {config.LLM_MODEL}")
'''
config_py_path.write_text(config_py_content)
print(f" β Created: config.py")
else:
print(f" βΉ Already exists: config.py")
# Create .env file
print("\nπ Creating .env file...")
env_path = root_dir / ".env"
if not env_path.exists():
env_content = '''# LLM Configuration
LLM_PROVIDER=deepseek
LLM_API_KEY=your_api_key_here
LLM_MODEL=deepseek-chat
LLM_BASE_URL=https://api.deepseek.com
# Agent-specific models (optional - defaults to LLM_MODEL)
PLANNER_MODEL=deepseek-chat
CODER_MODEL=deepseek-chat
REVIEWER_MODEL=deepseek-chat
# Logging
LOG_LEVEL=INFO
'''
env_path.write_text(env_content)
print(f" β Created: .env")
else:
print(f" βΉ Already exists: .env")
print("\n" + "=" * 50)
print("β
Project Structure Setup Complete!")
print("=" * 50)
print("\nNext Steps:")
print("1. Update .env file with your LLM API credentials")
print("2. Install dependencies: pip install -r requirements.txt")
print("3. Implement agent modules in agents/ folder")
print("4. Run: python main.py")
if __name__ == "__main__":
create_project_structure()