A modern, sleek email agent powered by Composio Tool Router and Auth Links. Ask questions about your emails using natural language and get intelligent responses powered by GPT-5.
- π Secure Gmail Authentication via Composio Auth Links
- π¬ Natural Language Interface - Chat with your inbox using plain English
- π€ AI-Powered Assistant - GPT-5 integration for intelligent email management
- π¨ Modern Dark UI - Beautiful, minimalist interface design
- π¨ Email Operations - Search, read, reply, and manage emails via chat
- π Real-time Streaming - Get responses as they're generated
- π‘οΈ Secure & Private - Your data stays with you
- Next.js 15.5.4 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- Tailwind CSS 4 - Styling
- Lucide React - Icons
- React Markdown - Message formatting
- FastAPI - Modern Python web framework
- Python 3.12+ - Backend runtime
- Composio - AI agent orchestration and Gmail integration
- OpenAI GPT-5 - Language model
- LangChain - Agent framework
- Uvicorn - ASGI server
- Node.js v18 or higher
- Python 3.12 or higher
- OpenAI API Key (Get one here)
- Composio API Key (Get one here)
-
Clone the repository:
git clone <your-repo-url> cd open-email-assistant
-
Install frontend dependencies:
npm install
-
Install backend dependencies:
cd backend pip install -r requirements.txt # or use uv uv sync cd ..
-
Set up environment variables:
Create
.envfile in the root directory:OPENAI_API_KEY=your_openai_api_key_here COMPOSIO_API_KEY=your_composio_api_key_here DEBUG=true
Option 1: Run everything together (Recommended)
npm run devThis starts both frontend (port 3000) and backend (port 8000) concurrently.
Option 2: Run separately
# Terminal 1 - Frontend
npm run dev:frontend
# Terminal 2 - Backend (using uvicorn directly)
cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
- Sign In: Enter your Gmail address
- Authenticate: Complete the Gmail OAuth flow
- Start Chatting: Ask questions like:
- "Show me unread emails from this week"
- "Find invoice from Stripe"
- "What projects do I have coming up?"
- "Reply to the last email from John"
- Get Results: The AI agent will search your emails and respond naturally
open-email-assistant/
βββ app/ # Next.js frontend
β βββ components/ # React components
β β βββ AuthButton.tsx # Authentication component
β β βββ EmailInterface.tsx # Gmail interface
β β βββ AgentInterface.tsx # AI chat interface
β β βββ ModeToggle.tsx # View switcher
β βββ lib/ # Utilities
β β βββ api.ts # API service layer
β βββ auth/callback/ # OAuth callback handler
β βββ page.tsx # Main application
βββ backend/ # FastAPI backend
β βββ app/ # Application modules
β β βββ api/routes/ # API routes
β β βββ config/ # Configuration
β β βββ models/ # Pydantic models
β βββ core/ # Core business logic
β β βββ agent.py # AI agent service
β β βββ connection.py # Composio connection management
β β βββ tools.py # Email tools service
β β βββ constants.py # Application constants
β βββ main.py # FastAPI application
β βββ pyproject.toml # Python dependencies
βββ package.json # Node.js dependencies
βββ README.md # This file
- Clean Architecture - Separation of concerns with clear boundaries
- Service Layer Pattern - Business logic isolated from API routes
- No Global State - Proper dependency injection throughout
- Type Safety - Full TypeScript (frontend) and Pydantic (backend)
- User enters Gmail address
- System checks for existing connection (prevents duplicates)
- Creates Composio Auth Link for new users
- OAuth flow with Gmail
- Secure connection established
- User can start chatting immediately
- Model: OpenAI GPT-5 for natural language understanding
- Orchestration: Composio OpenAI Agents SDK
- Tools: Gmail toolkit (read, search, send, reply)
- Memory: Conversation history maintained per session
- Streaming: Real-time response streaming to frontend
# Development
npm run dev # Run both frontend and backend
npm run dev:frontend # Frontend only (Next.js)
npm run dev:backend # Backend only (uvicorn)
# Backend (uvicorn directly)
cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Production
npm run build # Build frontend for production
npm run start # Start production frontend server
# Backend dependencies
npm run install:backend # Install Python dependencies using uv# Required
OPENAI_API_KEY=sk-... # OpenAI API key
COMPOSIO_API_KEY=... # Composio API key
# Optional
AUTH_CONFIG_ID=... # Composio auth config ID
DEBUG=true # Enable debug mode
ENVIRONMENT=development # Environment nameNEXT_PUBLIC_API_URL=http://localhost:8000 # Backend URLContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.