parthib07 commited on
Commit
e5e882e
·
verified ·
1 Parent(s): e424dea

Upload 52 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .env +1 -0
  2. .gitattributes +1 -0
  3. .pytest_cache/.gitignore +2 -0
  4. .pytest_cache/CACHEDIR.TAG +4 -0
  5. .pytest_cache/README.md +8 -0
  6. .pytest_cache/v/cache/lastfailed +3 -0
  7. .pytest_cache/v/cache/nodeids +1 -0
  8. .pytest_cache/v/cache/stepwise +1 -0
  9. README.md +70 -14
  10. agents/__pycache__/business_analyst.cpython-310.pyc +0 -0
  11. agents/__pycache__/designer.cpython-310.pyc +0 -0
  12. agents/__pycache__/developer.cpython-310.pyc +0 -0
  13. agents/__pycache__/project_manager.cpython-310.pyc +0 -0
  14. agents/__pycache__/tester.cpython-310.pyc +0 -0
  15. agents/business_analyst.py +46 -0
  16. agents/designer.py +44 -0
  17. agents/developer.py +111 -0
  18. agents/project_manager.py +123 -0
  19. agents/tester.py +66 -0
  20. api/__pycache__/main.cpython-310.pyc +0 -0
  21. app.py +167 -0
  22. chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/data_level0.bin +3 -0
  23. chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/header.bin +3 -0
  24. chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/length.bin +3 -0
  25. chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/link_lists.bin +3 -0
  26. chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/data_level0.bin +3 -0
  27. chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/header.bin +3 -0
  28. chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/length.bin +3 -0
  29. chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/link_lists.bin +3 -0
  30. chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/data_level0.bin +3 -0
  31. chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/header.bin +3 -0
  32. chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/length.bin +3 -0
  33. chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/link_lists.bin +3 -0
  34. chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/data_level0.bin +3 -0
  35. chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/header.bin +3 -0
  36. chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/length.bin +3 -0
  37. chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/link_lists.bin +3 -0
  38. chroma_db/chroma.sqlite3 +3 -0
  39. chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/data_level0.bin +3 -0
  40. chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/header.bin +3 -0
  41. chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/length.bin +3 -0
  42. chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/link_lists.bin +3 -0
  43. core/__pycache__/base_agent.cpython-310.pyc +0 -0
  44. core/__pycache__/config.cpython-310.pyc +0 -0
  45. core/__pycache__/database.cpython-310.pyc +0 -0
  46. core/__pycache__/workflow.cpython-310.pyc +0 -0
  47. core/base_agent.py +36 -0
  48. core/config.py +18 -0
  49. core/database.py +38 -0
  50. core/workflow.py +135 -0
