Loading repository dataβ¦
Loading repository dataβ¦
himanshu231204 / repository
π AI-powered Chrome Extension that generates context-aware LinkedIn comments using LangGraph multi-agent workflows, FastAPI, LangChain, and LLMGateway. Supports multiple comment tones, intelligent post analysis, and one-click comment insertion directly on LinkedIn.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Generate context-aware, human-like LinkedIn comments in real time using a LangGraph multi-agent workflow with Groq Llama 3.3 and Gemini fallback.
Features | Architecture | Quick Start | Testing | API Reference | Extension Setup
LinkedIn AI Comment Copilot is a full-stack application consisting of a Chrome Extension and a FastAPI backend that work together to analyze LinkedIn posts and generate high-quality, context-aware comments. The system uses a LangGraph multi-agent workflow with four specialized agents β each powered by the optimal LLM for its task β to ensure every comment is relevant, professional, and human-sounding.
Key highlights:
Click the image above to watch the demo on YouTube
| Feature | Description |
|---|---|
| Post Detection | Automatically detects all visible LinkedIn posts using action-bar-first strategy |
| AI Comment Button | Injects exactly one "Generate AI Comment" button per post (no duplicates) |
| Comment Card | Displays generated comment in a prominent card with Copy, Insert, and Dismiss buttons |
| Insert to LinkedIn | Automatically opens LinkedIn's comment box and fills it with the generated comment |
| Tone Selector | Choose from 10 comment tones: Professional, Technical, Supportive, Networking, Thoughtful, Friendly, Encouraging, Curious, Founder, Recruiter |
| Per-Agent Model Routing | Each agent uses the optimal LLM β Groq Llama 3.3 70B primary, Gemini 2.5 Flash fallback via ChatLiteLLMRouter |
| LangSmith Observability | Full trace visibility for every request through the multi-agent pipeline |
| One-Click Copy | Copy generated comments to clipboard instantly |
| Regenerate | Generate alternative variations with a single click |
| Quality Review | Built-in reviewer agent scores and approves comments before delivery |
| LLM Cost Tracking | Built-in cost measurement β test single-call cost via /test-cost endpoint |
graph TD
A[LinkedIn Page] -->|Detects Posts| B[Chrome Extension]
B -->|Extracts Content| C[Content Script]
C -->|"Click 'Generate AI Comment'"| D[Background Service Worker]
D -->|"POST /generate-comment"| E[FastAPI Backend]
E -->|Configures| LS[LangSmith Tracing]
E -->|Invokes| F[LangGraph Workflow]
F --> G["1. Analyzer Agent<br/><i>Groq Llama 3.3 70B</i><br/><small>Gemini fallback</small>"]
G -->|post_type, category, sentiment| H["2. Planner Agent<br/><i>Groq Llama 3.3 70B</i><br/><small>Gemini fallback</small>"]
H -->|strategy| I["3. Writer Agent<br/><i>Groq Llama 3.3 70B</i><br/><small>Gemini fallback</small>"]
I -->|generated_comment| J["4. Reviewer Agent<br/><i>Groq Llama 3.3 70B</i><br/><small>Gemini fallback</small>"]
J -->|Approved| K[Return Comment]
J -->|Rejected| I
K --> E
E -->|Response| D
D -->|Broadcast| L[Comment Card]
L -->|Copy / Insert| M[User Action]
style A fill:#0A66C2,color:#fff
style F fill:#FF6B35,color:#fff
style G fill:#F55036,color:#fff
style H fill:#F55036,color:#fff
style I fill:#F55036,color:#fff
style J fill:#F55036,color:#fff
style LS fill:#6C47FF,color:#fff
sequenceDiagram
participant User as LinkedIn User
participant CS as Content Script
participant BG as Background Worker
participant API as FastAPI Backend
participant Card as Comment Card
User->>CS: Click "Generate AI Comment"
CS->>CS: Extract post content
CS->>BG: sendMessage(GENERATE_COMMENT)
BG->>API: POST /generate-comment
API-->>BG: {comment: "..."}
BG->>BG: Persist to chrome.storage.local
BG-->>CS: {success: true, comment}
CS->>Card: showCommentNotification(comment)
Card-->>User: Display comment card with Copy/Insert
User->>Card: Click "Insert Comment"
Card->>CS: insertCommentIntoLinkedIn(comment)
CS->>CS: Poll for comment box, insert text
linkedin-ai-comment-copilot/
βββ backend/
β βββ main.py # FastAPI application entry point
β βββ agents/
β β βββ analyzer.py # Post classification agent
β β βββ planner.py # Comment strategy planner
β β βββ writer.py # Comment generation agent
β β βββ reviewer.py # Quality assurance agent
β βββ graph/
β β βββ comment_graph.py # LangGraph workflow definition
β βββ models/
β β βββ llm.py # LLM configs + cost tracking + ChatLiteLLMRouter
β β βββ model_router.py # Model selection utilities
β βββ prompts/
β β βββ analyzer_prompt.py # Analyzer system prompt
β β βββ planner_prompt.py # Planner system prompt
β β βββ writer_prompt.py # Writer system prompt
β β βββ reviewer_prompt.py # Reviewer system prompt
β βββ schemas/
β β βββ request.py # Pydantic request models
β β βββ response.py # Pydantic response models
β βββ tests/ # pytest test suite (126 tests)
β β βββ conftest.py # Shared fixtures & test config
β β βββ test_schemas.py # Pydantic schema validation tests
β β βββ test_model_router.py # Model routing & keyword detection
β β βββ test_llm.py # LLM config, pricing & cost calculation
β β βββ test_prompts.py # Prompt template validation
β β βββ test_analyzer.py # Analyzer agent tests
β β βββ test_planner.py # Planner agent tests
β β βββ test_writer.py # Writer agent tests
β β βββ test_reviewer.py # Reviewer agent tests
β β βββ test_comment_graph.py # LangGraph workflow tests
β β βββ test_api.py # FastAPI endpoint tests
β βββ test_models.py # Model connectivity test script
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment variable template
β
βββ doc/
β βββ ARCHITECTURE.md # System architecture & mermaid diagrams
β βββ LANGGRAPH_WORKFLOW.md # Detailed agent pipeline documentation
β βββ MODEL_AND_LLM_INTEGRATION.md # LLM configuration & model docs
β βββ ENVIRONMENT_SETUP.md # Environment setup guide
β βββ API_REFERENCE.md # Complete API documentation
β
βββ extension/
β βββ manifest.json # Chrome Extension Manifest V3
β βββ content.js # LinkedIn page injection script
β βββ content.css # Injected button styles
β βββ popup.html # Extension popup UI
β βββ popup.js # Popup logic & API calls
β βββ popup.css # Popup styles
β βββ background.js # Service worker for API calls
β βββ icons/ # Extension icons (16/32/48/128px)
β
βββ README.md
| Component | Technology | Purpose |
|---|---|---|
| Framework | FastAPI | Async API server |
| AI Orchestration | LangGraph | Multi-agent workflow |
| LLM Integration | LangChain + LiteLLM + ChatLiteLLMRouter | Prompt management, LLM calls & automatic fallback |
| Primary LLM | Llama 3.3 70B (Groq) | Fast, reliable comment generation & analysis |
| Fallback LLM | Gemini 2.5 Flash (Google AI) | Automatic fallback when Groq is unavailable |
| Observability | LangSmith | Tracing, monitoring & debugging |
| Validation | Pydantic | Request/response schemas |
| Server | Uvicorn | ASGI server |
| Component | Technology | Purpose |
|---|---|---|
| Manifest | V3 | Chrome Extension standard |
| Frontend | Vanilla JS + HTML/CSS | Lightweight, no dependencies |
| API | Chrome Extension APIs | Tab management, storage, messaging |
| Permissions | activeTab, storage, clipboardWrite | Minimal required permissions |
All agents use Groq Llama 3.3 70B as primary with Gemini 2.5 Flash as automatic fallback via ChatLiteLLMRouter.
| Agent | Primary Model | Fallback Model | Temperature | Purpose |
|---|---|---|---|---|
| Analyzer | groq/llama-3.3-70b-versatile | gemini/gemini-2.5-flash | 0.3 | Post classification, sentiment analysis |
| Planner | groq/llama-3.3-70b-versatile | gemini/gemini-2.5-flash | 0.5 | Comment strategy determination |
| Writer | groq/llama-3.3-70b-versatile | gemini/gemini-2.5-flash | 0.7 | Comment generation |
| Reviewer | groq/llama-3.3-70b-versatile | gemini/gemini-2.5-flash | 0.3 | Quality scoring & approval |
git clone https://github.com/himanshu231204/linkedin-ai-comment-copilot.git
cd linkedin-ai-comment-copilot
# Navigate to backend
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create environment file
cp .env.example .env
# Add your API keys to .env
Edit backend/.env with your API keys:
# Required β Groq (all agents primary)
GROQ_API_KEY=your_groq_api_key_here
# Optional β Google AI (Gemini fallback when Groq fails)
GOOGLE_API_KEY=your_google_api_key_here
# Optional β LangSmith tracing
LANGSMITH_API_KEY=your_langsmith_api_key_here
LANGSMITH_PROJECT=linkedin-ai-comment-copilot
cd backend
python -m pytest tests/ -v
All 126 tests should pass. No API keys are needed β all LLM ca