Skip to main content
Glama
# de-job-intelligence: Autonomous Job Market Intelligence & Agentic Synthesis Platform

An enterprise-grade, event-driven data platform and agentic workflow engine designed to monitor technical job markets, evaluate technical alignment through deterministic RAG frameworks, and orchestrate automated document and email synthesis via the **Model Context Protocol (MCP)**, Google Workspace APIs, and automated WhatsApp alert workers.

Built with Python 3.12, Starlette, PostgreSQL (Psycopg 3 with connection pooling), and Google Gemini, this platform replaces brittle prompt engineering with a decoupled, bounded-context architecture featuring strict schema validation, defensive synthesis fallbacks, and micro-batch worker pipelines.

---

## πŸ› System Architecture

The platform decouples transient web extraction, persistence, deterministic retrieval-augmented generation (RAG), and external agent protocols into clean bounded contexts:

                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚ External Job APIs (Dice) β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚   src/ingestion/         β”‚
                      β”‚   (REST Ingestion Client)β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚ (Idempotent Upsert)
                                    β–Ό

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ PostgreSQL 16 Storage (saved_jobs) β”‚ β”‚ Managed via psycopg_pool.ConnectionPool β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β–Ό (Queue: PENDING/FAILED) β–Ό (Audit & Queries) β–Ό (Job Fetching) β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ src/workers/ β”‚ β”‚ src/dashboard/ β”‚ β”‚ src/engine/ β”‚ β”‚ - backfill_worker β”‚ β”‚ - Starlette UI (Port 5001β”‚ β”‚ - matcher.py (Scorer) β”‚ β”‚ - batch_ingestion β”‚ β”‚ - Tailwind CSS + Jinja2 β”‚ β”‚ - prompt_builder.py β”‚ β”‚ - Gemini LLM Pacing β”‚ β”‚ - Skill Gap Audit Matrix β”‚ β”‚ - analyzer.py β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Model Context Protocol (MCP) β”‚ β”‚ src/protocols/ (Port 8000) β”‚ β”‚ - JSON-RPC 2.0 Dispatcher β”‚ β”‚ - Non-blocking asyncio.to_thr β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Tool 1: Context RAG β”‚ Tool 2: Document & Draft Synthesis β–Ό β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 5-Phase Knowledge Graph β”‚ β”‚ src/synthesis/ β”‚ β”‚ - Dynamic Phase Weighting β”‚ β”‚ - resume_mapper.py β”‚ β”‚ - Core DE Phase Suppression β”‚ β”‚ - gdrive_docs.py β”‚ β”‚ - Static Tool Bridging β”‚ β”‚ - gmail_client.py β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ (OAuth 2.0 API) β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Production Drafts & Resumes β”‚ β”‚ (Gmail Drafts & G-Docs URL) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


---

## πŸ’‘ Core Engineering Highlights

### 1. Deterministic RAG vs. Generative Hallucination

Standard LLM resume customization frequently invents metrics, hallucinates tool proficiencies, or shifts focus away from core backend responsibilities. This platform enforces **deterministic grounding**:

* **5-Phase Architectural Knowledge Graph (`company_frameworks.json`)**: Every career tenure is mapped across Ingestion & Streaming, Lakehouse Landing, Distributed Transformations (Spark/Databricks), Orchestration & Data Modeling, and Semantic Serving.
* **Dynamic Phase Weighting Policy**: Backend evaluation detects the target archetype. For Core Data Engineering roles, the engine strictly suppresses Phase 5 (BI/dashboards) and forces 85%+ of generated content into distributed compute, partition pruning, memory tuning, and CDC patterns.
* **Strict Tool Bridging**: Maps unmentioned candidate tools to their exact architectural equivalents (e.g., Kafka maps strictly to Kinesis/Databricks Streaming; dbt maps strictly to SQL transformation layers) without inventing experience.

### 2. Model Context Protocol (MCP) Integration

Implements a Starlette JSON-RPC 2.0 server adhering to open Model Context Protocol standards. Exposes operational primitives directly to AI agents:

* `prepare_job_tailoring_prompt`: Ingests PostgreSQL job context, executes heuristic scoring, applies dynamic phase suppression, and packages full prompt context.
* `export_tailored_resume`: Consumes structured JSON from the reasoning model, validates profile invariant truths, executes Google Docs API batch updates, and returns a verified document link.
* `get_job_details`: Exposes metadata and raw text for targeted inspection.
* `retry_job_evaluations`: Coordinates rate-paced background evaluations for pending queues.

### 3. Automated Recruiter Intelligence & Rich HTML Gmail Drafts

* **Intelligent Recruiter Extraction (`email_analyzer.py`)**: Sanitizes incoming recruiter names to extract first names only (e.g., converting "Roshini D" or "Mishra.Neha@..." into clean, human salutations like "Hi Roshini,").
* **Section-Aware HTML Client (`gmail_client.py`)**: Renders rich MIME alternative messages with:
  * **Technical Alignment Bullets**: Indented bullet lists with automatically bolded subheadings before colons.
  * **Candidate Summary Block**: Cleanly indented metadata rows (`Total Experience`, `Work Authorization`, `Role Focus`, etc.) with bold keys and zero bullet dots.
  * **Pristine Signature Spacing**: Tightened vertical spacing omitting the generic job title per user preference, with helper addresses safely mapped to the CC field.

### 4. High-Throughput Asynchronous Concurrency

* **Database Connection Pooling**: PostgreSQL connections managed through `psycopg_pool.ConnectionPool` (`min_size=1, max_size=10`), eliminating connection overhead and memory exhaustion.
* **Non-Blocking Thread Delegation**: Heavy external network calls (Google Docs API batch calls, database cursors, file I/O) are systematically offloaded via `asyncio.to_thread`, keeping Starlette’s event loop available for inbound RPC traffic.
* **Rate-Paced Worker Queues**: LLM backfill workers utilize deterministic pacing delays and state-machine transitions (`PENDING` $\rightarrow$ `PROCESSED` $\rightarrow$ `FAILED`) to stay within Google Gemini API quota limits without stalling pipelines.

---

## πŸ›  Tech Stack

| Domain | Technology | Purpose |
| --- | --- | --- |
| **Runtime & Language** | Python 3.12 | Core platform language |
| **API & Protocol Server** | Starlette, Uvicorn | High-performance ASGI runtime, JSON-RPC 2.0 MCP server |
| **Database & Pooling** | PostgreSQL 16, Psycopg 3 (`psycopg_pool`) | Relational persistence, JSONB metadata, thread-safe pooling |
| **LLM & Heuristics** | Google Gemini API (`gemini-2.0-flash`), Regex | Heuristic regex matching and generative evaluation |
| **External Synthesis** | Google Workspace APIs (Docs, Drive v3, Gmail) | OAuth 2.0 authenticated document cloning and rich HTML draft composition |
| **UI & Observability** | Jinja2, Tailwind CSS | Live pipeline dashboard and AI skill gap audit interface |
| **Testing & CI/CD** | Pytest, AnyIO, Ruff, GitHub Actions | Integration/unit test suites and automated pull-request validation |
| **Containerization** | Docker, Docker Compose | Multi-stage container builds and microservice orchestration |

---

## πŸ“‚ Repository Structure

de-job-intelligence/ β”œβ”€β”€ .github/ β”‚ └── workflows/ β”‚ └── ci.yml # Automated Pytest and Ruff linting pipeline β”œβ”€β”€ config/ β”‚ β”œβ”€β”€ company_frameworks.json # 5-Phase data engineering lifecycle knowledge graphs β”‚ β”œβ”€β”€ resumes/ β”‚ β”‚ └── resume_de.md # Candidate master profile context β”‚ └── roles/ β”‚ └── data_engineering.json# Skill schemas, phase weighting policies, heuristics β”œβ”€β”€ logs/ # Server output logs and daemon PID files β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ core/ β”‚ β”‚ β”œβ”€β”€ config.py # Pydantic Settings with .env loading β”‚ β”‚ β”œβ”€β”€ database.py # Psycopg 3 connection pool and atomic query helpers β”‚ β”‚ └── utils.py # File system and profile cache loaders β”‚ β”œβ”€β”€ dashboard/ β”‚ β”‚ β”œβ”€β”€ templates/ β”‚ β”‚ β”‚ β”œβ”€β”€ dashboard.html # Real-time job ingestion ledger and filter UI β”‚ β”‚ β”‚ └── audit.html # Skill matrix & gap audit interface β”‚ β”‚ └── app.py # Starlette dashboard backend & /api/jobs REST router β”‚ β”œβ”€β”€ engine/ β”‚ β”‚ β”œβ”€β”€ analyzer.py # Google Gemini structured evaluation client β”‚ β”‚ β”œβ”€β”€ alert_pipeline.py # WhatsApp alert metadata and synthesis pipeline β”‚ β”‚ β”œβ”€β”€ email_analyzer.py # Recruiter first-name and contact extractor β”‚ β”‚ β”œβ”€β”€ matcher.py # Heuristic regex skill scoring engine β”‚ β”‚ └── prompt_builder.py # Deterministic RAG builder with phase weighting β”‚ β”œβ”€β”€ ingestion/ β”‚ β”‚ β”œβ”€β”€ dice_client.py # REST API client for job search normalization β”‚ β”‚ └── scraper.py # HTML sanitization & DOM text extraction β”‚ β”œβ”€β”€ protocols/ β”‚ β”‚ β”œβ”€β”€ app.py # MCP JSON-RPC 2.0 server (tools/list, tools/call) β”‚ β”‚ β”œβ”€β”€ dispatcher.py # Asynchronous tool router (asyncio.to_thread) β”‚ β”‚ └── schemas.py # JSON Schema manifests for all MCP tools β”‚ β”œβ”€β”€ synthesis/ β”‚ β”‚ β”œβ”€β”€ gdrive_docs.py # Google Drive copy & Docs batchUpdate engine β”‚ β”‚ β”œβ”€β”€ gmail_client.py # Rich HTML MIME draft builder with smart styling β”‚ β”‚ └── resume_mapper.py # Defensive fallback injector & token replacer β”‚ └── workers/ β”‚ β”œβ”€β”€ backfill_worker.py # Paced queue worker for LLM scoring backfills β”‚ β”œβ”€β”€ batch_ingestion.py # Job ingestion & heuristic upsert pipeline β”‚ └── pipeline_utils.py # Database state-machine update operations β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ test_ingestion.py # Mock tests for REST client and persistence β”‚ β”œβ”€β”€ test_prompt_builder.py # RAG framework and token caching validation β”‚ β”œβ”€β”€ test_protocol.py # Starlette JSON-RPC handshake & tool dispatch tests β”‚ β”œβ”€β”€ test_synthesis.py # Fallback resilience & token sanitization tests β”‚ └── test_workers.py # Worker queue and database mock verification β”œβ”€β”€ Dockerfile # Multi-stage lean Python 3.12 container definition β”œβ”€β”€ docker-compose.yml # Multi-service orchestration (Postgres, MCP, Dashboard) β”œβ”€β”€ pyproject.toml # Poetry/pip standard build dependencies & pytest config β”œβ”€β”€ start_server.sh # macOS/Linux daemon lifecycle startup script └── stop_server.sh # Clean PID termination and fallback port release script


---

## πŸ“‹ MCP Protocol Specification

The MCP Server implements JSON-RPC 2.0 at `http://localhost:8000/rpc`. Below are the primary tool contracts exposed to reasoning agents:

### 1. `prepare_job_tailoring_prompt`

Fetches a target job record from PostgreSQL, calculates baseline skill alignment, checks for BI/reporting keywords to trigger Phase 5 suppression, and packages company frameworks.

* **Arguments:** `{"job_id": "string"}`
* **Response:**
```json
{
  "job_metadata": { "job_id": "dice_123", "title": "Senior Data Engineer", "company": "Acme" },
  "job_description": "...",
  "base_resume": "...",
  "tailoring_guidelines": {
    "dynamic_phase_weighting_policy": "SUPPRESS Phase 5 (BI) unless explicitly demanded...",
    "company_architectural_frameworks": { ... }
  }
}

2. export_tailored_resume

Ingests the LLM’s tailored JSON payload, validates each role against master profile facts, fills any dropped bullets using the defensive fallback engine, clones the Google Doc template, and returns an edit link.

  • Arguments:

{
  "document_title": "Sri Omkar Dumpa - Lead Data Engineer",
  "llm_payload": {
    "professional_summary": "Data Engineer with 8+ years experience...",
    "technical_skills": { "cloud": "AWS, Azure", "bigdata": "Spark, Databricks" },
    "experience": {
      "herc": [
        "Optimized Spark SQL jobs, reducing runtime by 30% through partition pruning."
      ]
    }
  }
}
  • Response:

{
  "status": "success",
  "document_url": "[https://docs.google.com/document/d/1bIC23.../edit](https://docs.google.com/document/d/1bIC23.../edit)",
  "message": "Resume successfully generated and formatted in Google Docs."
}

⚑ Quickstart Guide

1. Clone & Environment Configuration

git clone [https://github.com/your-username/de-job-intelligence.git](https://github.com/your-username/de-job-intelligence.git)
cd de-job-intelligence

python3.12 -m venv venv
source venv/bin/activate
pip install -e ".[dev]"

2. Environment Variables Setup

Create .env in the project root:

# Database Settings
DB_HOST=localhost
DB_PORT=5432
DB_NAME=job_scout_db
DB_USER=postgres
DB_PASSWORD=your_password

# Google Gemini API
GEMINI_API_KEY=your_gemini_api_key

# Google Workspace Integration
GOOGLE_DOCS_TEMPLATE_ID=your_google_doc_template_id

# Server Ports
MCP_SERVER_PORT=8000
DASHBOARD_PORT=5001

Place your authorized credentials.json and generated token.json in the project root to enable Google Drive, Google Docs, and Gmail API draft creation.

3. Verify Test Suite

Execute the complete test suite verifying ingestion, prompting, synthesis fallbacks, and protocol routing:

python -m pytest tests/ -v

Related MCP server: career-agent-mcp

πŸš€ Execution & Operations

Local Daemon Management

The platform provides production process management via shell scripts that handle PID tracking and port allocation:

# Start MCP Protocol Server (Port 8000) & Observability Dashboard (Port 5001)
./start_server.sh

# Check Service Health
curl http://localhost:8000/health
# {"status":"healthy","service":"de-job-intelligence-mcp","version":"1.0.0"}

# Stop all background services cleanly
./stop_server.sh

πŸ“Š Live Observability & Skill Audit

The dashboard (src/dashboard/) provides real-time visibility into your job search pipeline:

  1. Active Ledger View (/): Displays categorized jobs, heuristic fit scores, date posted, employment type, visa sponsorship status, and direct application links.

  2. Dynamic Client Filtering: Filter real-time records by post date, database ingestion timestamp, and source.

  3. AI Skill Gap Audit (/audit?category=data_engineering): Evaluates market demand across all ingested listings against candidate resume skills, categorizing technologies into matched, missing, and AI-extracted skills.


πŸ”’ Security & Data Governance

  • Zero Secret Leakage: Strict .gitignore boundaries protect .env, credentials.json, token.json, and process logs from version control tracking.

  • Deterministic Profile Invariants: The synthesis mapper protects candidate name, email, phone number, education, and company tenures against LLM rewriting or hallucination.

  • Idempotent Storage Patterns: Ingestion pipelines use PostgreSQL ON CONFLICT (job_id) DO NOTHING constraints to prevent duplicate writes and race conditions during high-volume ingestion sweeps.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables LLM clients to analyse job postings, tailor resumes from an evidence-labelled profile, validate every claim against that profile, and track applications, all through deterministic MCP tools.
    7
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI clients to serve as a personal career analyst by searching, matching, and explaining job recommendations, managing job applications, and syncing public job boards through standardized MCP tools.
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Enables AI agents to search job openings across free sources, prepare application materials using known experience, and handle authorized email sending and follow-ups.
    9
    2
    MIT