Spaces:
Sleeping
Sleeping
agent:role / instruction, prompt
Browse files- src/streamlit_app.py +82 -37
src/streamlit_app.py
CHANGED
|
@@ -156,62 +156,86 @@ def main() -> None:
|
|
| 156 |
# Setup the openai
|
| 157 |
set_openai_key(st.session_state.api_key)
|
| 158 |
|
| 159 |
-
|
| 160 |
ceo = Agent(
|
| 161 |
-
name
|
| 162 |
-
description
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
|
|
|
| 165 |
""",
|
| 166 |
-
tools
|
| 167 |
-
api_headers
|
| 168 |
-
temperature
|
| 169 |
-
max_prompt_tokens
|
| 170 |
)
|
| 171 |
|
| 172 |
cto = Agent(
|
| 173 |
-
name
|
| 174 |
-
description
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
""",
|
| 178 |
-
tools
|
| 179 |
-
api_headers
|
| 180 |
-
temperature
|
| 181 |
-
max_prompt_tokens
|
| 182 |
)
|
| 183 |
|
| 184 |
product_manager = Agent(
|
| 185 |
-
name
|
| 186 |
-
description
|
| 187 |
-
|
| 188 |
-
|
|
|
|
| 189 |
""",
|
| 190 |
-
api_headers
|
| 191 |
-
temperature
|
| 192 |
-
max_prompt_tokens
|
| 193 |
)
|
| 194 |
|
| 195 |
developer = Agent(
|
| 196 |
-
name
|
| 197 |
-
description
|
| 198 |
-
|
| 199 |
-
|
|
|
|
|
|
|
| 200 |
""",
|
| 201 |
-
api_headers
|
| 202 |
-
temperature
|
| 203 |
-
max_prompt_tokens
|
| 204 |
)
|
| 205 |
|
| 206 |
client_manager = Agent(
|
| 207 |
-
name
|
| 208 |
-
description
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
| 211 |
""",
|
| 212 |
-
api_headers
|
| 213 |
-
temperature
|
| 214 |
-
max_prompt_tokens
|
| 215 |
)
|
| 216 |
|
| 217 |
agency = Agency(
|
|
@@ -239,4 +263,25 @@ def main() -> None:
|
|
| 239 |
"priority": priority,
|
| 240 |
"technical_requirements": tech_requirements,
|
| 241 |
"special_consideration": special_consideration
|
| 242 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
# Setup the openai
|
| 157 |
set_openai_key(st.session_state.api_key)
|
| 158 |
|
| 159 |
+
# Create agents
|
| 160 |
ceo = Agent(
|
| 161 |
+
name="Project Director",
|
| 162 |
+
description="You are a CEO of multiple companies in the past and have a lot of experience in evaluating projects and making strategic decisions.",
|
| 163 |
+
instructions="""
|
| 164 |
+
You are an experienced CEO who evaluates projects. Follow these steps strictly:
|
| 165 |
+
|
| 166 |
+
1. FIRST, use the AnalyzeProjectRequirements tool with:
|
| 167 |
+
- project_name: The name from the project details
|
| 168 |
+
- project_description: The full project description
|
| 169 |
+
- project_type: The type of project (Web Application, Mobile App, etc)
|
| 170 |
+
- budget_range: The specified budget range
|
| 171 |
+
|
| 172 |
+
2. WAIT for the analysis to complete before proceeding.
|
| 173 |
|
| 174 |
+
3. Review the analysis results and provide strategic recommendations.
|
| 175 |
""",
|
| 176 |
+
tools=[AnalyzeProjectRequirements],
|
| 177 |
+
api_headers=api_headers,
|
| 178 |
+
temperature=0.7,
|
| 179 |
+
max_prompt_tokens=25000
|
| 180 |
)
|
| 181 |
|
| 182 |
cto = Agent(
|
| 183 |
+
name="Technical Architect",
|
| 184 |
+
description="Senior technical architect with deep expertise in system design.",
|
| 185 |
+
instructions="""
|
| 186 |
+
You are a technical architect. Follow these steps strictly:
|
| 187 |
+
|
| 188 |
+
1. WAIT for the project analysis to be completed by the CEO.
|
| 189 |
|
| 190 |
+
2. Use the CreateTechnicalSpecification tool with:
|
| 191 |
+
- architecture_type: Choose from monolithic/microservices/serverless/hybrid
|
| 192 |
+
- core_technologies: List main technologies as comma-separated values
|
| 193 |
+
- scalability_requirements: Choose high/medium/low based on project needs
|
| 194 |
+
|
| 195 |
+
3. Review the technical specification and provide additional recommendations.
|
| 196 |
""",
|
| 197 |
+
tools=[CreateTechnicalSpecification],
|
| 198 |
+
api_headers=api_headers,
|
| 199 |
+
temperature=0.5,
|
| 200 |
+
max_prompt_tokens=25000
|
| 201 |
)
|
| 202 |
|
| 203 |
product_manager = Agent(
|
| 204 |
+
name="Product Manager",
|
| 205 |
+
description="Experienced product manager focused on delivery excellence.",
|
| 206 |
+
instructions="""
|
| 207 |
+
- Manage project scope and timeline giving the roadmap of the project
|
| 208 |
+
- Define product requirements and you should give potential products and features that can be built for the startup
|
| 209 |
""",
|
| 210 |
+
api_headers=api_headers,
|
| 211 |
+
temperature=0.4,
|
| 212 |
+
max_prompt_tokens=25000
|
| 213 |
)
|
| 214 |
|
| 215 |
developer = Agent(
|
| 216 |
+
name="Lead Developer",
|
| 217 |
+
description="Senior developer with full-stack expertise.",
|
| 218 |
+
instructions="""
|
| 219 |
+
- Plan technical implementation
|
| 220 |
+
- Provide effort estimates
|
| 221 |
+
- Review technical feasibility
|
| 222 |
""",
|
| 223 |
+
api_headers=api_headers,
|
| 224 |
+
temperature=0.3,
|
| 225 |
+
max_prompt_tokens=25000
|
| 226 |
)
|
| 227 |
|
| 228 |
client_manager = Agent(
|
| 229 |
+
name="Client Success Manager",
|
| 230 |
+
description="Experienced client manager focused on project delivery.",
|
| 231 |
+
instructions="""
|
| 232 |
+
- Ensure client satisfaction
|
| 233 |
+
- Manage expectations
|
| 234 |
+
- Handle feedback
|
| 235 |
""",
|
| 236 |
+
api_headers=api_headers,
|
| 237 |
+
temperature=0.6,
|
| 238 |
+
max_prompt_tokens=25000
|
| 239 |
)
|
| 240 |
|
| 241 |
agency = Agency(
|
|
|
|
| 263 |
"priority": priority,
|
| 264 |
"technical_requirements": tech_requirements,
|
| 265 |
"special_consideration": special_consideration
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
st.session_state.messages.append({
|
| 269 |
+
"role": "user",
|
| 270 |
+
"content" : str(project_info)
|
| 271 |
+
})
|
| 272 |
+
|
| 273 |
+
# Create tab and run analysis
|
| 274 |
+
with st.spinner("dev.ai is analyzing your project..."):
|
| 275 |
+
try:
|
| 276 |
+
# Get analysis from each agent using agency.get_completion()
|
| 277 |
+
ceo_resp = agency.get_completion(
|
| 278 |
+
message = f"""Analyze this project using AnalyzeProjectRequirement tool:
|
| 279 |
+
Project Name: {project_name}
|
| 280 |
+
Project Description: {project_description}
|
| 281 |
+
Project Type: {project_type}
|
| 282 |
+
Budget Range: {budget_range}
|
| 283 |
+
|
| 284 |
+
Use these exact values with tool and wait for the analysis results.""",
|
| 285 |
+
recipient_agent = ceo
|
| 286 |
+
)
|
| 287 |
+
|