-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathsdlc_crew.py
More file actions
245 lines (204 loc) Β· 7.34 KB
/
sdlc_crew.py
File metadata and controls
245 lines (204 loc) Β· 7.34 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
from crewai import Agent, Crew, Task, Process
from crewai.project import CrewBase, agent, task, crew, before_kickoff, after_kickoff
from crewai.agents.agent_builder.base_agent import BaseAgent
from typing import List, Dict, Any
import os
from datetime import datetime, timedelta
from dotenv import load_dotenv
load_dotenv()
os.environ["OPENAI_API_KEY"] = os.getenv("OPEN_ROUTER_KEY")
os.environ["SERPER_API_KEY"] = os.getenv("SERPER_API_KEY")
# os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.getenv('HF_TOKEN')
# os.environ['LITELLM_LOG'] = 'DEBUG'
os.environ['OPENAI_API_BASE'] = 'https://openrouter.ai/api/v1'
os.environ['OPENAI_BASE_URL'] = 'https://openrouter.ai/api/v1'
@CrewBase
class SDLCDevelopmentCrew:
"""
A comprehensive SDLC crew for building complete product specifications,
architecture, and development plans for application development.
"""
agents: List[BaseAgent]
tasks: List[Task]
# Paths to YAML configuration files
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@before_kickoff
def prepare_inputs(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
"""Prepare and validate inputs before crew execution"""
# Add default tech stack if not specified
if 'tech_stack' not in inputs:
inputs['tech_stack'] = {
'frontend': 'Streamlit',
'backend': 'FastAPI',
'language': 'Python',
'database': 'PostgreSQL',
'deployment': 'Docker'
}
# Set project timeline
start_date = datetime.now()
end_date = start_date + timedelta(days=60) # 2 months
inputs['project_timeline'] = {
'start_date': start_date.strftime('%Y-%m-%d'),
'end_date': end_date.strftime('%Y-%m-%d'),
'duration_weeks': 8
}
# Create output directory structure
inputs['output_directory'] = 'project_deliverables'
return inputs
@after_kickoff
def process_output(self, output):
"""Process and organize output files after crew completion"""
print("\n" + "="*50)
print("π SDLC CREW EXECUTION COMPLETED!")
print("="*50)
print(f"π All deliverables saved to: {output.get('output_directory', 'project_deliverables')}")
print("\nπ Generated Documents:")
print(" βββ business_requirements.md")
print(" βββ product_requirements.md")
print(" βββ software_architecture.md")
print(" βββ api_specifications.yaml")
print(" βββ high_level_design.md")
print(" βββ low_level_design.md")
print(" βββ product_roadmap.md")
print(" βββ tech_stack_analysis.md")
print("\nβ
Ready for development phase!")
return output
# =============================================================================
# AGENTS DEFINITION
# =============================================================================
@agent
def product_manager(self) -> Agent:
return Agent(
config=self.agents_config['product_manager'],
verbose=True
)
@agent
def business_analyst(self) -> Agent:
return Agent(
config=self.agents_config['business_analyst'],
verbose=True
)
@agent
def software_architect(self) -> Agent:
return Agent(
config=self.agents_config['software_architect'],
verbose=True
)
@agent
def technical_lead(self) -> Agent:
return Agent(
config=self.agents_config['technical_lead'],
verbose=True
)
@agent
def api_designer(self) -> Agent:
return Agent(
config=self.agents_config['api_designer'],
verbose=True
)
@agent
def ui_ux_designer(self) -> Agent:
return Agent(
config=self.agents_config['ui_ux_designer'],
verbose=True
)
@agent
def quality_assurance_lead(self) -> Agent:
return Agent(
config=self.agents_config['quality_assurance_lead'],
verbose=True
)
# =============================================================================
# TASKS DEFINITION
# =============================================================================
@task
def analyze_business_requirements(self) -> Task:
return Task(
config=self.tasks_config['analyze_business_requirements']
)
@task
def create_product_requirements(self) -> Task:
return Task(
config=self.tasks_config['create_product_requirements']
)
@task
def design_software_architecture(self) -> Task:
return Task(
config=self.tasks_config['design_software_architecture']
)
@task
def design_api_specifications(self) -> Task:
return Task(
config=self.tasks_config['design_api_specifications']
)
@task
def create_high_level_design(self) -> Task:
return Task(
config=self.tasks_config['create_high_level_design']
)
@task
def create_low_level_design(self) -> Task:
return Task(
config=self.tasks_config['create_low_level_design']
)
@task
def develop_product_roadmap(self) -> Task:
return Task(
config=self.tasks_config['develop_product_roadmap']
)
@task
def validate_tech_stack(self) -> Task:
return Task(
config=self.tasks_config['validate_tech_stack']
)
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=False,
memory=False,
max_rpm=10,
share_crew=True
)
# =============================================================================
# USAGE EXAMPLE
# =============================================================================
def run_sdlc_crew(app_idea: str, additional_requirements: str = ""):
"""
Execute the SDLC crew with the given app idea
Args:
app_idea (str): Description of the application to be built
additional_requirements (str): Any additional specific requirements
"""
crew_instance = SDLCDevelopmentCrew()
inputs = {
'app_idea': app_idea,
'additional_requirements': additional_requirements,
'target_users': 'General users',
'business_goals': 'To be defined during analysis',
'constraints': 'Budget and time constraints as per timeline'
}
result = crew_instance.crew().kickoff(inputs=inputs)
return result
# Example usage:
if __name__ == "__main__":
app_description = """
A task management application that helps teams collaborate on projects.
Key features should include:
- User authentication and role management
- Project creation and management
- Task assignment and tracking
- Real-time notifications
- Dashboard with analytics
- Mobile-responsive design
"""
additional_reqs = """
- Must integrate with popular calendar applications
- Should support file attachments
- Needs offline capability for mobile users
- Must comply with GDPR requirements
"""
result = run_sdlc_crew(app_description, additional_reqs)