feat: initial commit of Autonomous AI Job Discovery Agent

This commit is contained in:
om_karande
2026-10-06 12:29:33 +05:30
commit 88fa6d670c
5 changed files with 269 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
# Environments
.venv/
venv/
ENV/
env/
# Python cache
__pycache__/
*.py[cod]
*$py.class
# Secrets & Local Config
.env
*.local
*.log
+73
View File
@@ -0,0 +1,73 @@
# Autonomous AI Job Discovery & Evaluation Agent
An autonomous agentic workflow combining **live web search** (DuckDuckGo Search) and **local LLM reasoning** (Ollama + Llama 3 8B via LangChain) to discover, filter, match, and draft tailored application pitches for remote AI/ML and GenAI engineering roles.
---
## 📌 Architecture & Features
```text
[ Target Job Queries ]
│
▼
[ LiveJobFetcher ] ───> DuckDuckGo Live Search API (LinkedIn, Naukri, Indeed)
│
▼
[ Anti-Spam Filter ] ───> Excludes fraudulent listings (registration fees, deposits)
│
▼
[ AIJobAgent ] ───> Local Ollama (Llama 3 8B) + LangChain PromptTemplate
│
▼
[ Output Report ]
├── 🎯 Objective Match Score (0 - 100%)
├── 💡 Core Matching Skills
├── ✉️ Tailored 3-Sentence HR Pitch
└── 🔗 Direct Apply Link
```
### Key Components
1. **`job_agent.py`**:
- Multi-query search aggregator querying verified job listings from LinkedIn, Naukri, and Indeed.
- Built-in anti-spam heuristics.
- Profile-aware evaluation using LangChain's pipeline (`prompt | llm`).
2. **`llama3_terminal_chat.py`**:
- Interactive terminal chat assistant supporting multilingual dialogue (Marathi & English) with streaming generation and conversational memory.
---
## 🚀 Quick Start
### 1. Prerequisites
Ensure you have [Ollama](https://ollama.com/) installed and running locally with the `llama3:8b` model pulled:
```bash
ollama pull llama3:8b
ollama serve
```
### 2. Install Dependencies
```bash
python -m venv venv
# Windows:
.\venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate
pip install -r requirements.txt
```
### 3. Run the Job Discovery Agent
```bash
python job_agent.py
```
### 4. Run the Interactive Chat Assistant
```bash
python llama3_terminal_chat.py
```
+127
View File
@@ -0,0 +1,127 @@
import time
from ddgs import DDGS
from langchain_ollama import OllamaLLM
from langchain_core.prompts import PromptTemplate
# Broad & High-Yield Search Queries (LinkedIn, Naukri, Indeed)
TARGET_QUERIES = [
"AI ML Engineer Intern Remote jobs LinkedIn Naukri",
"Generative AI Developer Remote internship Naukri Indeed",
"Data Engineer Intern Remote jobs LinkedIn"
]
# -------------------------------------------------------------------
# 1. Open Live Web Search Aggregator
# -------------------------------------------------------------------
class LiveJobFetcher:
def __init__(self):
self.ddgs = DDGS()
def fetch_jobs(self, query):
print(f"🔍 Searching Live Jobs: '{query}'...")
cleaned_jobs = []
try:
# Fetching fresh web results
results = list(self.ddgs.text(query, max_results=5))
for item in results:
title = item.get("title", "N/A")
snippet = item.get("body", "")
link = item.get("href", "N/A")
# Anti-Spam Check
if "registration fee" in snippet.lower() or "deposit" in snippet.lower():
continue
cleaned_jobs.append({
"title": title,
"company": "Verified Portal Listing",
"platform": "Live Web Search",
"location": "Remote",
"jd": snippet[:400],
"apply_link": link
})
return cleaned_jobs
except Exception as e:
print(f"❌ Fetch Error: {e}")
return []
# -------------------------------------------------------------------
# 2. AI Evaluator Agent (Llama 3 8B)
# -------------------------------------------------------------------
class AIJobAgent:
def __init__(self):
self.llm = OllamaLLM(model="llama3:8b", temperature=0.1, num_ctx=1024)
def evaluate_and_match(self, user_resume, job_details):
prompt = PromptTemplate.from_template(
"""
You are a Senior AI Recruiter. Evaluate this live job opportunity for a candidate.
Candidate Resume Profile:
{resume}
Live Job Listing Title: {job_title}
Job Details/Snippet:
{jd}
Perform the following analysis:
1. Match Score (%): Objective score from 0% to 100% based on technical skills.
2. Core Matching Skills: List top 2-3 matching technical skills.
3. HR Outreach Note: Draft a concise 3-sentence application pitch for HR.
Output Format:
Match Score: [Score]%
Key Matches: [Skills]
Tailored HR Pitch: [Message]
"""
)
chain = prompt | self.llm
return chain.invoke({
"resume": user_resume,
"job_title": job_details["title"],
"jd": job_details["jd"]
})
# -------------------------------------------------------------------
# 3. Main Execution Workflow
# -------------------------------------------------------------------
if __name__ == "__main__":
fetcher = LiveJobFetcher()
agent = AIJobAgent()
my_resume_profile = """
B.Tech AI/ML Student skilled in Python, SQL, PyTorch, LangChain, ChromaDB,
Ollama (Llama 3 8B), Streamlit, RAG Systems, Data Structures, and Agentic Workflows.
"""
print("="*65)
print("🤖 Autonomous AI Job Discovery Agent (Live Engine)")
print("="*65 + "\n")
all_fetched_jobs = []
seen_links = set()
for query in TARGET_QUERIES:
jobs = fetcher.fetch_jobs(query)
for j in jobs:
if j["apply_link"] not in seen_links:
seen_links.add(j["apply_link"])
all_fetched_jobs.append(j)
time.sleep(1)
print(f"\n✅ Total Unique Live Jobs Found: {len(all_fetched_jobs)}\n")
if all_fetched_jobs:
for idx, job in enumerate(all_fetched_jobs[:3], 1):
print(f"--- 📍 Job #{idx}: {job['title']} ---")
evaluation = agent.evaluate_and_match(my_resume_profile, job)
print("\n🧠 AI Evaluation & HR Pitch:")
print(evaluation)
print(f"\n🔗 Direct Apply Link: {job['apply_link']}")
print("-" * 65 + "\n")
else:
print("⚠️ No jobs found.")
+49
View File
@@ -0,0 +1,49 @@
import ollama
print("="*50)
print("🤖 Llama 3 (8B) AI Bot - Memory Mode Enabled")
print("💡 बाहेर पडण्यासाठी 'exit' किंवा हिस्ट्री साफ करण्यासाठी 'clear' टाईप करा.")
print("="*50 + "\n")
# चॅट हिस्ट्री स्टोअर करण्यासाठी रिकामी लिस्ट
conversation_history = []
while True:
user_input = input("\nYou: ")
# बाहेर पडण्यासाठी
if user_input.lower() == 'exit':
print("\nBot: धन्यवाद! पुन्हा भेटूया 👋")
break
# जुनी हिस्ट्री क्लिअर करण्यासाठी
if user_input.lower() == 'clear':
conversation_history = []
print("\n🧹 चॅट हिस्ट्री क्लिअर झाली आहे!")
continue
if not user_input.strip():
continue
# युझरचा मेसेज लिस्टमध्ये ॲड करणे
conversation_history.append({'role': 'user', 'content': user_input})
print("\nAI Bot: ", end="", flush=True)
# संपूर्ण हिस्ट्री Ollama ला पाठवणे
stream = ollama.chat(
model='llama3:8b',
messages=conversation_history,
stream=True,
)
full_response = ""
for chunk in stream:
content = chunk['message']['content']
print(content, end='', flush=True)
full_response += content
print() # New line
# AI चे उत्तरसुद्धा लिस्टमध्ये सेव्ह करणे (पुढच्या संवादासाठी)
conversation_history.append({'role': 'assistant', 'content': full_response})!
+5
View File
@@ -0,0 +1,5 @@
duckduckgo_search>=6.0.0
langchain>=0.2.0
langchain-ollama>=0.1.0
langchain-core>=0.2.0
ollama>=0.2.0