https://github.com/manraj29/firstresponder
https://github.com/manraj29/firstresponder
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/manraj29/firstresponder
- Owner: Manraj29
- Created: 2025-09-21T07:37:34.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-09-21T07:57:36.000Z (4 months ago)
- Last Synced: 2025-09-21T09:26:43.984Z (4 months ago)
- Language: Python
- Size: 275 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# First Incident Responder - AI-Powered Emergency Response
[](https://www.python.org/downloads/)
[](https://crewai.com)
[](https://streamlit.io)
First Incident Responder is a comprehensive AI-powered platform that uses emergency incident response systems. Built using CrewAI's multi-agent framework, this system demonstrates the power of collaborative AI agents working together to solve complex, real-world problems.
## 🌟 Key Features
### 🚨 Emergency Response System
- **Multi-Category Incident Handling**: Fire, Medical, Police, and Accident response crews
- **Intelligent Classification**: Automatic incident categorization and severity assessment using Google's Gemini AI
- **Real-time Communication**: Automated email notifications to relevant authorities
- **Interactive Web Interface**: Streamlit-based UI with real-time chat assistance
- **Geographic Integration**: Browser-based location services for precise incident reporting
- **Comprehensive Logging**: CSV-based incident tracking and reporting
## 🏗️ Architecture
The system is built around specialized AI agent crews:
### Emergency Response Crews
- **FireCrew**: Specialized fire incident response and safety guidance
- **MedicalCrew**: Medical emergency handling and first-aid coordination
- **PoliceCrew**: Law enforcement incident management
- **AccidentCrew**: Traffic and general accident response
## 🚀 Installation
### Prerequisites
- Python 3.10 or higher
- Google API credentials (for Gmail and Gemini AI integration)
- UV package manager (recommended) or pip
### Setup Instructions
1. **Clone the repository**
```bash
git clone
cd mentormindflows
```
2. **Install UV package manager** (if not already installed)
```bash
pip install uv
```
3. **Install dependencies**
```bash
uv sync
# OR using pip
pip install -r requirements.txt
```
4. **Environment Configuration**
Create a `.env` file in the root directory:
```bash
# AI Model API Keys
GEMINI_KEY=your_google_gemini_api_key
GOOGLE_API_KEY=your_google_api_key
OPENAI_API_KEY=your_openai_api_key # Optional
# Gmail Integration (for automated notifications)
GMAIL_CREDENTIALS_PATH=src/mentormindflows/crews/gmailcrew/tools/credentials.json
# Optional: Default incident response settings
FIRE_USERNAME=System_Admin
FIRE_LOCATION=Default_Location
FIRE_SEVERITY=medium
```
5. **Gmail API Setup** (for email notifications)
- Go to [Google Cloud Console](https://console.cloud.google.com/)
- Create a new project or select an existing one
- Enable the Gmail API
- Create OAuth 2.0 credentials
- Download the credentials file as `credentials.json`
- Place it in `src/mentormindflows/crews/gmailcrew/tools/`
## 🎯 Usage
### Emergency Response Web Application
Launch the Streamlit web interface:
```bash
streamlit run app.py
```
Features:
- **Incident Reporting**: Fill out incident details with optional image upload
- **Automatic Classification**: AI determines incident type and severity
- **Real-time Chat**: Get immediate guidance while authorities are contacted
- **Report Generation**: Comprehensive incident reports
- **Download Reports**: Export reports in Markdown format
#### Command Line Interface
```bash
# Run the complete mentoring flow
crewai run
```
## 📁 Project Structure
```
mentormindflows/
├── app.py # Main Streamlit application
├── pyproject.toml # Project configuration
├── README.md # This file
├── outputs/ # Generated reports and logs
├── src/mentormindflows/
│ ├── main.py # Core flow orchestration
│ ├── crews/ # AI agent crews
│ │ ├── main_crew/ # Emergency crews
│ │ │ ├── fire_crew.py # Fire incident response
│ │ │ ├── medical_crew.py # Medical emergency handling
│ │ │ ├── police_crew.py # Police incident management
│ │ │ ├── accident_crew.py # Accident response
│ │ └── gmailcrew/ # Email communication crew
│ ├── tools/ # Custom tools and utilities
│ │ ├── csv_logger_tool.py # Incident logging
│ │ ├── writeFile_tool.py # File operations
│ │ └── custom_tool.py #
│ └── outputs/ # System-generated outputs
└── tests/ # Test files and sample data
```
## 🛠️ Configuration
### Agent Configuration
Agents are configured via YAML files in `src/mentormindflows/crews/main_crew/config/`:
- `*_agents.yaml`: Define agent roles, goals, and backstories
- `*_tasks.yaml`: Specify tasks, descriptions, and expected outputs
### LLM Models
The system supports multiple AI models:
- **Google Gemini 2.0 Flash** (Primary for emergency response)
### Customization Options
- **Modify Agent Behavior**: Edit YAML configuration files
- **Add New Incident Types**: Create new crew classes and configurations
- **Custom Tools**: Implement additional CrewAI tools in the `tools/` directory
## 📊 Output Formats
### Emergency Response
- **Incident Reports**: Comprehensive Markdown reports with incident details
- **CSV Logs**: Structured data for analysis and record-keeping
- **Email Notifications**: HTML-formatted alerts to authorities
## 🔧 Development
### Adding New Crews
1. Create a new crew class inheriting from `CrewBase`
2. Define agents and tasks in corresponding YAML files
3. Implement custom tools if needed
4. Register the crew in the main flow orchestration
## 📋 Requirements
### Core Dependencies
- `crewai[tools]>=0.114.0,<1.0.0` - Multi-agent AI framework
- `streamlit>=1.36` - Web interface
- `google-api-python-client>=2.137.0` - Gmail integration
- `google-generativeai>=0.7.0` - Gemini AI integration
- `python-dotenv>=1.0.1` - Environment management
### Optional Dependencies
- `streamlit-markmap>=0.1.7` - Mind map visualization
- `streamlit-js-eval>=0.1.7` - JavaScript integration
- `markdown>=3.5` - Markdown processing
## 🔒 Security Considerations
- **API Keys**: Store securely in environment variables, never commit to version control
- **Gmail Credentials**: Use OAuth 2.0 flow, regularly rotate credentials
- **Input Validation**: All user inputs are validated before processing
## Acknowledgments
- **Google**: For Gemini AI and Gmail API integration
- **Streamlit**: For the intuitive web application framework
### Upcoming Features
- [ ] Advanced analytics and reporting
- [ ] Mobile application support
- [ ] Integration with more AI models
- [ ] Enhanced visualization capabilities
- [ ] Advanced security features