How aakriti1318/crew-agent-generator works
Project Type & Purpose
• Type: Full‐stack (lightweight) web application, built with Streamlit as both frontend and backend.
• Purpose: Accept user prompts in natural language, call OpenAI’s GPT API to generate a structured “CrewAI” configuration (agents + tasks), and display ready‐to‐use Python code.
File Structure
• app.py (entry point for Streamlit UI & controller logic)
• multi‐agent‐generator.py / multi‐agent‐generator‐adv.py (service modules implementing prompt engineering & response parsing)
• requirements.txt (.env for API key via python‐dotenv)
• crew_generator.mp4 (demo asset, not part of runtime)
a. Streamlit UI Layer
• Browser Client (user’s web browser)
• Streamlit Server (app.py)
b. Business Logic Layer
• Prompt Handler (in app.py)
• Generation Modules (multi‐agent‐generator.py & adv)
c. External Service
• OpenAI GPT‐4o‐mini API
d. Local Configuration
• .env storage (OPENAI_API_KEY)
Relationships & Data Flows
1. User enters prompt in Browser → hits “Generate Crew.”
2. Streamlit Server (app.py) receives request → passes prompt to Generation Modules.
3. Generation Modules format prompt → call OpenAI API via openai-python client (using API key from .env).
4. OpenAI returns JSON response (agents + tasks).
5. Modules parse response → return structured code snippets to Streamlit Server.
6. Streamlit renders generated code back in the Browser UI.
Architectural Patterns & Design Principles
• Three‐Tier Pattern: Presentation (Streamlit), Application Logic (Generation Modules), External Service (OpenAI API).
• Single Page App: Server & frontend coupled via Streamlit’s rerun model.
• Environment Configuration: 12‐factor “config in environment” via python‐dotenv.
• Clear component names: Browser (User UI), Streamlit App (app.py), Generation Service (multi-agent modules), OpenAI API, Config Store (.env)