This project integrates CrewAI with a Flask backend and React frontend to process goals and descriptions through AI agents.
project/
├── backend/ # Python Flask server
│ ├── .env # Environment variables
│ ├── app.py # Flask application
| └── requirement.txt
├── frontend/ # React application
└── README.md # This fileThe Flask backend provides an API endpoint that processes goals and descriptions using CrewAI.
- Create a
.envfile in the./backenddirectory with:
GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
FLASK_APP=app.py
FLASK_ENV=development-
Replace
YOUR_GOOGLE_API_KEYwith your actual key from Google AI Studio. -
Set up and activate a virtual environment:
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate- Install dependencies:
pip install crewai google-generativeai python-dotenv flask flask-cors pyttsx3 SpeechRecognition opencv-python deepface Note: pip currently supports Python 3.12 or lower. total dependency download should be 1gb, tensorflow alone from deepface is like 400mb
(you should already be in the backend directory with your environment activated)
python app.pyThe API will be available at http://localhost:5001.
(the backend server should be set up and running before running the front end)
The React frontend provides a form to submit goals and descriptions to the backend.
- Form for "Goal" and "Description" inputs
- API call to Flask backend on submit
- Loading state during processing
- Result display from backend
- Navigate to the frontend directory
- Install dependencies:
npm install- Start the development server:
npm startThe app will be available at http://localhost:3000.
POST /process
- Accepts JSON payload:
{ "message": "Your input from the front end", } - Returns JSON response with the processed result
- Ensure CORS is properly configured if frontend and backend run on different ports
- The backend uses python-dotenv for secure management of the GOOGLE_API_KEY
- Error handling should be implemented for both frontend and backend