AI Agents/Automation

Automate Daily Hacker News Digest with LangChain

A step-by-step guide to building a daily news digest agent with LangChain. The agent fetches, summarizes, and ranks Hacker News stories by your interests, then emails you a clean digest every morning.

James
James
LangChain
Agent Workflow

Build an agent that scrapes the top 10 Hacker News stories every morning, summarizes each article using GPT-4, scores them by relevance to your interests, and delivers a formatted digest to your email inbox via Resend.

Tools/Frameworks:

LangChain, OpenAI GPT-4, Node.js, Cheerio, Resend API, node-cron

1

Fetch top stories

Use the HN API (/v0/topstories.json) to get the current top 10 story IDs, then fetch each story's title, URL, and score.

2

Scrape article content

For each URL, use Cheerio to extract the main article text (skipping paywalled sites gracefully).

3

Summarize with GPT-4

Pass each article's text to a LangChain LLM chain with the prompt: "Summarize this article in 2-3 sentences. Highlight why a developer would care."

4

Score relevance

Use a second chain to rate each summary 1-10 against a user-defined interest profile (e.g. "AI, distributed systems, startups") stored in a .env variable.

5

Format and send email

Compile the ranked summaries into an HTML email template and send via Resend API at 8am using a cron trigger.

Output:
Daily HN Digest — Feb 15, 2026

1. [9/10] Show HN: I built a local-first database in Rust
   A developer built a SQLite alternative optimized for edge computing
   with CRDT-based sync. Relevant because it combines distributed
   systems and Rust — two of your top interests.

2. [8/10] OpenAI announces GPT-5 reasoning benchmarks
   New benchmark results show 40% improvement on multi-step math
   and coding tasks. Directly relevant to AI engineering workflows.

3. [7/10] Why we moved from Kubernetes to plain VMs
   A startup shares their journey back to simplicity after K8s
   operational overhead exceeded their team's capacity.

4. [6/10] PostgreSQL 18 beta adds native JSON schema validation
   The upcoming release includes JSON Schema support directly in
   CHECK constraints. Useful for teams validating API payloads at
   the database layer.

5. [5/10] The state of WebAssembly in 2026
   A comprehensive overview of WASM adoption in production. Covers
   edge computing, plugin systems, and browser-based IDEs.

... (5 more stories)

Delivered to: james@example.com at 8:00 AM PST
About the Creator
Comments (0)
0/300 words

Loading comments...