Semi-automated LinkedIn growth OS — human-in-the-loop, zero ban risk, 100% free.
| Feature | How It Works | Ban Risk |
|---|---|---|
| Smart Posting | Raw idea → AI polishes + generates Forbes-style image → You approve → Posted at peak times | ✅ Zero |
| Trending Comments | Discovers trending posts → AI drafts comment → You approve → Posted via official API | ✅ Zero |
| Auto Reply Drafts | New comments on your posts → AI drafts replies → You approve via Telegram | ✅ Zero |
| Networking Intelligence | Tracks every interaction → scores leads → suggests personalized connection requests | ✅ Zero |
| Autonomous Growth Loop | 11 agents run 24/7 discovering trends, opportunities, and content gaps | ✅ Zero |
Everything uses the official LinkedIn API. No scraping, no browser automation.
You (Telegram)
│
▼
Telegram Bot (main.py)
│
├── Ollama (local LLM) ─────── post enhancement, comments, replies
├── Dreamshaper 8 ──────────── Forbes-style image generation (~35s)
├── Trending Discovery ─────── web search for LinkedIn posts
├── Scheduler ──────────────── peak-time post publishing
│
└── Growth OS (main_v2.py)
├── PostgreSQL ─── persistent data
├── Redis ──────── event bus
├── Neo4j ──────── relationship graph
├── Qdrant ─────── vector memory
└── 11 Agents ──── Trend, Prediction, Content, Comment,
Network, Founder, Research, Analytics,
Learning, Opportunity, Connection
| Tool | Purpose | Install |
|---|---|---|
| Python 3.11+ | Runtime | python.org |
| Docker Desktop | PostgreSQL, Redis, Neo4j, Qdrant | docker.com |
| Ollama | Local AI model | ollama.com |
| Telegram Bot Token | Chat interface | Free via @BotFather |
| LinkedIn Developer App | Official API access | developer.linkedin.com |
cd linkedin-ai-agent
python3.11 -m venv venv
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windowspip install -r requirements.txt
pip install asyncpg "redis[asyncio]" neo4j qdrant-client openai anthropicMake sure Docker Desktop is running, then:
docker compose up -dThis starts:
| Service | Port | Purpose |
|---|---|---|
| PostgreSQL | 5433 | Main database |
| Redis | 6379 | Event bus & cache |
| Neo4j | 7474 / 7687 | Relationship graph |
| Qdrant | 6333 | Vector memory |
Verify all are healthy:
docker compose psAll 4 services should show healthy.
Note: PostgreSQL runs on port 5433 (not 5432) to avoid conflicts with any local PostgreSQL installation.
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
# Start and pull model
ollama serve
ollama pull llama3.1:8b- Open Telegram → search @BotFather
- Send
/newbot→ choose a name and username - Copy the Bot Token you receive
- Open a chat with your new bot → send
/start - Visit
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates - Look for
"chat":{"id":— that number is your Chat ID
- Go to linkedin.com/developers/apps → Create App
- Fill in app name, LinkedIn Page, Privacy Policy URL (
http://localhost:8080/privacy), logo - In the Auth tab:
- Add redirect URL:
http://localhost:8080/callback - Copy Client ID and Client Secret
- Add redirect URL:
- In the Products tab, request access to:
- Share on LinkedIn
- Sign In with LinkedIn using OpenID Connect
Copy the template and fill in your values:
cp env.example .envEdit .env with your actual values:
# ── Required ──────────────────────────────────────────────
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
LINKEDIN_CLIENT_ID=your_linkedin_client_id
LINKEDIN_CLIENT_SECRET=your_linkedin_client_secret
LINKEDIN_REDIRECT_URI=http://localhost:8080/callback
# ── Ollama ────────────────────────────────────────────────
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3.1:8b
# ── Your niche (used for trending discovery) ──────────────
TRENDING_NICHE=AI, technology, startups, career growth
# ── Scheduling (your timezone peak times) ─────────────────
PEAK_TIMES_UTC=08:15,12:00,17:30
TIMEZONE=Asia/Calcutta
# ── Growth OS (full stack) ────────────────────────────────
MODE=growth_os
POSTGRES_URL=postgresql://growth_os:password@localhost:5433/linkedin_growth_os
REDIS_URL=redis://:password@localhost:6379/0
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=password
QDRANT_URL=http://localhost:6333
# ── Optional cloud LLMs (leave blank to use Ollama only) ──
OPENAI_API_KEY=
ANTHROPIC_API_KEY=
GEMINI_API_KEY=source venv/bin/activate
python main.py authThis will:
- Open your browser to the LinkedIn authorization page
- After you approve, automatically save your access token and Person URN to
.env
Tokens expire after ~60 days. Re-run
python main.py authwhen you get a 401 error.
Open two separate terminal tabs.
Terminal 1 — Telegram Bot:
cd linkedin-ai-agent
source venv/bin/activate
python main.pyWait until you see:
LIVE! Open Telegram and talk to your bot.
Terminal 2 — Growth OS Agents (after Terminal 1 is fully started):
cd linkedin-ai-agent
source venv/bin/activate
python main_v2.pyWait until you see:
Growth OS LIVE — 11 agents running autonomously.
Send /start to your bot. You'll see the full command menu.
| Command | What It Does |
|---|---|
/post |
Create a LinkedIn post with AI enhancement + image |
/trending |
Discover trending posts + draft comments |
/replies |
Review & reply to comments on your posts |
/manualreply |
Paste any comment → AI drafts reply |
/schedule |
View scheduled posts |
/connections |
Your network by tier (Inner Circle / High Value / Influencers) |
/leads |
Top targets ranked by score + draft connection requests |
/watchlist [Name] |
Monitor specific people |
/network |
Overall networking growth stats |
/brandmemory |
Your personal brand: mission, values, writing style |
/opportunities |
Podcasts, hackathons & speaking gigs |
/competitors |
Competitor analysis + content gaps |
/insights |
Learning loop: best comment modes |
/addnote Topic | Content |
Save insight for AI to use in comments |
/clearmemory |
Reset seen-post history |
/status |
Today's action counts |
/config |
Show current configuration |
# Stop both Python processes
Ctrl+C in each terminal
# Stop Docker services (keeps data)
docker compose stop
# Stop Docker and remove all data (full reset)
docker compose down -vImportant: Always use
Ctrl+Cto stopmain.pyand wait for it to fully exit before restarting. Starting a second instance while one is running causes a Telegram 409 Conflict error.
| Error | Fix |
|---|---|
Ollama not running |
Run ollama serve |
Model not found |
Run ollama pull llama3.1:8b |
LinkedIn API 401 |
Run python main.py auth |
Telegram 409 Conflict |
Another bot instance is running. Run pkill -9 -f "python main.py", wait 5s, restart |
PostgreSQL: role does not exist |
Check POSTGRES_URL uses port 5433, run docker compose ps |
asyncpg not found |
Run pip install asyncpg inside the activated venv |
No posts in /trending |
Run /clearmemory then /trending again |
Image generation slow (~35s) |
Normal on Apple Silicon MPS — cached after first load |
Neo4j browser UI |
Open localhost:7474 — user: neo4j, password: password |
docker compose ps shows unhealthy |
Run docker compose logs <service> to see the error |
linkedin-ai-agent/
│
├── main.py # Telegram bot + LinkedIn OAuth
├── main_v2.py # Growth OS autonomous agents
│
├── telegram_bot.py # All commands and button handlers
├── scheduler.py # Peak-time post publisher
├── comment_manager.py # Auto-reply to comments
├── trending_discovery.py # Trending post discovery
├── image_generator_local.py # Dreamshaper 8 + Forbes text overlay
├── linkedin_client.py # Official LinkedIn API
├── ollama_client.py # Local LLM inference
├── database.py # SQLite (legacy/fallback)
├── config.py # All settings from .env
│
├── core/ # Growth OS infrastructure
│ ├── database_v2.py # PostgreSQL async layer
│ ├── redis_client.py # Redis async client
│ ├── event_bus.py # Redis PubSub event bus
│ ├── llm_router.py # Multi-LLM router
│ ├── master_coordinator.py # Agent orchestrator
│ └── growth_loop.py # 24/7 autonomous loop
│
├── agents/ # 11 specialized agents
│ ├── trend_agent.py
│ ├── prediction_agent.py
│ ├── content_agent.py
│ ├── comment_agent.py
│ ├── network_agent.py
│ ├── founder_agent.py
│ ├── research_agent.py
│ ├── analytics_agent.py
│ ├── learning_agent.py
│ ├── opportunity_agent.py
│ └── connection_agent.py
│
├── docker-compose.yml # PostgreSQL, Redis, Neo4j, Qdrant
├── requirements.txt
├── env.example # Config template → copy to .env
└── .gitignore
| Service | Cost |
|---|---|
| Ollama (local LLM) | Free |
| Dreamshaper 8 (local image gen) | Free |
| Telegram Bot API | Free |
| LinkedIn Developer API | Free |
| PostgreSQL / Redis / Neo4j / Qdrant (Docker) | Free |
| Total | $0/month |
MIT — Use freely, modify as needed, no warranty implied.