Groq-powered (llama-3.3-70b-versatile) multi-agent SEO blog generation engine. Built for Bizmark'26 β Prompt & Profit hackathon.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI Application β
β β
β POST /blog/generate βββ Master pipeline (all agents in sequence) β
β POST /keywords/cluster β
β POST /serp/analyze β
β POST /seo/analyze /detect-ai /snippet /links β
β POST /humanize β
ββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββΌββββββββββββββββββββββββββ
β Orchestration Layer β
β asyncio.gather() β parallel agent execution β
ββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬ββββ
β β β β β
ββββββββΌβββ βββββββΌββββ βββββΌβββββ ββββΌβββββββ ββΌβββββββββ
βKeyword β β SERP β β Blog β β SEO β βHumanize β
βCluster β β Gap β β Gen β βOptimizerβ β Agent β
β Agent β β Agent β β Agent β β Agent β β β
ββββββββ¬βββ βββββββ¬ββββ βββββ¬βββββ ββββ¬βββββββ ββ¬βββββββββ
β β β β β
ββββββββββββ΄ββββββββββ΄ββββββββββ΄ββββββββββ
β
ββββββββββββΌβββββββββββ
β Groq LLM Service β
β llama-3.3-70b-vers. β
βββββββββββββββββββββββ
| Metric | Implementation |
|---|---|
| Prompt Architecture Clarity | Modular prompt templates in prompts/prompts.py |
| Keyword Clustering Logic | Intent-based clusters with traffic + difficulty |
| SERP Gap Identification | DuckDuckGo scrape + competitor page fetch + LLM analysis |
| Projected Traffic Potential | Weighted score β monthly visit range estimate |
| SEO Optimization % | Composite 0-100 score (density + readability + structure) |
| AI Detection % & Naturalness | Heuristic: burstiness + perplexity + AI phrase flags |
| Snippet Readiness Probability | 3-variant generation (paragraph/list/table) with scoring |
| Keyword Density Compliance | Per-keyword density with optimal/under/over status |
| Internal Linking Logic | LLM-powered semantic anchor text + placement suggestions |
| Scalability & Replicability | Stateless agents, async parallel execution, env config |
blogy-ai-engine/
β
βββ main.py # FastAPI app + router registration
βββ config.py # All environment config
βββ requirements.txt
βββ .env.example
β
βββ agents/ # One file per agent
β βββ keyword_agent.py # Agent 1: Keyword clustering
β βββ serp_agent.py # Agent 2: SERP gap analysis
β βββ blog_generator.py # Agent 3: Blog generation
β βββ seo_optimizer.py # Agent 4: SEO scoring (deterministic)
β βββ snippet_agent.py # Agent 5: Featured snippet optimization
β βββ humanizer.py # Agent 6: AI humanization
β βββ internal_linking_agent.py # Agent 7: Internal link suggestions
β
βββ routers/ # FastAPI route handlers
β βββ blog.py # POST /blog/generate
β βββ keywords.py # POST /keywords/cluster
β βββ serp.py # POST /serp/analyze
β βββ seo.py # POST /seo/analyze|detect-ai|snippet|links
β βββ humanize.py # POST /humanize
β
βββ services/
β βββ groq_service.py # Groq async wrapper (chat_completion + json mode)
β βββ ai_detection_service.py # Heuristic AI detection
β
βββ models/
β βββ request_models.py # Pydantic request schemas
β βββ response_models.py # Pydantic response schemas
β
βββ prompts/
β βββ prompts.py # All LLM prompt templates (system + user)
β
βββ utils/
βββ scraper.py # Async DuckDuckGo scraper + page fetcher
βββ seo_utils.py # Deterministic SEO calculations (no LLM)
git clone <repo>
cd blogy-ai-engine
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')"cp .env.example .env
# Edit .env and add your GROQ_API_KEYuvicorn main:app --reload --host 0.0.0.0 --port 8000Open: http://localhost:8000/docs
{
"keyword": "AI blog automation tool India",
"secondary_keywords": ["blog automation", "SEO tool India", "AI content writer"],
"target_location": "India",
"word_count": 2500,
"tone": "professional",
"competitor_urls": [],
"internal_links": [
{
"title": "How to Rank on Google in India",
"url": "https://blogy.in/blog/rank-google-india",
"topic": "SEO",
"keywords": ["SEO", "Google ranking India"]
}
],
"enable_humanization": true
}Response includes:
title,meta_description,slug,contentseo_scoreβ Full SEO audit (0-100)ai_detectionβ AI probability + naturalness + flagssnippet_optimizationβ 3 snippet variants + readiness scoreinternal_linksβ Semantic link suggestionskeyword_clustersβ Intent-grouped keyword clustersserp_analysisβ Competitor gaps + winning anglegeneration_time_seconds
{
"seed_keyword": "SEO tool",
"target_location": "India",
"cluster_count": 5
}{
"keyword": "best AI blog automation tool India",
"target_location": "India",
"max_results": 10
}{
"content": "# Your blog content here...",
"keyword": "AI blog automation",
"secondary_keywords": ["blog tool", "SEO automation"]
}{
"content": "Your blog content to check for AI patterns..."
}{
"content": "# Blog content...",
"keyword": "AI blog automation tool"
}{
"content": "# Blog content...",
"primary_keyword": "AI blog automation",
"existing_blogs": [
{
"title": "How to Rank on Google",
"url": "https://blogy.in/blog/rank-google",
"topic": "SEO",
"keywords": ["SEO", "Google ranking"]
}
]
}{
"content": "# AI-generated blog content...",
"force": false
}The heuristic AI detector doesn't need a paid API. It scores on 4 signals:
| Signal | Weight | What it measures |
|---|---|---|
| Burstiness | 35% | Sentence length variance β AI writes uniform lengths |
| Perplexity Proxy | 25% | Bigram uniqueness ratio β AI reuses transitions |
| AI Phrase Flags | 30% | 20 known AI clichΓ©s ("delve into", "in today's world", etc.) |
| Paragraph Uniformity | 10% | AI paragraphs are suspiciously equal in length |
| Component | Max Points | How |
|---|---|---|
| Word count β₯ 2,500 | 20 | Full marks for 2500+, partial for 1500+ |
| Keyword density 0.5-2.5% | 20 | Optimal range = full marks |
| Readability β₯ 60 | 15 | Flesch-Kincaid score |
| Headings β₯ 5 | 10 | H2/H3 structure |
| Keyword in title | 15 | Binary check |
| Keyword in first 100 words | 10 | Binary check |
| Internal links β₯ 3 | 5 | Markdown link count |
| LSI keywords β₯ 8 | 5 | Top co-occurring non-stopword terms |
| Total | 100 |
| Variable | Required | Description |
|---|---|---|
GROQ_API_KEY |
β | Get from console.groq.com |
SERPAPI_KEY |
β | Optional (uses DuckDuckGo scraper by default) |
APP_ENV |
β | development / production |
APP_HOST |
β | Default: 0.0.0.0 |
APP_PORT |
β | Default: 8000 |
CORS_ORIGINS |
β | Comma-separated frontend origins |