Smart talent sourcing using X API and Grok AI to find real developers, not influencers.
xPool is an intelligent candidate sourcing and tracking system that leverages the X API to find potential candidates and uses Grok AI to deeply analyze their tweets to distinguish real developers from influencers, recruiters, and bots.
- AI-Generated Search Queries: Grok generates optimized X search queries that look for first-person language ("I built", "working on", "shipped") to find people who actually code
- Deep Tweet Analysis: Analyzes 15+ tweets per user to classify them accurately
- Intelligent Filtering: Automatically skips companies, bots, recruiters, and influencers
- Region Support: Optional geographic filtering
Each candidate is classified with:
- Type:
developer,influencer,recruiter,company,bot, orunknown - Confidence Score: 0-100% confidence in the classification
- Tech Stack: Technologies they actually use (not just talk about)
- Seniority:
junior,mid,senior,lead, orunknown - Recommendation:
source,maybe, orskip
- Interview Pipeline: Track candidates through stages (not reached out β phone screen β interviews β offer)
- Match Scoring: AI-powered scoring of candidate-job fit (0-100%)
- Skills Extraction: Automatic extraction of technical skills from tweets
- Hybrid Search: Combine SQL filters with natural language queries
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β xPool System β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β FastAPI β β Celery β β Redis β β SQLite β β
β β Server βββββΊβ Worker βββββΊβ Broker β β DB β β
β ββββββ¬ββββββ ββββββ¬ββββββ ββββββββββββ ββββββ¬ββββββ β
β β β β β
β β βΌ β β
β β βββββββββββββββββββββββ β β
β β β Background Tasks β β β
β β β β’ source_candidates β β β
β β β β’ enrich_candidates β β β
β β β β’ calculate_scores β β β
β β β β’ reclassify β β β
β β βββββββββββββββββββββββ β β
β β β β β
β βΌ βΌ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β External APIs β β
β β βββββββββββββββ βββββββββββββββββββββββ β β
β β β X API β β Grok API β β β
β β β β’ Search β β β’ Classification β β β
β β β β’ Users β β β’ Query Generation β β β
β β β β’ Tweets β β β’ Skills Extraction β β β
β β βββββββββββββββ β β’ Match Scoring β β β
β β βββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python 3.10+
- Docker (for Redis)
- X API Bearer Token
- xAI API Bearer Token
cd xai-hackathon
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
cd server
pip install -r requirements.txtCreate a .env file in the root directory:
# X API
X_API_BEARER_TOKEN=your_x_api_bearer_token
X_CONSUMER_KEY=your_consumer_key
X_CONSUMER_KEY_SECRET=your_consumer_secret
# xAI (Grok) API
X_AI_API_BEARER_TOKEN=your_xai_api_key
XAI_MANAGEMENT_API_KEY=your_management_key # For Collections
# Optional
REDIS_URL=redis://localhost:6379/0# Start Redis (required for Celery)
docker-compose up -d
# Start FastAPI server
cd server
uvicorn main:app --reload --port 8000
# In another terminal - Start Celery worker
cd server
celery -A celery_app worker --loglevel=info- API Docs: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
POST /jobs
{
"title": "Senior iOS Developer",
"description": "SwiftUI expert for fintech app",
"keywords": ["iOS", "SwiftUI", "Swift", "mobile"],
"requirements": "5+ years iOS, SwiftUI experience"
}POST /jobs/{job_id}/source
{
"max_results": 20,
"regions": ["USA", "UK"], # Optional
"exclude_influencers": true, # Default: true
"min_tweets_analyzed": 15, # Default: 10
"search_queries": [...] # Optional custom queries
}Response:
{
"message": "Smart sourcing started for job {job_id}",
"max_results": 20,
"regions": ["USA", "UK"],
"exclude_influencers": true,
"task_id": "abc123..."
}GET /jobs/{job_id}/candidates?top_k=10&sort_by=match_scorePOST /jobs/{job_id}/enrichPOST /jobs/{job_id}/calculate-scoresGET /candidatesGET /candidates/by-type/developer
GET /candidates/by-type/influencer
GET /candidates/by-type/botPOST /candidates/{candidate_id}/reclassifyPOST /candidates/search
{
"query": "iOS experience with SwiftUI",
"filters": {
"interview_stage": ["not_reached_out"],
"min_years_experience": 3,
"skills": ["Swift", "iOS"]
},
"top_k": 10
}GET /candidates/by-job/{job_id}/not-reached-out?top_k=20GET /tasks/{task_id}Response:
{
"task_id": "abc123...",
"status": "SUCCESS",
"result": {"candidates_added": 5, "candidates_skipped": 15}
}Grok AI generates 5 optimized search queries based on job requirements:
Query 1: iOS SwiftUI "I built" OR "I shipped" OR "working on" -job -hiring...
Query 2: Swift iOS "my app" OR "my project" mobile -influencer -hiring...
Query 3: iOS developer "I fixed" OR "I implemented" -recruitment -jobs...
For each potential candidate, the system:
- Fetches 15 recent tweets with engagement metrics
- Sends to Grok for deep analysis
- Receives classification:
{
"candidate_type": "developer",
"confidence": 0.90,
"reasoning": "Shows evidence of actual coding work...",
"is_actively_coding": true,
"tech_stack": ["TypeScript", "React", "Swift"],
"red_flags": [],
"green_flags": ["Shares code snippets", "Discusses bugs"],
"engagement_pattern": "genuine_technical",
"recommendation": "source",
"estimated_seniority": "senior"
}IF candidate_type IN [influencer, recruiter, company, bot]:
SKIP
ELIF recommendation == "skip" AND confidence > 0.6:
SKIP
ELSE:
ADD to database
After sourcing, candidates are enriched with:
- Professional summary
- Extracted skills
- Estimated years of experience
- Match score for the job
{
"id": "uuid",
"x_user_id": "12345",
"x_username": "developer_jane",
"display_name": "Jane Developer",
"bio": "iOS developer...",
"followers_count": 1500,
"following_count": 300,
"github_url": "https://github.com/jane",
"location": "San Francisco",
# AI-Generated
"grok_summary": "Senior iOS developer with 5+ years...",
"skills_extracted": ["Swift", "SwiftUI", "iOS", "Combine"],
"years_experience": 5,
# Classification
"candidate_type": "developer",
"type_confidence": 0.90,
"tweet_analysis": {...}
}{
"job_id": "uuid",
"candidate_id": "uuid",
"status": "sourced|shortlisted|interviewing|rejected|hired",
"interview_stage": "not_reached_out|phone_screen|stage_1|final|offer",
"match_score": 85.5,
"notes": "Strong SwiftUI background"
}| Variable | Description | Required |
|---|---|---|
X_API_BEARER_TOKEN |
X API authentication | Yes |
X_AI_API_BEARER_TOKEN |
Grok API authentication | Yes |
XAI_MANAGEMENT_API_KEY |
xAI Collections API | No |
REDIS_URL |
Redis connection string | No (default: localhost:6379) |
Located in server/celery_app.py:
- Task timeout: 600 seconds
- Serializer: JSON
- Concurrency: 12 workers (default)
xai-hackathon/
βββ docker-compose.yml # Redis service
βββ .env # Environment variables
βββ README.md
β
βββ server/
βββ main.py # FastAPI application
βββ config.py # Settings management
βββ database.py # SQLAlchemy models
βββ models.py # Pydantic schemas
βββ celery_app.py # Celery configuration
βββ requirements.txt
β
βββ routers/
β βββ jobs.py # Job endpoints
β βββ candidates.py # Candidate endpoints
β
βββ services/
β βββ x_api.py # X API client
β βββ grok_api.py # Grok AI client
β βββ embedding.py # xAI Collections
β βββ sourcing.py # Sourcing logic
β
βββ tasks/
βββ celery_tasks.py # Background tasks
curl -X POST "http://localhost:8000/jobs/{job_id}/source" \
-H "Content-Type: application/json" \
-d '{
"max_results": 20,
"regions": ["USA"],
"exclude_influencers": true
}'# Create job
curl -X POST "http://localhost:8000/jobs" \
-H "Content-Type: application/json" \
-d '{
"title": "ML Engineer",
"keywords": ["python", "machine learning", "pytorch", "tensorflow"],
"requirements": "3+ years ML experience, strong Python"
}'
# Source with custom queries
curl -X POST "http://localhost:8000/jobs/{job_id}/source" \
-H "Content-Type: application/json" \
-d '{
"max_results": 15,
"search_queries": [
"\"training model\" OR \"fine-tuning\" pytorch -job lang:en",
"\"I trained\" OR \"my model\" machine learning -hiring lang:en"
]
}'curl "http://localhost:8000/jobs/{job_id}/candidates?top_k=10&sort_by=match_score"curl -X PUT "http://localhost:8000/jobs/{job_id}/candidates/{candidate_id}" \
-H "Content-Type: application/json" \
-d '{
"interview_stage": "phone_screen",
"notes": "Scheduled for Monday 10am"
}'- Basic tier: 10,000 tweets/month
- Use
max_resultswisely - Queries are cached per search
- Each candidate analysis = 1 API call
- Each query generation = 1 API call
- Match scoring = 1 call per candidate
- Start with
max_results: 10-20to test - Use
exclude_influencers: trueto reduce noise - Increase
min_tweets_analyzedfor better accuracy - Use regions to narrow search scope
# Check Redis is running
docker ps
# Check Celery worker logs
celery -A celery_app worker --loglevel=debug- Check X API rate limits
- Try broader keywords
- Reduce filtering strictness:
exclude_influencers: false
- Use
/candidates/{id}/reclassifyto re-analyze - Check
tweet_analysisfield for reasoning
MIT License - See LICENSE file
- Fork the repository
- Create a feature branch
- Submit a pull request
Built with β€οΈ for the xAI Hackathon