agents icon indicating copy to clipboard operation
agents copied to clipboard

Modular code generation

Open 4Rom1 opened this issue 1 month ago • 2 comments

ModularCodeGen Crew

Welcome to the ModularCodeGen Crew project, powered by crewAI.

🧠 CrewAI – Modular Engineering Team (Agentic Version)

This project is an agentic and modular transformation of the original engineering_team project.
Unlike the original monolithic implementation, this version introduces fully separated backend modules, each with its own unit tests and automated frontend integration, built using an orchestrated multi-agent workflow defined in tasks.yaml.


🚀 Overview

The CrewAI system automates the design, coding, testing, and integration of a Python backend and frontend architecture using specialized AI agents.
All modules and their test files are stored under account_directory/.
After running all tasks, the generated structure looks like:

account_directory/ ├── module_a.py ├── test_module_a.py ├── module_b.py ├── test_module_b.py ├── ... ├── accounts.py # main frontend API ├── test_accounts.py # frontend headless test └── README.md

The main API can be launched with:

$ uv run python accounts.py

⚙️ Architecture Summary

This system decomposes the engineering workflow into five coordinated tasks, each handled by a specific agent role.
All task definitions are provided in tasks.yaml.


🧩 1. design_task

  • Agent: engineering_lead
  • Goal: Analyze given requirements and design a modular backend.
  • Output:
    • List of module names (module_names)
    • Specification of classes, methods, and interactions (module_specs)
    • JSON schema describing the architecture
  • Key Point: Each module must have a unique name.

💻 2. code_task

  • Agent: backend_engineer
  • Goal: Implement Python code for each designed module.
  • Output:
    • Source files (module_sources)
    • Corresponding test files (module_tests)
  • Test Framework: unittest
  • Constraint:
    • Outputs must be pure Python code (no markdown formatting).
    • The number and names of modules must match the design_task exactly.
    • Tests run in a dedicated environment.

🗂️ 3. writer_task_back

  • Agent: file_writer
  • Goal: Persist all generated backend modules and tests to disk.
  • Output Directory: account_directory/
  • Output Files:
    • {module_name}.py
    • test_{module_name}.py
  • Also Generates:
    • A README.md describing each module and its functionality.
  • Result: All backend code is saved under account_directory/ and ready for import.

🌐 4. frontend_task

  • Agent: frontend_engineer
  • Goal: Build a lightweight Python API using gradio to expose endpoints for all backend modules.
  • Outputs:
    • fronted_source – the frontend API source code.
    • fronted_test – test verifying headless initialization of the API tool.
  • Behavior:
    • The frontend automatically imports all backend modules.
    • It runs in headless mode to confirm proper initialization.

💾 5. writer_task_front

  • Agent: file_writer
  • Goal: Persist frontend code and test files.
  • Output Directory: account_directory/
  • Files Written:
    • accounts.py
    • test_accounts.py
  • Note:
    Before generating the frontend, the backend modules are copied into the same directory so the frontend can import and test them in headless mode.

4Rom1 avatar Nov 13 '25 15:11 4Rom1

Hey - I really appreciate this, but with 23 files and 4.4k lines of code, this is on the large side for the repo.. Please could you either:

  • Cut back the number of README (+emojis!) and test files - focus on the example to be shared
  • Alternatively, replace this with a single md that describes your project and links to the implementation in your repo I hope that makes sense.. please see Q3 here for more: https://edwarddonner.com/pr

ed-donner avatar Nov 23 '25 04:11 ed-donner

Hey - I really appreciate this, but with 23 files and 4.4k lines of code, this is on the large side for the repo.. Please could you either:

  • Cut back the number of README (+emojis!) and test files - focus on the example to be shared
  • Alternatively, replace this with a single md that describes your project and links to the implementation in your repo I hope that makes sense.. please see Q3 here for more: https://edwarddonner.com/pr

Thanks for your feedbacks! I have removed the test files, one of the README, the emojis on the remaining README. Let me know if I missed something.

rgarnier-r7 avatar Nov 23 '25 09:11 rgarnier-r7