.env ADDED
@@ -0,0 +1 @@
 
 
1
+ GROQ_API_KEY = "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"
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ chroma_db/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
.pytest_cache/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Created by pytest automatically.
2
+ *
.pytest_cache/CACHEDIR.TAG ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Signature: 8a477f597d28d172789f06886806bc55
2
+ # This file is a cache directory tag created by pytest.
3
+ # For information about cache directory tags, see:
4
+ # https://bford.info/cachedir/spec.html
.pytest_cache/README.md ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # pytest cache directory #
2
+
3
+ This directory contains data from the pytest's cache plugin,
4
+ which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
5
+
6
+ **Do not** commit this to version control.
7
+
8
+ See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
.pytest_cache/v/cache/lastfailed ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "tests/test_agents.py": true
3
+ }
.pytest_cache/v/cache/nodeids ADDED
@@ -0,0 +1 @@
 
 
1
+ []
.pytest_cache/v/cache/stepwise ADDED
@@ -0,0 +1 @@
 
 
1
+ []
README.md CHANGED
@@ -1,14 +1,70 @@
1
- ---
2
- title: Ai Virtual Dev Pod
3
- emoji: 🦀
4
- colorFrom: gray
5
- colorTo: purple
6
- sdk: streamlit
7
- sdk_version: 1.44.1
8
- app_file: app.py
9
- pinned: false
10
- license: apache-2.0
11
- short_description: ai_virtual_dev_pod
12
- ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AI-Powered Virtual Development Pod
2
+
3
+ An intelligent system that simulates a complete software development team using AI agents. The system handles the entire project lifecycle from requirements gathering to testing.
4
+
5
+ ## Features
6
+
7
+ - Business Analyst Agent: Creates user stories from high-level requirements
8
+ - Design Agent: Creates software design specifications
9
+ - Developer Agent: Generates code based on user stories and design
10
+ - Testing Agent: Creates and executes test cases
11
+ - Project Manager Interface: Web-based interface for project management
12
+
13
+ ## Project Structure
14
+
15
+ ```
16
+ .
17
+ ├── agents/ # Contains all agent implementations
18
+ │ ├── business_analyst.py
19
+ │ ├── designer.py
20
+ │ ├── developer.py
21
+ │ ├── tester.py
22
+ │ └── project_manager.py
23
+ ├── core/ # Core framework components
24
+ │ ├── config.py
25
+ │ ├── database.py
26
+ │ └── base_agent.py
27
+ ├── app.py # Streamlit web interface
28
+ └── tests/ # Test files
29
+ ```
30
+
31
+ ## Setup
32
+
33
+ 1. Create a virtual environment:
34
+ ```bash
35
+ python -m venv venv
36
+ source venv/bin/activate # On Windows: venv\Scripts\activate
37
+ ```
38
+
39
+ 2. Install dependencies:
40
+ ```bash
41
+ pip install -r requirements.txt
42
+ ```
43
+
44
+ 3. Set up environment variables:
45
+ Create a `.env` file with:
46
+ ```
47
+ GROQ_API_KEY=your_api_key_here
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ 1. Start the Streamlit app:
53
+ ```bash
54
+ streamlit run app.py
55
+ ```
56
+
57
+ 2. Open your web browser and navigate to the URL shown in the terminal (usually http://localhost:8501)
58
+
59
+ 3. Use the web interface to:
60
+ - Start new projects
61
+ - Check project status
62
+ - Run quality checks
63
+ - View generated artifacts
64
+
65
+ ## Development
66
+
67
+ - The system uses LangGraph for agent orchestration
68
+ - Groq's Gemma2-9b-it model as the LLM
69
+ - ChromaDB for vector storage and retrieval
70
+ - Streamlit for the web interface
agents/__pycache__/business_analyst.cpython-310.pyc ADDED
Binary file (1.75 kB). View file
 
agents/__pycache__/designer.cpython-310.pyc ADDED
Binary file (1.7 kB). View file
 
agents/__pycache__/developer.cpython-310.pyc ADDED
Binary file (3.58 kB). View file
 
agents/__pycache__/project_manager.cpython-310.pyc ADDED
Binary file (3.14 kB). View file
 
agents/__pycache__/tester.cpython-310.pyc ADDED
Binary file (2.14 kB). View file
 
agents/business_analyst.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from core.base_agent import BaseAgent
2
+ from core.database import db
3
+ from typing import Dict, Any
4
+
5
+ class BusinessAnalystAgent(BaseAgent):
6
+ def __init__(self):
7
+ super().__init__("Business Analyst")
8
+ self.create_chain("""
9
+ You are a Business Analyst. Your task is to create detailed user stories from the given business requirements.
10
+
11
+ Business Requirements:
12
+ {input}
13
+
14
+ Create user stories following this format:
15
+ As a [type of user]
16
+ I want [some goal]
17
+ So that [some reason]
18
+
19
+ Acceptance Criteria:
20
+ 1. [First criterion]
21
+ 2. [Second criterion]
22
+ ...
23
+
24
+ Please provide clear, testable user stories with specific acceptance criteria.
25
+ """)
26
+
27
+ async def create_user_stories(self, requirements: str) -> Dict[str, Any]:
28
+ """Create user stories from business requirements"""
29
+ result = await self.process({"input": requirements})
30
+
31
+ # Store the user stories in the database
32
+ db.store_artifact(
33
+ "user_stories",
34
+ result,
35
+ {
36
+ "type": "user_story",
37
+ "source": "business_analyst",
38
+ "status": "created"
39
+ }
40
+ )
41
+
42
+ return {
43
+ "status": "success",
44
+ "user_stories": result,
45
+ "message": "User stories created successfully"
46
+ }
agents/designer.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from core.base_agent import BaseAgent
2
+ from core.database import db
3
+ from typing import Dict, Any
4
+
5
+ class DesignerAgent(BaseAgent):
6
+ def __init__(self):
7
+ super().__init__("Designer")
8
+ self.create_chain("""
9
+ You are a Software Designer. Your task is to create detailed design specifications from the given user stories.
10
+
11
+ User Stories:
12
+ {input}
13
+
14
+ Create a comprehensive design document that includes:
15
+ 1. System Architecture
16
+ 2. Component Design
17
+ 3. Database Schema
18
+ 4. API Endpoints
19
+ 5. Data Flow Diagrams
20
+ 6. Security Considerations
21
+
22
+ Please provide a detailed, implementable design that follows best practices and design patterns.
23
+ """)
24
+
25
+ async def create_design(self, user_stories: str) -> Dict[str, Any]:
26
+ """Create design specifications from user stories"""
27
+ result = await self.process({"input": user_stories})
28
+
29
+ # Store the design in the database
30
+ db.store_artifact(
31
+ "designs",
32
+ result,
33
+ {
34
+ "type": "design",
35
+ "source": "designer",
36
+ "status": "created"
37
+ }
38
+ )
39
+
40
+ return {
41
+ "status": "success",
42
+ "design": result,
43
+ "message": "Design specifications created successfully"
44
+ }
agents/developer.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from core.base_agent import BaseAgent
2
+ from core.database import db
3
+ from typing import Dict, Any
4
+
5
+ class DeveloperAgent(BaseAgent):
6
+ def __init__(self):
7
+ super().__init__("Developer")
8
+ self.create_chain("""
9
+ You are an expert Software Developer. Your task is to generate production-ready, well-structured code based on the given design specifications.
10
+
11
+ Design Specifications:
12
+ {input}
13
+
14
+ Generate code that follows these strict guidelines:
15
+
16
+ 1. Code Structure:
17
+ - Use proper project structure with separate modules
18
+ - Follow SOLID principles
19
+ - Implement proper error handling
20
+ - Use type hints
21
+ - Include comprehensive docstrings
22
+ - Follow PEP 8 style guide
23
+
24
+ 2. Implementation Details:
25
+ - Use modern Python features (Python 3.9+)
26
+ - Implement proper logging
27
+ - Add input validation
28
+ - Include unit tests
29
+ - Use dependency injection where appropriate
30
+ - Implement proper configuration management
31
+
32
+ 3. Security:
33
+ - Sanitize all inputs
34
+ - Implement proper authentication/authorization
35
+ - Use secure coding practices
36
+ - Handle sensitive data properly
37
+
38
+ 4. Performance:
39
+ - Optimize database queries
40
+ - Implement caching where appropriate
41
+ - Use async/await for I/O operations
42
+ - Implement proper resource management
43
+
44
+ 5. Documentation:
45
+ - Include detailed module docstrings
46
+ - Document all public methods
47
+ - Include usage examples
48
+ - Document configuration options
49
+
50
+ The code should be:
51
+ - Production-ready
52
+ - Well-tested
53
+ - Scalable
54
+ - Maintainable
55
+ - Secure
56
+ - Performant
57
+
58
+ Provide the complete implementation with all necessary files and dependencies.
59
+ """)
60
+
61
+ async def generate_code(self, design: str) -> Dict[str, Any]:
62
+ """Generate code from design specifications"""
63
+ result = await self.process({"input": design})
64
+
65
+ # Store the code in the database
66
+ db.store_artifact(
67
+ "code",
68
+ result,
69
+ {
70
+ "type": "code",
71
+ "source": "developer",
72
+ "status": "created",
73
+ "version": "1.0.0"
74
+ }
75
+ )
76
+
77
+ return {
78
+ "status": "success",
79
+ "code": result,
80
+ "message": "Code generated successfully",
81
+ "metadata": {
82
+ "language": "Python",
83
+ "framework": "Standard Library",
84
+ "dependencies": self._extract_dependencies(result)
85
+ }
86
+ }
87
+
88
+ def _extract_dependencies(self, code: str) -> list:
89
+ """Extract dependencies from the generated code"""
90
+ dependencies = set()
91
+ # Add common dependencies
92
+ dependencies.update([
93
+ "python-dotenv",
94
+ "pydantic",
95
+ "fastapi",
96
+ "uvicorn",
97
+ "pytest",
98
+ "pytest-asyncio"
99
+ ])
100
+
101
+ # Add dependencies based on code content
102
+ if "import sqlalchemy" in code:
103
+ dependencies.add("sqlalchemy")
104
+ if "import aiohttp" in code:
105
+ dependencies.add("aiohttp")
106
+ if "import redis" in code:
107
+ dependencies.add("redis")
108
+ if "import jwt" in code:
109
+ dependencies.add("PyJWT")
110
+
111
+ return sorted(list(dependencies))
agents/project_manager.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from core.base_agent import BaseAgent
2
+ from core.database import db
3
+ from core.workflow import DevelopmentWorkflow
4
+ from typing import Dict, Any
5
+
6
+ class ProjectManagerAgent(BaseAgent):
7
+ def __init__(self):
8
+ super().__init__("Project Manager")
9
+ self.workflow = DevelopmentWorkflow()
10
+
11
+ self.create_chain("""
12
+ You are a Project Manager. Your task is to oversee the development process and provide status updates.
13
+
14
+ Current Status:
15
+ {input}
16
+
17
+ Please provide a comprehensive status report including:
18
+ 1. Project progress
19
+ 2. Any blockers or issues
20
+ 3. Next steps
21
+ 4. Quality metrics
22
+ 5. Recommendations
23
+
24
+ Please provide clear, actionable insights.
25
+ """)
26
+
27
+ async def start_project(self, requirements: str) -> Dict[str, Any]:
28
+ """Start a new project with the given requirements"""
29
+ # Run the complete workflow
30
+ result = await self.workflow.run(requirements)
31
+
32
+ # Store all artifacts in the database
33
+ self._store_artifacts(result)
34
+
35
+ return {
36
+ "status": "success",
37
+ "user_stories": result["user_stories"],
38
+ "design": result["design"],
39
+ "code": result["code"],
40
+ "test_results": result["test_results"],
41
+ "messages": result["messages"],
42
+ "message": "Project completed successfully"
43
+ }
44
+
45
+ def _store_artifacts(self, result: Dict[str, Any]):
46
+ """Store all project artifacts in the database"""
47
+ # Store user stories
48
+ db.store_artifact(
49
+ "user_stories",
50
+ result["user_stories"],
51
+ {
52
+ "type": "user_story",
53
+ "source": "business_analyst",
54
+ "status": "created"
55
+ }
56
+ )
57
+
58
+ # Store design
59
+ db.store_artifact(
60
+ "designs",
61
+ result["design"],
62
+ {
63
+ "type": "design",
64
+ "source": "designer",
65
+ "status": "created"
66
+ }
67
+ )
68
+
69
+ # Store code
70
+ db.store_artifact(
71
+ "code",
72
+ result["code"],
73
+ {
74
+ "type": "code",
75
+ "source": "developer",
76
+ "status": "created",
77
+ "version": "1.0.0"
78
+ }
79
+ )
80
+
81
+ # Store test results
82
+ db.store_artifact(
83
+ "test_results",
84
+ result["test_results"],
85
+ {
86
+ "type": "test_result",
87
+ "source": "tester",
88
+ "status": "executed"
89
+ }
90
+ )
91
+
92
+ async def get_status(self) -> Dict[str, Any]:
93
+ """Get the current project status"""
94
+ # Query all artifacts from the database
95
+ user_stories = db.query_artifacts("user_stories", "status:created")
96
+ designs = db.query_artifacts("designs", "status:created")
97
+ code = db.query_artifacts("code", "status:created")
98
+ test_results = db.query_artifacts("test_results", "status:executed")
99
+
100
+ status = {
101
+ "user_stories": len(user_stories["ids"]),
102
+ "designs": len(designs["ids"]),
103
+ "code": len(code["ids"]),
104
+ "test_results": len(test_results["ids"])
105
+ }
106
+
107
+ return {
108
+ "status": "success",
109
+ "data": status,
110
+ "message": "Status retrieved successfully"
111
+ }
112
+
113
+ async def check_quality(self) -> Dict[str, Any]:
114
+ """Check the quality of project artifacts"""
115
+ result = await self.process({
116
+ "input": "Checking quality of all project artifacts"
117
+ })
118
+
119
+ return {
120
+ "status": "success",
121
+ "quality_report": result,
122
+ "message": "Quality check completed successfully"
123
+ }
agents/tester.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from core.base_agent import BaseAgent
2
+ from core.database import db
3
+ from typing import Dict, Any
4
+
5
+ class TesterAgent(BaseAgent):
6
+ def __init__(self):
7
+ super().__init__("Tester")
8
+ self.create_chain("""
9
+ You are a Software Tester. Your task is to create comprehensive test cases and execute them on the given code.
10
+
11
+ Code to Test:
12
+ {input}
13
+
14
+ Create test cases that:
15
+ 1. Cover all user stories and acceptance criteria
16
+ 2. Include unit tests, integration tests, and system tests
17
+ 3. Test edge cases and error conditions
18
+ 4. Follow testing best practices
19
+ 5. Include test data and expected results
20
+
21
+ Please provide detailed test cases with clear steps and expected outcomes.
22
+ """)
23
+
24
+ async def create_test_cases(self, code: str) -> Dict[str, Any]:
25
+ """Create test cases for the given code"""
26
+ result = await self.process({"input": code})
27
+
28
+ # Store the test cases in the database
29
+ db.store_artifact(
30
+ "test_cases",
31
+ result,
32
+ {
33
+ "type": "test_case",
34
+ "source": "tester",
35
+ "status": "created"
36
+ }
37
+ )
38
+
39
+ return {
40
+ "status": "success",
41
+ "test_cases": result,
42
+ "message": "Test cases created successfully"
43
+ }
44
+
45
+ async def execute_tests(self, code: str, test_cases: str) -> Dict[str, Any]:
46
+ """Execute test cases on the given code"""
47
+ result = await self.process({
48
+ "input": f"Code:\n{code}\n\nTest Cases:\n{test_cases}"
49
+ })
50
+
51
+ # Store the test results in the database
52
+ db.store_artifact(
53
+ "test_results",
54
+ result,
55
+ {
56
+ "type": "test_result",
57
+ "source": "tester",
58
+ "status": "executed"
59
+ }
60
+ )
61
+
62
+ return {
63
+ "status": "success",
64
+ "test_results": result,
65
+ "message": "Tests executed successfully"
66
+ }
api/__pycache__/main.cpython-310.pyc ADDED
Binary file (1.68 kB). View file
 
app.py ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import asyncio
3
+ from agents.project_manager import ProjectManagerAgent
4
+ import json
5
+ from typing import Dict, Any
6
+
7
+ # Initialize the project manager
8
+ project_manager = ProjectManagerAgent()
9
+
10
+ # Set page config
11
+ st.set_page_config(
12
+ page_title="AI Development Pod",
13
+ page_icon="🤖",
14
+ layout="wide"
15
+ )
16
+
17
+ # Custom CSS
18
+ st.markdown("""
19
+ <style>
20
+ .main {
21
+ padding: 2rem;
22
+ }
23
+ .stButton>button {
24
+ width: 100%;
25
+ }
26
+ .stTextArea>div>div>textarea {
27
+ height: 200px;
28
+ }
29
+ .progress-bar {
30
+ height: 10px;
31
+ background-color: #f0f0f0;
32
+ border-radius: 5px;
33
+ margin: 10px 0;
34
+ }
35
+ .progress-bar-fill {
36
+ height: 100%;
37
+ background-color: #4CAF50;
38
+ border-radius: 5px;
39
+ transition: width 0.3s ease-in-out;
40
+ }
41
+ </style>
42
+ """, unsafe_allow_html=True)
43
+
44
+ # Title and description
45
+ st.title("🤖 AI Development Pod")
46
+ st.markdown("""
47
+ This is an AI-powered virtual development team that can handle your software project from requirements to testing.
48
+ Simply enter your project requirements and let the AI team do the rest!
49
+ """)
50
+
51
+ # Sidebar for navigation
52
+ st.sidebar.title("Navigation")
53
+ page = st.sidebar.radio("Go to", ["Start Project", "Project Status", "Quality Check"])
54
+
55
+ def display_progress(messages: list):
56
+ """Display progress based on workflow messages"""
57
+ steps = {
58
+ "User stories created successfully": 20,
59
+ "Design created successfully": 40,
60
+ "Code generated successfully": 60,
61
+ "Test cases created successfully": 80,
62
+ "Tests executed successfully": 100
63
+ }
64
+
65
+ current_progress = 0
66
+ for message in messages:
67
+ if message in steps:
68
+ current_progress = max(current_progress, steps[message])
69
+
70
+ st.markdown(f"""
71
+ <div class="progress-bar">
72
+ <div class="progress-bar-fill" style="width: {current_progress}%"></div>
73
+ </div>
74
+ <p style="text-align: center;">{current_progress}% Complete</p>
75
+ """, unsafe_allow_html=True)
76
+
77
+ for message in messages:
78
+ st.info(message)
79
+
80
+ async def run_project(requirements: str) -> Dict[str, Any]:
81
+ """Run the project workflow"""
82
+ return await project_manager.start_project(requirements)
83
+
84
+ async def get_project_status() -> Dict[str, Any]:
85
+ """Get the project status"""
86
+ return await project_manager.get_status()
87
+
88
+ async def run_quality_check() -> Dict[str, Any]:
89
+ """Run the quality check"""
90
+ return await project_manager.check_quality()
91
+
92
+ if page == "Start Project":
93
+ st.header("Start New Project")
94
+
95
+ # Project requirements input
96
+ requirements = st.text_area(
97
+ "Enter your project requirements:",
98
+ placeholder="Describe your project requirements in detail...",
99
+ height=200
100
+ )
101
+
102
+ if st.button("Start Project"):
103
+ if requirements:
104
+ with st.spinner("Processing your project..."):
105
+ # Run the async function
106
+ result = asyncio.run(run_project(requirements))
107
+
108
+ # Display progress
109
+ display_progress(result["messages"])
110
+
111
+ # Display results in tabs
112
+ tab1, tab2, tab3, tab4 = st.tabs(["User Stories", "Design", "Code", "Test Results"])
113
+
114
+ with tab1:
115
+ st.subheader("User Stories")
116
+ st.markdown(result["user_stories"])
117
+
118
+ with tab2:
119
+ st.subheader("Design")
120
+ st.markdown(result["design"])
121
+
122
+ with tab3:
123
+ st.subheader("Generated Code")
124
+ st.code(result["code"], language="python")
125
+
126
+ with tab4:
127
+ st.subheader("Test Results")
128
+ st.markdown(result["test_results"])
129
+ else:
130
+ st.error("Please enter project requirements")
131
+
132
+ elif page == "Project Status":
133
+ st.header("Project Status")
134
+
135
+ if st.button("Check Status"):
136
+ with st.spinner("Getting project status..."):
137
+ status = asyncio.run(get_project_status())
138
+
139
+ # Display status metrics
140
+ col1, col2, col3, col4 = st.columns(4)
141
+
142
+ with col1:
143
+ st.metric("User Stories", status["data"]["user_stories"])
144
+ with col2:
145
+ st.metric("Designs", status["data"]["designs"])
146
+ with col3:
147
+ st.metric("Code Files", status["data"]["code"])
148
+ with col4:
149
+ st.metric("Test Results", status["data"]["test_results"])
150
+
151
+ elif page == "Quality Check":
152
+ st.header("Quality Check")
153
+
154
+ if st.button("Run Quality Check"):
155
+ with st.spinner("Running quality check..."):
156
+ quality_report = asyncio.run(run_quality_check())
157
+
158
+ st.subheader("Quality Report")
159
+ st.markdown(quality_report["quality_report"])
160
+
161
+ # Footer
162
+ st.markdown("---")
163
+ st.markdown("""
164
+ <div style='text-align: center'>
165
+ <p>AI Development Pod - Powered by Groq's Gemma2-9b-it and LangGraph</p>
166
+ </div>
167
+ """, unsafe_allow_html=True)
chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/data_level0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3c9fd302f000d7790aa403c2d0d8fec363fe46f30b07d53020b6e33b22435a9
3
+ size 1676000
chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/header.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e87a1dc8bcae6f2c4bea6d5dd5005454d4dace8637dae29bff3c037ea771411e
3
+ size 100
chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/length.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4cb4487c8b29fba854f190c7fe6da23fa1e74b4ade72cc4edc0f50931f7546d
3
+ size 4000
chroma_db/0895c0fd-aea2-4db2-9ea7-55fff1798415/link_lists.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
3
+ size 0
chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/data_level0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3c9fd302f000d7790aa403c2d0d8fec363fe46f30b07d53020b6e33b22435a9
3
+ size 1676000
chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/header.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e87a1dc8bcae6f2c4bea6d5dd5005454d4dace8637dae29bff3c037ea771411e
3
+ size 100
chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/length.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd26114ea9753cf02818a8559035f448f1b7d6e870df1c0b97dd8f5c581bf257
3
+ size 4000
chroma_db/14bf569c-0412-405e-93d7-9bb5e922d766/link_lists.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
3
+ size 0
chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/data_level0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3c9fd302f000d7790aa403c2d0d8fec363fe46f30b07d53020b6e33b22435a9
3
+ size 1676000
chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/header.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e87a1dc8bcae6f2c4bea6d5dd5005454d4dace8637dae29bff3c037ea771411e
3
+ size 100
chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/length.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:878e6177914de3e3fd7925224261038d5a86e96dc2817f6d8ed34cd83689f10d
3
+ size 4000
chroma_db/7bd06384-5d74-44db-8b6f-08b881d638bb/link_lists.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
3
+ size 0
chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/data_level0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3c9fd302f000d7790aa403c2d0d8fec363fe46f30b07d53020b6e33b22435a9
3
+ size 1676000
chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/header.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e87a1dc8bcae6f2c4bea6d5dd5005454d4dace8637dae29bff3c037ea771411e
3
+ size 100
chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/length.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:567950437c4b5b2624a5fb159906502a2b9aa447df1c3c6e1bd463598357e8a7
3
+ size 4000
chroma_db/a2f05e8f-89be-4d76-83a9-7a93d98352c3/link_lists.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
3
+ size 0
chroma_db/chroma.sqlite3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d98f1b70da83a844595edd12a2507de8317102f51c1cd1c4d01973400541e3bd
3
+ size 1392640
chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/data_level0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3c9fd302f000d7790aa403c2d0d8fec363fe46f30b07d53020b6e33b22435a9
3
+ size 1676000
chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/header.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e87a1dc8bcae6f2c4bea6d5dd5005454d4dace8637dae29bff3c037ea771411e
3
+ size 100
chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/length.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28450d02a331772fa69d8d176b5fb136b8265ffb74c7b5aefe4235e94f155317
3
+ size 4000
chroma_db/d08fb65a-aa5f-4895-9fa1-1c9781b3421e/link_lists.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
3
+ size 0
core/__pycache__/base_agent.cpython-310.pyc ADDED
Binary file (1.71 kB). View file
 
core/__pycache__/config.cpython-310.pyc ADDED
Binary file (903 Bytes). View file
 
core/__pycache__/database.cpython-310.pyc ADDED
Binary file (1.6 kB). View file
 
core/__pycache__/workflow.cpython-310.pyc ADDED
Binary file (4.05 kB). View file
 
core/base_agent.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, Any, List
2
+ from langchain_groq import ChatGroq
3
+ from langchain.prompts import ChatPromptTemplate
4
+ from langchain.schema import StrOutputParser
5
+ from langchain.schema.runnable import RunnablePassthrough
6
+ from core.config import settings
7
+
8
+ class BaseAgent:
9
+ def __init__(self, role: str):
10
+ self.role = role
11
+ self.llm = ChatGroq(
12
+ api_key=settings.GROQ_API_KEY,
13
+ model_name=settings.MODEL_NAME,
14
+ temperature=settings.TEMPERATURE
15
+ )
16
+ self.chain = None
17
+
18
+ def create_chain(self, template: str):
19
+ """Create a LangChain chain with the given template"""
20
+ prompt = ChatPromptTemplate.from_template(template)
21
+ self.chain = (
22
+ {"input": RunnablePassthrough()}
23
+ | prompt
24
+ | self.llm
25
+ | StrOutputParser()
26
+ )
27
+
28
+ async def process(self, input_data: Dict[str, Any]) -> str:
29
+ """Process input data and return the result"""
30
+ if not self.chain:
31
+ raise ValueError("Chain not initialized. Call create_chain first.")
32
+ return await self.chain.ainvoke(input_data)
33
+
34
+ def get_role(self) -> str:
35
+ """Get the agent's role"""
36
+ return self.role
core/config.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pydantic_settings import BaseSettings
2
+ from typing import Optional
3
+ import os
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+
8
+ class Settings(BaseSettings):
9
+ GROQ_API_KEY: str = os.getenv("GROQ_API_KEY", "")
10
+ CHROMA_DB_PATH: str = "chroma_db"
11
+ MODEL_NAME: str = "gemma2-9b-it"
12
+ TEMPERATURE: float = 0.7
13
+ MAX_TOKENS: int = 2048
14
+
15
+ class Config:
16
+ env_file = ".env"
17
+
18
+ settings = Settings()
core/database.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import chromadb
2
+ from chromadb.config import Settings
3
+ from core.config import settings
4
+ import os
5
+
6
+ class Database:
7
+ def __init__(self):
8
+ self.client = chromadb.PersistentClient(
9
+ path=settings.CHROMA_DB_PATH,
10
+ settings=Settings(allow_reset=True)
11
+ )
12
+
13
+ def get_collection(self, name: str):
14
+ """Get or create a collection"""
15
+ try:
16
+ return self.client.get_collection(name)
17
+ except:
18
+ return self.client.create_collection(name)
19
+
20
+ def store_artifact(self, collection_name: str, document: str, metadata: dict):
21
+ """Store a project artifact in the database"""
22
+ collection = self.get_collection(collection_name)
23
+ collection.add(
24
+ documents=[document],
25
+ metadatas=[metadata],
26
+ ids=[f"doc_{len(collection.get()['ids'])}"]
27
+ )
28
+
29
+ def query_artifacts(self, collection_name: str, query: str, n_results: int = 5):
30
+ """Query artifacts in a collection"""
31
+ collection = self.get_collection(collection_name)
32
+ results = collection.query(
33
+ query_texts=[query],
34
+ n_results=n_results
35
+ )
36
+ return results
37
+
38
+ db = Database()
core/workflow.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, Any, TypedDict, Annotated, Sequence
2
+ from langgraph.graph import Graph, StateGraph
3
+ from langgraph.prebuilt import ToolExecutor
4
+ from agents.business_analyst import BusinessAnalystAgent
5
+ from agents.designer import DesignerAgent
6
+ from agents.developer import DeveloperAgent
7
+ from agents.tester import TesterAgent
8
+ from core.database import db
9
+
10
+ class AgentState(TypedDict):
11
+ """State for the agent workflow"""
12
+ requirements: str
13
+ user_stories: str
14
+ design: str
15
+ code: str
16
+ test_cases: str
17
+ test_results: str
18
+ current_step: str
19
+ status: str
20
+ messages: Sequence[str]
21
+
22
+ class DevelopmentWorkflow:
23
+ def __init__(self):
24
+ self.business_analyst = BusinessAnalystAgent()
25
+ self.designer = DesignerAgent()
26
+ self.developer = DeveloperAgent()
27
+ self.tester = TesterAgent()
28
+
29
+ # Define the workflow
30
+ self.workflow = self._create_workflow()
31
+
32
+ def _create_workflow(self) -> Graph:
33
+ """Create the LangGraph workflow"""
34
+ workflow = StateGraph(AgentState)
35
+
36
+ # Add nodes for each step
37
+ workflow.add_node("create_user_stories", self._create_user_stories)
38
+ workflow.add_node("create_design", self._create_design)
39
+ workflow.add_node("generate_code", self._generate_code)
40
+ workflow.add_node("create_tests", self._create_tests)
41
+ workflow.add_node("execute_tests", self._execute_tests)
42
+
43
+ # Define the edges
44
+ workflow.add_edge("create_user_stories", "create_design")
45
+ workflow.add_edge("create_design", "generate_code")
46
+ workflow.add_edge("generate_code", "create_tests")
47
+ workflow.add_edge("create_tests", "execute_tests")
48
+
49
+ # Set entry point
50
+ workflow.set_entry_point("create_user_stories")
51
+
52
+ # Set exit point
53
+ workflow.set_finish_point("execute_tests")
54
+
55
+ return workflow.compile()
56
+
57
+ async def _create_user_stories(self, state: AgentState) -> AgentState:
58
+ """Create user stories from requirements"""
59
+ result = await self.business_analyst.create_user_stories(state["requirements"])
60
+ return {
61
+ **state,
62
+ "user_stories": result["user_stories"],
63
+ "current_step": "create_user_stories",
64
+ "status": "in_progress",
65
+ "messages": [*state["messages"], "User stories created successfully"]
66
+ }
67
+
68
+ async def _create_design(self, state: AgentState) -> AgentState:
69
+ """Create design from user stories"""
70
+ result = await self.designer.create_design(state["user_stories"])
71
+ return {
72
+ **state,
73
+ "design": result["design"],
74
+ "current_step": "create_design",
75
+ "status": "in_progress",
76
+ "messages": [*state["messages"], "Design created successfully"]
77
+ }
78
+
79
+ async def _generate_code(self, state: AgentState) -> AgentState:
80
+ """Generate code from design"""
81
+ result = await self.developer.generate_code(state["design"])
82
+ return {
83
+ **state,
84
+ "code": result["code"],
85
+ "current_step": "generate_code",
86
+ "status": "in_progress",
87
+ "messages": [*state["messages"], "Code generated successfully"]
88
+ }
89
+
90
+ async def _create_tests(self, state: AgentState) -> AgentState:
91
+ """Create test cases from code"""
92
+ result = await self.tester.create_test_cases(state["code"])
93
+ return {
94
+ **state,
95
+ "test_cases": result["test_cases"],
96
+ "current_step": "create_tests",
97
+ "status": "in_progress",
98
+ "messages": [*state["messages"], "Test cases created successfully"]
99
+ }
100
+
101
+ async def _execute_tests(self, state: AgentState) -> AgentState:
102
+ """Execute tests on the code"""
103
+ result = await self.tester.execute_tests(state["code"], state["test_cases"])
104
+ return {
105
+ **state,
106
+ "test_results": result["test_results"],
107
+ "current_step": "execute_tests",
108
+ "status": "completed",
109
+ "messages": [*state["messages"], "Tests executed successfully"]
110
+ }
111
+
112
+ async def run(self, requirements: str) -> Dict[str, Any]:
113
+ """Run the complete workflow"""
114
+ initial_state = AgentState(
115
+ requirements=requirements,
116
+ user_stories="",
117
+ design="",
118
+ code="",
119
+ test_cases="",
120
+ test_results="",
121
+ current_step="start",
122
+ status="initialized",
123
+ messages=[]
124
+ )
125
+
126
+ final_state = await self.workflow.ainvoke(initial_state)
127
+
128
+ return {
129
+ "status": "success",
130
+ "user_stories": final_state["user_stories"],
131
+ "design": final_state["design"],
132
+ "code": final_state["code"],
133
+ "test_results": final_state["test_results"],
134
+ "messages": final_state["messages"]
135
+ }