An AI-powered email prioritization system with intelligent multi-agent learning, knowledge graphs, and personalized email management.
Priority Pulse is a full-stack application that helps users manage their email inbox more effectively by leveraging artificial intelligence to prioritize emails based on user preferences, context, and historical patterns. The system uses a sophisticated multi-agent architecture to analyze emails, extract criteria, evaluate priority, and provide actionable insights.
- Intelligent Email Prioritization: AI-driven ranking of emails based on learned user preferences
- Multi-Agent System: Specialized agents handle different aspects of email processing:
- Gmail Agent: Email retrieval and management
- Calendar Agent: Integration with Google Calendar for context
- Docs Agent: Google Docs integration for document analysis
- Knowledge Graph Agent: Building and querying knowledge graphs
- Evaluation Agent: Prioritization and scoring
- Verification Agent: Quality assurance
- Knowledge Graph: Automatically built knowledge graph from email content for semantic understanding
- User Feedback Loop: Learns from user actions and feedback to improve prioritization over time
- Memory Management: Persistent memory system using Mem0AI for contextual awareness
- Vector Search: Chroma DB integration for semantic email search
- Google Workspace Integration: Seamless integration with Gmail, Google Calendar, and Google Docs
Priority Pulse/
βββ priorityPulseBackend/ # Python FastAPI backend
β βββ agents/ # Multi-agent system implementation
β β βββ base_agent.py # Base agent class
β β βββ gmail_agent.py # Gmail operations
β β βββ calendar_agent.py # Calendar integration
β β βββ docs_agent.py # Google Docs integration
β β βββ kg_agent.py # Knowledge graph operations
β β βββ criteria_agent.py # Email criteria extraction
β β βββ evaluation_agent.py# Email evaluation and scoring
β β βββ verifier_agent.py # Result verification
β βββ mcp_servers/ # Model Context Protocol servers
β βββ models/ # Data models (Email, UserFeedback, etc.)
β βββ storage/ # Persistent storage
β β βββ chroma_db/ # Vector database
β βββ api.py # FastAPI application
β βββ agent_system.py # Email prioritization system orchestrator
β βββ auth_setup.py # Authentication configuration
β βββ firefox_auth.py # Firebase authentication
β βββ gmail_listener.py # Gmail webhook listener
β βββ requirements.txt # Python dependencies
βββ priorityPulseFrontend/ # React + Vite frontend
β βββ src/
β β βββ pages/ # Page components
β β β βββ Dashboard.jsx
β β β βββ Evaluate.jsx
β β β βββ Feedback.jsx
β β β βββ Login.jsx
β β β βββ Memories.jsx
β β β βββ Setup.jsx
β β βββ components/ # Reusable components
β β β βββ EmailCard.jsx
β β β βββ EmailActions.jsx
β β β βββ CalendarWidget.jsx
β β β βββ KGWidget.jsx
β β β βββ Navbar.jsx
β β βββ hooks/ # Custom React hooks
β β β βββ useAuth.js
β β β βββ useDashboard.js
β β β βββ useEmailActions.js
β β β βββ useKnowledgeGraph.js
β β βββ context/ # React context (Auth)
β β βββ api/ # API client
β β βββ App.jsx # Main component
β β βββ main.jsx # Entry point
β βββ package.json # Node.js dependencies
β βββ vite.config.js # Vite configuration
βββ README.md # This file
- Python 3.10+
- Node.js 16+
- npm or yarn
- A Google Cloud project with APIs enabled (Gmail, Calendar, Docs, Pub/Sub)
- Firebase project
Enable the following APIs in your Google Cloud Console:
- Gmail API
- Google Calendar API
- Google Docs API
- Cloud Pub/Sub API
- Cloud Credentials API
-
Navigate to the backend directory:
cd priorityPulseBackend -
Create a Python virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile inpriorityPulseBackend/:JWT_SECRET=your-secret-key-here GEMINI_API_KEY=your-google-generative-ai-key FIREBASE_PROJECT_ID=your-firebase-project-id GOOGLE_OAUTH_CLIENT_ID=your-oauth-client-id GOOGLE_OAUTH_CLIENT_SECRET=your-oauth-client-secret -
Configure Google Credentials:
- Place your
service_account.jsonin thepriorityPulseBackend/directory - Place your
oAuthCredentials.jsonin thepriorityPulseBackend/directory
- Place your
-
Navigate to the frontend directory:
cd priorityPulseFrontend -
Install dependencies:
npm install
-
Configure Firebase: Update
src/firebase.jswith your Firebase project credentials -
Set up environment variables: Create a
.envfile inpriorityPulseFrontend/:VITE_GOOGLE_CLIENT_ID=your-oauth-client-id VITE_API_URL=http://localhost:8000
cd priorityPulseBackend
python -m uvicorn api:app --reload --port 8000The API will be available at http://localhost:8000
- API Documentation:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
cd priorityPulseFrontend
npm run devThe frontend will be available at http://localhost:5173
In a separate terminal:
cd priorityPulseBackend
python gmail_listener.pyThe backend uses a multi-agent system pattern with specialized agents that communicate through a central orchestrator:
- Agent System Orchestrator (
agent_system.py): Coordinates all agents and manages email processing workflow - Specialized Agents:
- Gmail Agent: Retrieves emails, manages labels, executes actions
- Evaluation Agent: Scores and prioritizes emails
- Criteria Agent: Extracts prioritization criteria from user feedback
- Knowledge Graph Agent: Builds and queries semantic graphs
- Calendar Agent: Fetches calendar events for context
- Docs Agent: Accesses Google Docs for background information
- Verification Agent: Validates agent outputs
The frontend is built with React and uses:
- Context API for state management (Authentication)
- Custom Hooks for business logic
- Axios for API communication
- React Router for navigation
- Vite for fast development and building
POST /auth/login- User authentication with Google OAuthPOST /emails/sync- Sync emails from GmailGET /emails- Get prioritized email listPOST /emails/{id}/evaluate- Get AI evaluation for an emailPOST /emails/{id}/feedback- Submit user feedbackGET /emails/{id}/context- Get email context from knowledge graphGET /dashboard/stats- Get dashboard statisticsPOST /kg/query- Query knowledge graph
- config.json: Application configuration settings
- config.py: Python configuration and constants
- firebase.json: Firebase deployment configuration
- vite.config.js: Vite build configuration
- eslint.config.js: Code linting rules
- Vector Database:
storage/chroma_db/- Chroma DB for semantic embeddings - Criteria History:
storage/criteria_history.json- User criteria evolution - Feedback Log:
storage/feedback_log.json- User feedback history - Knowledge Graph:
storage/kg_graph.json- Semantic knowledge graph
Run linting:
# Frontend
cd priorityPulseFrontend
npm run lint
# Backend - using built-in checks
cd priorityPulseBackend
python _check_syntax.pyVerify authentication setup:
cd priorityPulseBackend
python _verify_auth.pycd priorityPulseFrontend
npm run build
npm run deployThe backend can be deployed to various platforms:
- Google Cloud Run
- AWS EC2/Lambda
- Heroku
- Local server
JWT_SECRET=your-secret-key
GEMINI_API_KEY=your-api-key
FIREBASE_PROJECT_ID=your-project-id
GOOGLE_OAUTH_CLIENT_ID=your-client-id
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret
VITE_GOOGLE_CLIENT_ID=your-client-id
VITE_API_URL=http://localhost:8000
- Gmail API errors: Ensure service account has appropriate permissions
- Firebase authentication failures: Check Firebase credentials and project config
- Agent communication issues: Verify all API keys are correctly set
- CORS errors: Ensure backend CORS middleware is configured correctly
- Authentication issues: Verify Google OAuth credentials
- API connection failures: Check that backend is running on correct port
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/your-feature) - Create a Pull Request
- FastAPI: Web framework
- Uvicorn: ASGI server
- Google Cloud APIs: Gmail, Calendar, Docs, Pub/Sub
- Firebase: Authentication and hosting
- Chroma DB: Vector database for semantic search
- Mem0AI: Memory and context management
- Google Generative AI: LLM for intelligent processing
- PyJWT: Session token management
- React 19: UI library
- Vite: Build tool and dev server
- React Router: Client-side routing
- Axios: HTTP client
- Google OAuth: Authentication
- Lucide React: Icon library
Last Updated: February 2026