A comprehensive AI-powered automation platform that combines natural language processing, document analysis, log analysis, calendar management, and GitHub PR review capabilities using Claude AI (Anthropic) and LangChain.
This AI-assistant is designed to facilitate efficient machine learning model training (RAG-based, storing issues and resolutions in a local vector database), automate pull request reviews with detailed comments on code quality and optimization, manage Gmail calendar, compose and send/delete mail with voice-controlled instructions, and summarize logs/documents/reports.
It uses Claude AI (Anthropic's state-of-the-art LLM) for fast, reliable, and intelligent responses. Python (as the backend) wrapped in FastAPI and React as the Frontend.
- Natural language interface powered by Claude AI (Anthropic)
- Context-aware conversations with superior reasoning
- Mathematical computation support
- Document Q&A capabilities
- Faster response times compared to local LLMs
- Upload and analyze PDF and text documents
- AI-powered document summarization
- Question-answering on uploaded documents
- Upload and index log files
- Semantic search across logs using FAISS vector store
- Natural language queries for log analysis
- Support for multiple log files with consolidated indexing
- OAuth 2.0 authentication
- Create, view, and delete calendar events
- Schedule meetings with Google Meet links
- Retrieve events by date
- Support for attendees and locations
- Read and summarize emails
- Mark emails as read/unread
- AI-powered email summarization
- Automated pull request review
- Code quality analysis
- Vulnerability detection
- Best practices suggestions
- AI-generated review comments
- Save issue-resolution pairs
- RAG based engine selects three most relevant solutions from the local saved resolution history, before sending to the LLM for final verdict.
- Training history management
AI-python/
├── main_fastapi.py # Main FastAPI backend server
├── math_ai_agent_doc.py # LLaMA 3 agent with tool support
├── rag_log_analyzer.py # RAG-based log analysis
├── training_store.py # Issue resolution training store
├── pr_review.py # GitHub PR review automation
├── gmail_auth.py # Gmail OAuth authentication
├── ai-agent-ui/ # React frontend
├── logs/ # Log files directory
├── embeddings/ # FAISS vector store
├── uploaded_docs/ # Uploaded documents storage
└── credentials_*.json # OAuth credentials
- Python 3.10+
- Node.js 16+ (for frontend)
- Claude CLI (Claude Code) - Command-line interface for Claude AI
This application now uses the Claude CLI instead of the Claude API for better integration and ease of use.
-
Install Claude CLI:
# Using npm (recommended) npm install -g @anthropic-ai/claude-code # Verify installation claude --version
-
Authenticate with Claude:
# Sign in to Claude CLI claude auth login # Test the connection claude chat -m "Hello, Claude!"
-
Important Note:
- If running inside a Claude Code session, you'll need to unset the
CLAUDECODEenvironment variable when starting your backend - The backend will automatically handle this in most cases
- If running inside a Claude Code session, you'll need to unset the
Why Claude CLI instead of local LLMs or API?
- 10-100x faster than local Ollama/LLaMA
- No GPU required - runs entirely in the cloud
- Superior reasoning and code understanding
- More reliable responses with better formatting
- No API key management - authentication handled by CLI
- Lower resource usage on your machine
Use the automated setup script:
./setup.shOr follow manual installation:
- Clone the repository:
git clone https://github.com/sandeepknd/AI-agents.git
cd AI-agents- Install Claude CLI (if not already installed):
npm install -g @anthropic-ai/claude-code
claude auth login- Install Python dependencies:
pip install -r requirements.txt- Set up environment variables:
# Copy the example file (if it exists)
cp .env.example .env 2>/dev/null || touch .env
# Edit .env and add your tokens:
# GITHUB_TOKEN=your_github_token_here (required for PR review)
# HF_TOKEN=your_huggingface_token (optional, for better rate limits)
#
# NOTE: ANTHROPIC_API_KEY is NO LONGER NEEDED - we use Claude CLI instead- Configure Google OAuth:
- Go to Google Cloud Console
- Create a project and enable Google Calendar API and Gmail API
- Create OAuth 2.0 credentials
- Download credentials and save as:
credentials_calendar.json(for Calendar)credentials_per_gmail.json(for Gmail)
cd ai-agent-ui
npm install# From the root directory
# If running OUTSIDE Claude Code session:
uvicorn main_fastapi:app --reload --host 0.0.0.0 --port 8000
# If running INSIDE Claude Code session (unset CLAUDECODE variable):
unset CLAUDECODE && uvicorn main_fastapi:app --reload --host 0.0.0.0 --port 8000The API will be available at:
- API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Note: The first request may take a few seconds as the Claude CLI initializes.
# From ai-agent-ui directory
cd ai-agent-ui
npm startThe UI will be available at: http://localhost:3000
POST /ask- Send queries to the AI agent{ "query": "What is the derivative of x^2?" }
POST /upload- Upload and analyze documentsPOST /upload-log- Upload log files for indexingPOST /analyze-log- Query log files
GET /authorize-calendar- Start OAuth flowGET /oauth2callback- OAuth callbackGET /get-events- Get upcoming eventsPOST /create-event- Create calendar eventGET /get-events-by-date?date=YYYY-MM-DD- Get events for specific datePOST /schedule-meeting- Schedule meeting with Google Meet{ "title": "Team Standup", "start_time": "2024-03-15T10:00:00", "end_time": "2024-03-15T11:00:00", "description": "Daily standup meeting", "attendees": ["user@example.com"], "create_meet_link": true }DELETE /delete-event?event_id=xxx- Delete event
POST /train-model- Save issue-resolution pair{ "issue": "Server not responding", "resolution": "Restart the service using systemctl restart app" }POST /suggest-resolution- Get AI-powered resolution suggestionsGET /get-training-history- View training historyDELETE /clear-training-history- Clear training data
POST /webhook- GitHub webhook for PR eventsPOST /comment- Post comment on PR{ "pr_url": "https://github.com/user/repo/pull/123", "comment": "LGTM! Great work on this feature." }POST /generate-comment- Generate AI review comment{ "pr_url": "https://github.com/user/repo/pull/123" }
curl -X POST http://localhost:8000/ask \
-H "Content-Type: application/json" \
-d '{"query": "What is 15 factorial?"}'curl -X POST http://localhost:8000/upload-log \
-F "file=@application.log"
curl -X POST http://localhost:8000/analyze-log \
-H "Content-Type: application/json" \
-d '{"query": "Show me all error messages"}'curl -X POST http://localhost:8000/schedule-meeting \
-H "Content-Type: application/json" \
-d '{
"title": "Project Review",
"start_time": "2024-03-20T14:00:00",
"end_time": "2024-03-20T15:00:00",
"attendees": ["team@example.com"],
"create_meet_link": true
}'curl -X POST http://localhost:8000/generate-comment \
-H "Content-Type: application/json" \
-d '{"pr_url": "https://github.com/owner/repo/pull/42"}'- FastAPI - Modern web framework for APIs
- LangChain - LLM orchestration framework
- Claude CLI (Anthropic) - State-of-the-art LLM via command-line interface
- FAISS - Vector similarity search
- Sentence Transformers - Text embeddings
- Google API Client - Calendar and Gmail integration
- React 19 - UI framework
- Axios - HTTP client
- Tailwind CSS - Styling
- Framer Motion - Animations
- React Icons - Icon library
- Claude 3.5 Sonnet - Latest Claude model for chat and reasoning
- all-MiniLM-L6-v2 - HuggingFace embedding model for RAG
- sentence-transformers - Sentence similarity model
# .env file configuration
GITHUB_TOKEN=your_github_personal_access_token # Required for PR review
HF_TOKEN=your_huggingface_token # Optional, for higher rate limits
# NOTE: ANTHROPIC_API_KEY is NO LONGER needed
# Authentication is handled by Claude CLI (claude auth login)The application requests the following Google Calendar scopes:
https://www.googleapis.com/auth/calendar
For Gmail integration:
https://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.readonly
Test Claude CLI connection:
# Check if Claude CLI is installed
claude --version
# Test basic functionality
claude chat -m "Hello, Claude!"
# Check authentication status
claude auth status"Claude CLI command 'claude' not found"
# Install Claude CLI
npm install -g @anthropic-ai/claude-code
# Check if it's in PATH
which claude
# If not in PATH, add to your shell profile (~/.bashrc or ~/.zshrc):
export PATH="$PATH:$HOME/.npm-global/bin""Cannot be launched inside another Claude Code session"
# When starting the backend, unset the environment variable:
unset CLAUDECODE && uvicorn main_fastapi:app --reload --host 0.0.0.0 --port 8000"Authentication failed" or "Not logged in"
# Re-authenticate with Claude CLI
claude auth logout
claude auth login"Timeout" or "Slow responses"
- First request may take longer (5-10 seconds) as CLI initializes
- Subsequent requests should be faster (1-3 seconds)
- Check your internet connection
If you encounter LangChain import errors, ensure you have the correct packages:
pip install --upgrade langchain langchain-community langchain-text-splittersRun the test script to verify Claude CLI integration:
# From the project root
python test_claude_cli.py# Find process using port 8000
lsof -i :8000
# Kill the process
kill -9 <PID># Frontend tests
cd ai-agent-ui
npm test
# Backend tests (if implemented)
pytestThe project follows PEP 8 for Python and Prettier for JavaScript/React.
- Credentials: Never commit
credentials_*.json,token.json, or.envfiles to version control - OAuth Tokens: Tokens are stored locally in
token.jsonandtoken_mail.pickle - GitHub Token: Store in environment variable or
.envfile - Claude Authentication: Managed by Claude CLI - credentials stored in
~/.claude/ - CORS: Frontend is restricted to
http://localhost:3000in production
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
[Specify your license here]
- Anthropic for Claude AI - the most capable AI assistant
- LangChain for the excellent LLM framework
- FastAPI for the modern Python web framework
- React community for the frontend ecosystem
For issues, questions, or contributions, please open an issue on GitHub.
Built with ❤️ using Claude AI, LangChain, and FastAPI