Validate Configuration
Checks that LinkedIn tokens and at least one AI provider key are present before doing any work.
LinkedIn AI Agent researches AI & business news, writes original posts in a personal voice, publishes them automatically four times a day, tracks performance, and learns from engagement data to keep getting better — all running for free on GitHub Actions.
Built for Abdul Rauf Agha (AI Agent | AI Automation | Data Engineering | Business Intelligence) to maintain a consistent, high-quality LinkedIn presence without manual effort.
Aggregates the latest AI & business news from Google News, HackerNews, Reddit, VentureBeat, and TechCrunch — filtered to stay strictly on-topic.
Uses Gemini 2.0 Flash (with a GLM-4 fallback) to write a completely original LinkedIn post in a consistent first-person persona.
Posts directly to LinkedIn via the official API v2 — text-only or with a relevant real image, four times a day.
Tracks likes & comments on every post, then feeds those insights back into future posts to double down on what works.
If anything breaks, an AI sub-agent (DeepSeek V3) reads the error logs, fixes the source code, and pushes the patch automatically.
Runs entirely on free tiers — GitHub Actions, Gemini free tier, Reddit API, Pexels, and Google Custom Search free quota.
Maintain a daily LinkedIn presence (4 posts/day) without spending time writing content.
Build personal brand authority around AI Agents, AI Automation, Data Engineering, and Business Intelligence for business owners, CTOs, and operations leaders.
Avoid repetitive content by tracking recent posts and steering away from duplicate news angles.
Continuously improve post quality and topic selection using real engagement data instead of guesswork.
Checks that LinkedIn tokens and at least one AI provider key are present before doing any work.
Gathers the latest AI and business news from several trusted sources, filters out anything off-topic, removes duplicates, and keeps a backup copy in case a source is temporarily down.
Looks back at how previous posts performed (likes and comments) and figures out which topics, post styles, and hashtags got the best response.
Combines the news, the lessons from past posts, and the writing style guide, then asks the AI to write a fresh, original post — checking it for quality and trying again if needed until it's ready to publish.
For some posts, searches for a relevant, real photo to go along with the text — and only uses a fitting one if it can find it.
Logs in securely, attaches the image if there is one, and publishes the finished post directly to the LinkedIn profile — automatically retrying if LinkedIn is briefly busy.
Adds a record of the new post — its text, hashtags, and source — to its post history log, so it can be reviewed and learned from later.
Saves the updated post history so the records carry over and aren't lost between runs.
Runs no matter what happens above. If something went wrong, a separate AI agent reads the error, figures out the fix, and corrects the code automatically — no developer needed.
| Time (PKT) | UTC | Job | Description |
|---|---|---|---|
10:00 AM | 05:00 | scrape-and-post | Generate + publish post (image-eligible) |
02:00 PM | 09:00 | scrape-and-post | Generate + publish post (text-only) |
05:00 PM | 12:00 | scrape-and-post | Generate + publish post (image-eligible) |
09:00 PM | 16:00 | scrape-and-post | Generate + publish post (text-only) |
11:00 PM | 18:00 | update-engagement | Fetch likes/comments for all posts |
🤖 Fully autonomous LinkedIn presence — no manual writing or scheduling
🎯 On-brand, consistent first-person voice across every post
♻️ Always fresh — avoids repeating news stories (2 days) or post angles (7 days)
🚫 Topic guardrails — automatically avoids off-brand ML/Deep Learning content
📈 Self-improving content strategy based on real engagement data
🖼️ Relevant visuals automatically attached to select posts
🗂️ Full performance history of every post ever published
🔧 Self-healing automation — fixes its own bugs in production
💰 Zero ongoing operating cost (free-tier APIs only)
Relevance scoring, include/exclude keyword filters, deduplication, and a 24h JSON cache fallback across 5 news sources.
Gemini 2.0 Flash → GLM-4 Flash → deterministic rule-based template, guaranteeing a post is always produced.
Persona, tone, post formats, hashtag pool, and a quality checklist live in one Markdown file injected as the system prompt.
Weighted score (likes + comments × 3) drives top/bottom topic detection, best format, top hashtags, and best sources.
Rejects outputs with excluded keywords or near-duplicate openings vs. recent posts, with automatic regeneration.
OAuth2 token refresh on 401, full 3-step image upload flow, retry/backoff on 429 rate limits.
Allow-list of trusted domains and a block-list of AI-art generator sites, with size/format validation.
3-tier LinkedIn API fallback (socialActions → shares → ugcPosts) to maximize data availability.
Tracks date, time, post preview, hashtags, post ID, generation method, news source/title, status, likes, and comments.
Parses failed Actions logs, sends Python tracebacks to DeepSeek V3 for a corrected file, and auto-commits the fix.
Same codebase runs identically on a developer machine and in GitHub Actions, with cloud-only auto-commit of post history.
UTF-8 console reconfiguration ensures clean output on Windows as well as Linux runners.
Abdul Rauf Agha — AI Agent | AI Automation | Data Engineering | Business Intelligence
Helps businesses grow by leveraging AI agents and data automation. Audience: business owners, CTOs, operations managers, and decision-makers. Tone: authoritative, approachable, practical, forward-thinking, first-person.
Covers: AI Agents, AI Automation, Business Intelligence, Claude/Anthropic, Gemini/Google AI, OpenAI/ChatGPT, Chinese AI (DeepSeek/Qwen), vibe coding, agentic development.
Never covers: Machine Learning theory, Predictive Analytics, Neural Networks, Deep Learning.