Skip to content

100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.

Add always-on Hacker News briefing agent

Shubhamsaboo6c941880313d
diff --git a/README.md b/README.md
index 9fe17917..48b95183 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@
# 🌟 Awesome LLM Apps
<p><strong>100+ AI Agent & RAG apps you can actually run — clone, customize, ship.</strong><br/>
-AI Agents · Multi-agent Teams · MCP Agents · RAG · Voice Agents · Agent Skills · Fine-tuning</p>
+AI Agents · Always-on Agents · Multi-agent Teams · MCP Agents · RAG · Voice Agents · Agent Skills · Fine-tuning</p>
<p>
<strong>Free step-by-step tutorials on <a href="https://www.theunwindai.com">Unwind AI</a></strong><br/>
@@ -69,7 +69,7 @@ You shouldn't have to rebuild the same RAG pipeline, agent loop, or MCP integrat
- 🛠️ **Hand-built, not curated** - every template is original work, tested end-to-end before it ships.
- 🧪 **Runs in 3 commands** - no broken `requirements.txt`, no "figure it out yourself" scaffolding.
-- 🧠 **Covers the modern AI stack** - AI Agents, Multi-agent Teams, MCP Agents, Voice AI Agents, RAG, Agent Skills, Fine-tuning.
+- 🧠 **Covers the modern AI stack** - AI Agents, Always-on Agents, Multi-agent Teams, MCP Agents, Voice AI Agents, RAG, Agent Skills, Fine-tuning.
- 🌐 **Provider-agnostic** - switch between Claude, Gemini, GPT, Llama, Qwen, xAI and others with a config change.
- 📚 **Step-by-step tutorials** - every featured template has a free walkthrough on [Unwind AI](https://www.theunwindai.com).
- 💸 **Apache-2.0** - fork it, ship it, sell it. No paywall, no signup, no telemetry.
@@ -102,10 +102,11 @@ streamlit run travel_agent.py
## 📑 Table of Contents
<details open>
-<summary><strong>14 categories · Click to expand</strong></summary>
+<summary><strong>15 categories · Click to expand</strong></summary>
- [🌱 Starter AI Agents](#-starter-ai-agents)
- [🚀 Advanced AI Agents](#-advanced-ai-agents)
+- [🛰️ Always-on Agents](#️-always-on-agents)
- [🤝 Multi-agent Teams](#-multi-agent-teams)
- [🗣️ Voice AI Agents](#️-voice-ai-agents)
- [🖼️ Generative UI and Agentic Frontends](#️-generative-ui-and-agentic-frontends)
@@ -165,6 +166,11 @@ streamlit run travel_agent.py
* [🌐 Openwork - Open Browser Automation Agent](https://github.com/accomplish-ai/openwork) <sub>↗ external</sub>
* [🛡️ Trust-Gated Multi-Agent Research Team](advanced_ai_agents/multi_agent_apps/trust_gated_agent_team/)
+### 🛰️ Always-on Agents
+*Background agents that run on schedules or events, monitor changing context, decide what needs attention, and proactively deliver updates, artifacts, or actions.*
+
+* [📰 Always-on Hacker News Briefing Agent](always_on_agents/always_on_hn_briefing_agent/)
+
### 🤝 Multi-agent Teams
*Multiple agents collaborating to accomplish complex, cross-domain tasks.*
diff --git a/always_on_agents/always_on_hn_briefing_agent/README.md b/always_on_agents/always_on_hn_briefing_agent/README.md
new file mode 100644
index 00000000..41fb511b
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/README.md
@@ -0,0 +1,157 @@
+# 📰 Always-on Hacker News Briefing Agent
+
+AgentScout is an always-on Hacker News briefing agent built with Google ADK. It scans Hacker News for high-signal stories about AI agents, MCP, coding agents, workflow automation, and LLM apps, then turns the best links into a concise engineering brief.
+
+The app can run as an interactive ADK agent or as a scheduled backend service. Use ADK Web to ask for a brief manually, or run the FastAPI scheduler hook so Cloud Scheduler can trigger a daily Hacker News briefing and send the rendered payload to email, Slack, Linear, Jira, or an internal digest workflow.
+
+![Always-on Hacker News Briefing Agent architecture](assets/agent-scout-architecture.svg)
+
+## Features
+
+- **Hacker News monitoring**: Finds AI agent, MCP, coding agent, automation, and LLM app stories from Hacker News.
+- **Signal ranking**: Scores stories by relevance, points, comments, and front-page position.
+- **Brief generation**: Produces a clean text and HTML briefing with summaries, links, and next actions.
+- **Google ADK agent**: Exposes a `root_agent` so users can request briefs in ADK Web.
+- **Scheduler-ready backend**: Includes HTTP and Pub/Sub endpoints for Cloud Scheduler or other automation systems.
+- **Safe delivery flow**: Defaults to dry-run mode and only posts to a webhook when `dry_run=false`.
+
+## How It Works
+
+1. AgentScout collects stories from deterministic sample data or the live Hacker News front page.
+2. It filters for AI agent and LLM app topics.
+3. It ranks the most useful stories for engineers and product builders.
+4. It renders a daily briefing in text and HTML.
+5. ADK Web, an HTTP trigger, or a Pub/Sub push endpoint returns the result.
+6. If delivery is enabled, the scheduler API posts the brief to `AGENTSCOUT_WEBHOOK_URL`.
+
+## Requirements
+
+- Python 3.10+
+- Gemini API key for Google ADK
+- Optional webhook URL for scheduled delivery
+
+## Installation
+
+```bash
+git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
+cd awesome-llm-apps/always_on_agents/always_on_hn_briefing_agent
+pip install -r requirements.txt
+export GOOGLE_API_KEY="your_gemini_api_key"
+```
+
+## Run in ADK Web
+
+```bash
+adk web .
+```
+
+Open the ADK Web UI and select `always_on_hn_briefing_agent`.
+
+Try prompts like:
+
+```text
+Give me today's AgentScout brief.
+```
+
+```text
+Scout the top 3 Hacker News stories about AI agents and LLM apps.
+```
+
+```text
+Show me the highest-signal Hacker News items about MCP, coding agents, and workflow automation.
+```
+
+## Run the Scheduler API
+
+Start the scheduler backend:
+
+```bash
+uvicorn scheduler_api:app --host 0.0.0.0 --port 8000
+```
+
+Preview a scheduled run without delivery:
+
+```bash
+curl "http://127.0.0.1:8000/agent-scout/dry-run?top_n=3&live=false"
+```
+
+Trigger the scheduler path:
+
+```bash
+curl -X POST "http://127.0.0.1:8000/agent-scout/trigger" \
+ -H "Content-Type: application/json" \
+ -d '{"dry_run": true, "top_n": 5, "live": false}'
+```
+
+Enable live Hacker News scanning:
+
+```bash
+export AGENTSCOUT_LIVE_HN=true
+```
+
+Enable webhook delivery:
+
+```bash
+export AGENTSCOUT_WEBHOOK_URL="https://example.com/agent-brief-webhook"
+export AGENTSCOUT_WEBHOOK_TOKEN="optional_bearer_token"
+
+curl -X POST "http://127.0.0.1:8000/agent-scout/trigger" \
+ -H "Content-Type: application/json" \
+ -d '{"dry_run": false, "top_n": 5, "live": true}'
+```
+
+The webhook receives `subject`, `text`, `html`, `stories`, and `next_actions`.
+
+## Cloud Scheduler Hook
+
+Deploy the scheduler API behind Cloud Run or another HTTP service, then call one of these endpoints from Cloud Scheduler.
+
+Direct HTTP trigger:
+
+```text
+https://YOUR_CLOUD_RUN_URL/agent-scout/trigger
+```
+
+Request body:
+
+```json
+{
+ "dry_run": false,
+ "top_n": 5,
+ "live": true
+}
+```
+
+Recommended weekday briefing schedule:
+
+```text
+0 9 * * 1-5
+```
+
+Pub/Sub push endpoint:
+
+```text
+https://YOUR_CLOUD_RUN_URL/agent-scout/pubsub
+```
+
+For Pub/Sub push, send the same JSON payload as base64-encoded message data.
+
+## Example Output
+
+```json
+{
+ "subject": "AgentScout Hacker News brief - 2026-06-08",
+ "watch_mode": "sample",
+ "stories": [
+ {
+ "title": "Show HN: An open-source framework for reliable AI agent workflows",
+ "points": 428,
+ "comments": 116,
+ "summary": "Framework discussion with practical tradeoffs around orchestration, retries, state, and tool execution."
+ }
+ ],
+ "next_actions": [
+ "Open the highest-comment thread and extract objections or implementation patterns."
+ ]
+}
+```
diff --git a/always_on_agents/always_on_hn_briefing_agent/__init__.py b/always_on_agents/always_on_hn_briefing_agent/__init__.py
new file mode 100644
index 00000000..4caf5181
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/__init__.py
@@ -0,0 +1,3 @@
+from .agent import root_agent
+
+__all__ = ["root_agent"]
diff --git a/always_on_agents/always_on_hn_briefing_agent/agent.py b/always_on_agents/always_on_hn_briefing_agent/agent.py
new file mode 100644
index 00000000..b00e93ec
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/agent.py
@@ -0,0 +1,46 @@
+"""AgentScout: an always-on Hacker News briefing agent."""
+
+from __future__ import annotations
+
+from google.adk.agents import LlmAgent
+
+from .scout import run_ambient_scout
+
+
+def preview_agent_builder_brief(top_n: int = 5) -> dict:
+ """Preview the Hacker News briefing for agent builders.
+
+ Args:
+ top_n: Number of stories to include in the brief.
+
+ Returns:
+ A rendered daily brief with ranked stories, signal, and next actions.
+ """
+
+ return run_ambient_scout(live=None, top_n=top_n)
+
+
+root_agent = LlmAgent(
+ name="agent_scout",
+ model="gemini-3-flash-preview",
+ description=(
+ "Always-on Hacker News briefing agent that watches for AI agent, MCP, "
+ "coding agent, workflow automation, and LLM app stories."
+ ),
+ instruction="""
+You are AgentScout, an always-on Hacker News briefing agent for teams building
+AI agents and LLM apps.
+
+Your job is to act like a focused daily briefing system:
+- Curate only the highest-signal Hacker News items.
+- Explain why each item matters to engineers and product builders.
+- Separate observation from delivery; do not claim to send messages or schedule jobs.
+- When asked for the current brief, daily digest, scouting run, or Hacker News
+ update, call preview_agent_builder_brief.
+- Keep responses concise and operational. Prefer ranked findings, signal, and next actions.
+
+The tool returns rendered text and HTML that can be handed to email, Slack, or
+ticketing automation in a production deployment.
+""",
+ tools=[preview_agent_builder_brief],
+)
diff --git a/always_on_agents/always_on_hn_briefing_agent/assets/agent-scout-architecture.svg b/always_on_agents/always_on_hn_briefing_agent/assets/agent-scout-architecture.svg
new file mode 100644
index 00000000..b0dda890
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/assets/agent-scout-architecture.svg
@@ -0,0 +1,139 @@
+<svg width="1600" height="900" viewBox="0 0 1600 900" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="title desc">
+ <title id="title">Always-on Hacker News Briefing Agent architecture</title>
+ <desc id="desc">A left-to-right architecture image showing Hacker News stories flowing into AgentScout, then filtering, ranking, briefing, and webhook delivery.</desc>
+ <defs>
+ <linearGradient id="bg" x1="0" y1="0" x2="1600" y2="900" gradientUnits="userSpaceOnUse">
+ <stop stop-color="#111827"/>
+ <stop offset="0.48" stop-color="#171717"/>
+ <stop offset="1" stop-color="#2A160C"/>
+ </linearGradient>
+ <linearGradient id="orange" x1="0" y1="0" x2="1" y2="1">
+ <stop stop-color="#FF8A00"/>
+ <stop offset="1" stop-color="#FF5C00"/>
+ </linearGradient>
+ <linearGradient id="teal" x1="0" y1="0" x2="1" y2="1">
+ <stop stop-color="#6EE7B7"/>
+ <stop offset="1" stop-color="#22D3EE"/>
+ </linearGradient>
+ <filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
+ <feDropShadow dx="0" dy="24" stdDeviation="24" flood-color="#000000" flood-opacity="0.32"/>
+ </filter>
+ <filter id="softGlow" x="-50%" y="-50%" width="200%" height="200%">
+ <feGaussianBlur stdDeviation="20" result="blur"/>
+ <feColorMatrix in="blur" type="matrix" values="1 0 0 0 1 0 0.32 0 0 0.42 0 0 0 0 0.08 0 0 0 1 0"/>
+ </filter>
+ <style>
+ .label { font: 700 32px Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: #F8FAFC; }
+ .small { font: 600 20px Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: #CBD5E1; }
+ .tiny { font: 500 16px Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: #94A3B8; }
+ .mono { font: 600 18px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; fill: #FED7AA; }
+ .stroke { stroke: rgba(255,255,255,0.12); }
+ </style>
+ </defs>
+
+ <rect width="1600" height="900" fill="url(#bg)"/>
+ <circle cx="1340" cy="140" r="260" fill="#FF6B00" opacity="0.08" filter="url(#softGlow)"/>
+ <circle cx="230" cy="780" r="280" fill="#22D3EE" opacity="0.06" filter="url(#softGlow)"/>
+ <path d="M0 710C220 650 430 705 640 650C890 585 1100 570 1600 645V900H0V710Z" fill="#FFFFFF" opacity="0.035"/>
+
+ <text x="92" y="98" class="label">Always-on Hacker News Briefing Agent</text>
+ <text x="94" y="136" class="small">AgentScout scans Hacker News, ranks AI agent signals, and ships a daily engineering brief.</text>
+
+ <g transform="translate(82 236)" filter="url(#shadow)">
+ <rect width="250" height="350" rx="26" fill="#151A23" class="stroke"/>
+ <rect x="22" y="22" width="64" height="64" rx="14" fill="url(#orange)"/>
+ <text x="39" y="64" font-family="Inter, Arial, sans-serif" font-size="30" font-weight="800" fill="white">HN</text>
+ <text x="104" y="50" class="small">Hacker News</text>
+ <text x="104" y="78" class="tiny">live front page</text>
+ <g transform="translate(22 120)">
+ <rect width="206" height="54" rx="12" fill="#202938"/>
+ <circle cx="23" cy="27" r="7" fill="#FF8A00"/>
+ <text x="44" y="25" class="tiny">AI agent framework</text>
+ <text x="44" y="43" class="tiny">428 pts · 116 comments</text>
+ </g>
+ <g transform="translate(22 190)">
+ <rect width="206" height="54" rx="12" fill="#202938"/>
+ <circle cx="23" cy="27" r="7" fill="#22D3EE"/>
+ <text x="44" y="25" class="tiny">MCP tools</text>
+ <text x="44" y="43" class="tiny">312 pts · 84 comments</text>
+ </g>
+ <g transform="translate(22 260)">
+ <rect width="206" height="54" rx="12" fill="#202938"/>
+ <circle cx="23" cy="27" r="7" fill="#A78BFA"/>
+ <text x="44" y="25" class="tiny">Coding agents</text>
+ <text x="44" y="43" class="tiny">256 pts · 73 comments</text>
+ </g>
+ </g>
+
+ <g transform="translate(407 284)">
+ <path d="M0 127H112" stroke="#64748B" stroke-width="3" stroke-linecap="round"/>
+ <path d="M96 111L112 127L96 143" stroke="#64748B" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
+ <text x="12" y="100" class="tiny">scheduled scan</text>
+ </g>
+
+ <g transform="translate(530 236)" filter="url(#shadow)">
+ <rect width="300" height="350" rx="30" fill="#111827" stroke="rgba(255,255,255,0.14)"/>
+ <circle cx="150" cy="104" r="58" fill="url(#teal)" opacity="0.18"/>
+ <circle cx="150" cy="104" r="36" fill="#0F172A" stroke="#67E8F9" stroke-width="3"/>
+ <path d="M133 106L146 119L169 87" stroke="#67E8F9" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>
+ <text x="72" y="196" class="label">AgentScout</text>
+ <text x="48" y="232" class="small">Google ADK root_agent</text>
+ <rect x="42" y="268" width="216" height="46" rx="13" fill="#1F2937"/>
+ <text x="62" y="298" class="mono">preview_agent_builder_brief</text>
+ </g>
+
+ <g transform="translate(878 284)">
+ <path d="M0 127H106" stroke="#64748B" stroke-width="3" stroke-linecap="round"/>
+ <path d="M90 111L106 127L90 143" stroke="#64748B" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
+ <text x="0" y="100" class="tiny">briefing pipeline</text>
+ </g>
+
+ <g transform="translate(1010 202)" filter="url(#shadow)">
+ <rect width="250" height="186" rx="24" fill="#172033" stroke="rgba(255,255,255,0.13)"/>
+ <text x="32" y="52" class="small">Filter + Rank</text>
+ <rect x="32" y="82" width="184" height="14" rx="7" fill="#334155"/>
+ <rect x="32" y="112" width="128" height="14" rx="7" fill="#334155"/>
+ <rect x="32" y="142" width="160" height="14" rx="7" fill="#334155"/>
+ <circle cx="205" cy="112" r="32" fill="#FF8A00" opacity="0.18"/>
+ <path d="M191 113L202 124L221 96" stroke="#FDBA74" stroke-width="6" stroke-linecap="round" stroke-linejoin="round"/>
+ </g>
+
+ <g transform="translate(1010 438)" filter="url(#shadow)">
+ <rect width="250" height="186" rx="24" fill="#172033" stroke="rgba(255,255,255,0.13)"/>
+ <text x="32" y="52" class="small">Text + HTML Brief</text>
+ <rect x="32" y="82" width="186" height="14" rx="7" fill="#334155"/>
+ <rect x="32" y="112" width="154" height="14" rx="7" fill="#334155"/>
+ <rect x="32" y="142" width="112" height="14" rx="7" fill="#334155"/>
+ <path d="M199 79H222V156H177V101L199 79Z" fill="#0F172A" stroke="#67E8F9" stroke-width="2"/>
+ <path d="M199 79V101H222" stroke="#67E8F9" stroke-width="2"/>
+ </g>
+
+ <g transform="translate(1304 334)">
+ <path d="M0 113H82" stroke="#64748B" stroke-width="3" stroke-linecap="round"/>
+ <path d="M66 97L82 113L66 129" stroke="#64748B" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
+ <text x="-8" y="86" class="tiny">dry_run=false</text>
+ </g>
+
+ <g transform="translate(1402 276)" filter="url(#shadow)">
+ <rect width="142" height="260" rx="26" fill="#151A23" stroke="rgba(255,255,255,0.14)"/>
+ <text x="30" y="52" class="small">Delivery</text>
+ <g transform="translate(34 86)">
+ <rect width="74" height="34" rx="10" fill="#202938"/>
+ <text x="21" y="23" class="tiny">Email</text>
+ </g>
+ <g transform="translate(34 132)">
+ <rect width="74" height="34" rx="10" fill="#202938"/>
+ <text x="22" y="23" class="tiny">Slack</text>
+ </g>
+ <g transform="translate(34 178)">
+ <rect width="74" height="34" rx="10" fill="#202938"/>
+ <text x="18" y="23" class="tiny">Tickets</text>
+ </g>
+ </g>
+
+ <g transform="translate(92 688)">
+ <rect width="1350" height="92" rx="24" fill="rgba(15,23,42,0.72)" stroke="rgba(255,255,255,0.12)"/>
+ <text x="30" y="38" class="small">Scheduler-ready hooks</text>
+ <text x="30" y="68" class="tiny">GET /agent-scout/dry-run · POST /agent-scout/trigger · POST /agent-scout/pubsub · AGENTSCOUT_WEBHOOK_URL</text>
+ </g>
+</svg>
diff --git a/always_on_agents/always_on_hn_briefing_agent/delivery.py b/always_on_agents/always_on_hn_briefing_agent/delivery.py
new file mode 100644
index 00000000..8234c1c3
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/delivery.py
@@ -0,0 +1,71 @@
+"""Optional delivery hooks for scheduled AgentScout runs."""
+
+from __future__ import annotations
+
+import json
+import os
+import urllib.error
+import urllib.request
+from typing import Any
+
+
+def send_webhook(payload: dict[str, Any]) -> dict[str, Any]:
+ """Send a rendered brief to a configured webhook.
+
+ The app stays safe by default: no webhook is called unless
+ AGENTSCOUT_WEBHOOK_URL is present.
+ """
+
+ webhook_url = os.environ.get("AGENTSCOUT_WEBHOOK_URL")
+ if not webhook_url:
+ return {
+ "configured": False,
+ "sent": False,
+ "status": "skipped_no_webhook",
+ "detail": "Set AGENTSCOUT_WEBHOOK_URL to deliver scheduled briefs.",
+ }
+
+ body = json.dumps(
+ {
+ "subject": payload["subject"],
+ "text": payload["text"],
+ "html": payload["html"],
+ "stories": payload["stories"],
+ "next_actions": payload["next_actions"],
+ }
+ ).encode("utf-8")
+ headers = {"Content-Type": "application/json"}
+ token = os.environ.get("AGENTSCOUT_WEBHOOK_TOKEN")
+ if token:
+ headers["Authorization"] = f"Bearer {token}"
+
+ request = urllib.request.Request(
+ webhook_url,
+ data=body,
+ headers=headers,
+ method="POST",
+ )
+ try:
+ with urllib.request.urlopen(request, timeout=20) as response:
+ response_text = response.read().decode("utf-8", errors="replace")
+ return {
+ "configured": True,
+ "sent": 200 <= response.status < 300,
+ "status": response.status,
+ "response": response_text[:500],
+ }
+ except urllib.error.HTTPError as exc:
+ detail = exc.read().decode("utf-8", errors="replace")
+ return {
+ "configured": True,
+ "sent": False,
+ "status": exc.code,
+ "error": detail[:500],
+ }
+ except urllib.error.URLError as exc:
+ return {
+ "configured": True,
+ "sent": False,
+ "status": "connection_error",
+ "error": str(exc),
+ }
diff --git a/always_on_agents/always_on_hn_briefing_agent/requirements.txt b/always_on_agents/always_on_hn_briefing_agent/requirements.txt
new file mode 100644
index 00000000..91edc7aa
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/requirements.txt
@@ -0,0 +1,3 @@
+google-adk
+fastapi
+uvicorn
diff --git a/always_on_agents/always_on_hn_briefing_agent/scheduler_api.py b/always_on_agents/always_on_hn_briefing_agent/scheduler_api.py
new file mode 100644
index 00000000..6d88ee52
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/scheduler_api.py
@@ -0,0 +1,116 @@
+"""Scheduler-facing API for AgentScout.
+
+Run locally with:
+ uvicorn scheduler_api:app --host 0.0.0.0 --port 8000
+"""
+
+from __future__ import annotations
+
+import base64
+import json
+from json import JSONDecodeError
+from typing import Any, Optional
+
+from fastapi import FastAPI, Request
+
+try:
+ from .delivery import send_webhook
+ from .scout import run_ambient_scout
+except ImportError:
+ from delivery import send_webhook
+ from scout import run_ambient_scout
+
+app = FastAPI(
+ title="AgentScout Scheduler API",
+ description="HTTP and Pub/Sub hooks for scheduled Hacker News briefing runs.",
+)
+
+
+def _as_bool(value: Any, *, default: bool | None = None) -> bool | None:
+ if value is None:
+ return default
+ if isinstance(value, bool):
+ return value
+ if isinstance(value, str):
+ lowered = value.lower()
+ if lowered in {"1", "true", "yes"}:
+ return True
+ if lowered in {"0", "false", "no"}:
+ return False
+ return default
+
+
+def _as_top_n(value: Any) -> int:
+ try:
+ top_n = int(value)
+ except (TypeError, ValueError):
+ return 5
+ return max(1, min(top_n, 10))
+
+
+def run_scheduled_scout(payload: dict[str, Any] | None = None) -> dict[str, Any]:
+ """Run AgentScout from a scheduler payload.
+
+ Payload fields:
+ dry_run: defaults to true. Set false to call the configured webhook.
+ live: optional override for live Hacker News mode.
+ top_n: number of stories, clamped to 1-10.
+ """
+
+ payload = payload if isinstance(payload, dict) else {}
+ dry_run = _as_bool(payload.get("dry_run"), default=True)
+ live = _as_bool(payload.get("live"), default=None)
+ top_n = _as_top_n(payload.get("top_n"))
+
+ brief = run_ambient_scout(live=live, top_n=top_n)
+ delivery = {
+ "attempted": False,
+ "sent": False,
+ "status": "dry_run",
+ "detail": "Set dry_run=false to call AGENTSCOUT_WEBHOOK_URL.",
+ }
+ if dry_run is False:
+ delivery = {"attempted": True, **send_webhook(brief)}
+
+ return {
+ "dry_run": dry_run,
+ "top_n": top_n,
+ "delivery": delivery,
+ "brief": brief,
+ }
+
+
+def health() -> dict[str, str]:
+ return {"status": "ok"}
+
+
[email protected]("/agent-scout/dry-run")
+def dry_run_preview(top_n: int = 5, live: Optional[bool] = None) -> dict[str, Any]:
+ return run_scheduled_scout({"dry_run": True, "top_n": top_n, "live": live})
+
+
[email protected]("/agent-scout/trigger")
+async def scheduler_trigger(request: Request) -> dict[str, Any]:
+ try:
+ payload = await request.json() if request.headers.get("content-length") else {}
+ except JSONDecodeError:
+ payload = {}
+ return run_scheduled_scout(payload)
+
+
[email protected]("/agent-scout/pubsub")
+async def pubsub_trigger(request: Request) -> dict[str, Any]:
+ """Cloud Scheduler -> Pub/Sub push compatible endpoint."""
+
+ envelope = await request.json()
+ message = envelope.get("message", {}) if isinstance(envelope, dict) else {}
+ payload: dict[str, Any] = {}
+ encoded_data = message.get("data")
+ if encoded_data:
+ try:
+ decoded = base64.b64decode(encoded_data).decode("utf-8")
+ payload = json.loads(decoded)
+ except (ValueError, JSONDecodeError):
+ payload = {}
+ return run_scheduled_scout(payload)
diff --git a/always_on_agents/always_on_hn_briefing_agent/scout.py b/always_on_agents/always_on_hn_briefing_agent/scout.py
new file mode 100644
index 00000000..d1b352ed
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/scout.py
@@ -0,0 +1,388 @@
+"""Hacker News briefing pipeline for AgentScout.
+
+The module is intentionally self-contained: it can run with deterministic sample
+data for demos, or fetch the Hacker News front page directly when live mode is
+enabled.
+"""
+
+from __future__ import annotations
+
+import datetime as dt
+import html
+import os
+import re
+import urllib.error
+import urllib.request
+from dataclasses import asdict, dataclass
+from html.parser import HTMLParser
+from typing import Any
+from zoneinfo import ZoneInfo
+
+PACIFIC = ZoneInfo("America/Los_Angeles")
+
+AGENT_KEYWORDS = {
+ "agent",
+ "agents",
+ "agentic",
+ "automation",
+ "autonomous",
+ "coding",
+ "framework",
+ "llm",
+ "mcp",
+ "orchestration",
+ "tool",
+ "workflow",
+}
+
+NOISE_WORDS = {"ask hn: who is hiring", "freelance", "hiring"}
+
+
+@dataclass(frozen=True)
+class Story:
+ title: str
+ url: str
+ hn_url: str
+ points: int
+ comments: int
+ rank: int
+ summary: str
+
+
+@dataclass(frozen=True)
+class Brief:
+ generated_at: str
+ watch_mode: str
+ subject: str
+ text: str
+ html: str
+ stories: list[Story]
+ next_actions: list[str]
+
+ def to_dict(self) -> dict[str, Any]:
+ payload = asdict(self)
+ payload["stories"] = [asdict(story) for story in self.stories]
+ return payload
+
+
+class HNFrontPageParser(HTMLParser):
+ """Small parser for the stable HN table markup."""
+
+ def __init__(self) -> None:
+ super().__init__()
+ self._in_title = False
+ self._current_href = ""
+ self._current_text: list[str] = []
+ self._latest_story: dict[str, Any] | None = None
+ self._current_item_id = ""
+ self._in_score = False
+ self._in_subtext = False
+ self._subtext_link_text = ""
+ self.stories: list[dict[str, Any]] = []
+
+ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
+ attributes = dict(attrs)
+ class_name = attributes.get("class", "")
+ if tag == "tr" and "athing" in class_name.split():
+ self._current_item_id = attributes.get("id") or ""
+ elif tag == "span" and class_name == "titleline":
+ self._in_title = True
+ elif self._in_title and tag == "a" and not self._current_href:
+ self._current_href = attributes.get("href") or ""
+ self._current_text = []
+ elif tag == "span" and class_name == "score":
+ self._in_score = True
+ self._current_text = []
+ elif tag == "span" and class_name == "subtext":
+ self._in_subtext = True
+ elif self._in_subtext and tag == "a":
+ self._subtext_link_text = ""
+
+ def handle_endtag(self, tag: str) -> None:
+ if self._in_title and tag == "a" and self._current_href:
+ title = " ".join("".join(self._current_text).split())
+ rank = len(self.stories) + 1
+ item_id = self._current_item_id or f"unknown-{rank}"
+ hn_url = f"https://news.ycombinator.com/item?id={item_id}"
+ self._latest_story = {
+ "title": title,
+ "url": _absolute_hn_url(self._current_href),
+ "hn_url": hn_url,
+ "points": 0,
+ "comments": 0,
+ "rank": rank,
+ }
+ self.stories.append(self._latest_story)
+ self._current_item_id = ""
+ self._current_href = ""
+ self._current_text = []
+ elif tag == "span" and self._in_title:
+ self._in_title = False
+ elif tag == "span" and self._in_score:
+ score_text = "".join(self._current_text)
+ if self._latest_story is not None:
+ self._latest_story["points"] = _first_int(score_text)
+ self._in_score = False
+ self._current_text = []
+ elif self._in_subtext and tag == "a":
+ if self._latest_story is not None and "comment" in self._subtext_link_text:
+ self._latest_story["comments"] = _first_int(self._subtext_link_text)
+ elif tag == "span" and self._in_subtext:
+ self._in_subtext = False
+
+ def handle_data(self, data: str) -> None:
+ if self._current_href or self._in_score:
+ self._current_text.append(data)
+ if self._in_subtext:
+ self._subtext_link_text += data
+
+
+def _absolute_hn_url(url: str) -> str:
+ if url.startswith("item?id="):
+ return f"https://news.ycombinator.com/{url}"
+ if url.startswith("http"):
+ return url
+ return f"https://news.ycombinator.com/{url.lstrip('/')}"
+
+
+def _first_int(text: str) -> int:
+ match = re.search(r"\d+", text)
+ return int(match.group()) if match else 0
+
+
+def _keyword_hits(title: str) -> set[str]:
+ normalized = re.sub(r"[^a-z0-9]+", " ", title.lower())
+ return {keyword for keyword in AGENT_KEYWORDS if keyword in normalized}
+
+
+def _is_noise(title: str) -> bool:
+ lowered = title.lower()
+ return any(noise in lowered for noise in NOISE_WORDS)
+
+
+def _score_story(story: Story) -> float:
+ keyword_score = len(_keyword_hits(story.title)) * 16
+ discussion_score = min(story.comments, 150) / 3
+ points_score = min(story.points, 500) / 10
+ freshness_score = max(0, 35 - story.rank)
+ return keyword_score + discussion_score + points_score + freshness_score
+
+
+def _summarize_story(story: Story) -> str:
+ hits = sorted(_keyword_hits(story.title))
+ if hits:
+ signal = ", ".join(hits[:3])
+ return f"Strong Hacker News signal around {signal}; review for architecture, tooling, or workflow ideas."
+ return "Useful background item for agent builders; monitor discussion before promoting it to the daily brief."
+
+
+def sample_stories() -> list[Story]:
+ """Deterministic demo data used when live Hacker News mode is disabled."""
+
+ return [
+ Story(
+ title="Show HN: An open-source framework for reliable AI agent workflows",
+ url="https://example.com/reliable-agent-workflows",
+ hn_url="https://news.ycombinator.com/item?id=40100001",
+ points=428,
+ comments=116,
+ rank=1,
+ summary="Framework discussion with practical tradeoffs around orchestration, retries, state, and tool execution.",
+ ),
+ Story(
+ title="Model Context Protocol adoption in developer tools",
+ url="https://example.com/mcp-developer-tools",
+ hn_url="https://news.ycombinator.com/item?id=40100002",
+ points=312,
+ comments=84,
+ rank=4,
+ summary="MCP is becoming a shared integration surface for coding assistants and internal tools.",
+ ),
+ Story(
+ title="Lessons from running coding agents on production repositories",
+ url="https://example.com/coding-agents-production",
+ hn_url="https://news.ycombinator.com/item?id=40100003",
+ points=256,
+ comments=73,
+ rank=8,
+ summary="Operational report on code review loops, test gates, sandboxing, and human approval boundaries.",
+ ),
+ Story(
+ title="Why long-running automation needs better human handoff states",
+ url="https://example.com/automation-handoff-states",
+ hn_url="https://news.ycombinator.com/item?id=40100004",
+ points=184,
+ comments=41,
+ rank=12,
+ summary="Product and systems perspective on when always-on agents should pause, escalate, or summarize.",
+ ),
+ Story(
+ title="A lightweight eval harness for tool-using LLM applications",
+ url="https://example.com/tool-using-evals",
+ hn_url="https://news.ycombinator.com/item?id=40100005",
+ points=141,
+ comments=29,
+ rank=17,
+ summary="Practical eval design for agents that call tools and produce user-facing artifacts.",
+ ),
+ ]
+
+
+def fetch_hn_front_page(timeout_seconds: int = 15) -> list[Story]:
+ """Fetch and parse current Hacker News front-page stories."""
+
+ request = urllib.request.Request(
+ "https://news.ycombinator.com/news",
+ headers={"User-Agent": "AgentScout ambient demo"},
+ )
+ try:
+ with urllib.request.urlopen(request, timeout=timeout_seconds) as response:
+ markup = response.read().decode("utf-8", errors="replace")
+ except urllib.error.URLError as exc:
+ raise RuntimeError(f"Could not fetch Hacker News: {exc}") from exc
+
+ parser = HNFrontPageParser()
+ parser.feed(markup)
+ stories: list[Story] = []
+ for raw_story in parser.stories:
+ story = Story(
+ title=str(raw_story["title"]),
+ url=str(raw_story["url"]),
+ hn_url=str(raw_story["hn_url"]),
+ points=int(raw_story["points"]),
+ comments=int(raw_story["comments"]),
+ rank=int(raw_story["rank"]),
+ summary="",
+ )
+ stories.append(
+ Story(
+ title=story.title,
+ url=story.url,
+ hn_url=story.hn_url,
+ points=story.points,
+ comments=story.comments,
+ rank=story.rank,
+ summary=_summarize_story(story),
+ )
+ )
+ return stories
+
+
+def curate_stories(
+ *,
+ live: bool | None = None,
+ top_n: int = 5,
+) -> list[Story]:
+ """Select the highest-signal agent-building stories."""
+
+ if live is None:
+ live = os.environ.get("AGENTSCOUT_LIVE_HN", "").lower() in {"1", "true", "yes"}
+
+ stories = fetch_hn_front_page() if live else sample_stories()
+ candidates = [
+ story
+ for story in stories
+ if not _is_noise(story.title)
+ and (_keyword_hits(story.title) or "agent" in story.summary.lower())
+ ]
+ return sorted(candidates, key=_score_story, reverse=True)[:top_n]
+
+
+def render_brief(
+ stories: list[Story],
+ *,
+ watch_mode: str = "sample",
+ now: dt.datetime | None = None,
+) -> Brief:
+ """Render a Hacker News daily brief in text and HTML."""
+
+ now = now or dt.datetime.now(PACIFIC)
+ date_label = now.strftime("%Y-%m-%d")
+ subject = f"AgentScout Hacker News brief - {date_label}"
+ next_actions = [
+ "Open the highest-comment thread and extract objections or implementation patterns.",
+ "Promote only stories with clear engineering signal to the team digest.",
+ "If this is running on a schedule, send the brief after human-readable rendering succeeds.",
+ ]
+
+ text_lines = [
+ "AgentScout Hacker News Engineering Brief",
+ f"Generated: {now.isoformat(timespec='seconds')}",
+ f"Watch mode: {watch_mode}",
+ "",
+ "Highest-signal agent-building stories:",
+ ]
+ html_lines = [
+ "<h2>AgentScout Hacker News Engineering Brief</h2>",
+ f"<p><strong>Generated:</strong> {html.escape(now.isoformat(timespec='seconds'))}<br>",
+ f"<strong>Watch mode:</strong> {html.escape(watch_mode)}</p>",
+ "<ol>",
+ ]
+
+ for index, story in enumerate(stories, start=1):
+ signal = f"{story.points} points, {story.comments} comments, front-page rank {story.rank}"
+ text_lines.extend(
+ [
+ f"{index}. {story.title}",
+ f" Why it matters: {story.summary}",
+ f" Signal: {signal}",
+ f" Link: {story.url}",
+ f" HN: {story.hn_url}",
+ "",
+ ]
+ )
+ html_lines.extend(
+ [
+ "<li>",
+ f"<strong>{html.escape(story.title)}</strong>",
+ f"<p>{html.escape(story.summary)}</p>",
+ f"<p><strong>Signal:</strong> {html.escape(signal)}<br>",
+ f'<a href="{html.escape(story.url)}">source</a> | ',
+ f'<a href="{html.escape(story.hn_url)}">HN discussion</a></p>',
+ "</li>",
+ ]
+ )
+
+ if not stories:
+ text_lines.append("No high-signal agent-building stories found.")
+ html_lines.append("<li>No high-signal agent-building stories found.</li>")
+
+ text_lines.extend(["Next actions:", *[f"- {action}" for action in next_actions]])
+ html_lines.extend(
+ [
+ "</ol>",
+ "<h3>Next actions</h3>",
+ "<ul>",
+ *[f"<li>{html.escape(action)}</li>" for action in next_actions],
+ "</ul>",
+ ]
+ )
+ return Brief(
+ generated_at=now.isoformat(timespec="seconds"),
+ watch_mode=watch_mode,
+ subject=subject,
+ text="\n".join(text_lines),
+ html="\n".join(html_lines),
+ stories=stories,
+ next_actions=next_actions,
+ )
+
+
+def run_ambient_scout(*, live: bool | None = None, top_n: int = 5) -> dict[str, Any]:
+ """Run the complete Hacker News briefing pipeline."""
+
+ stories = curate_stories(live=live, top_n=top_n)
+ inferred_live = live
+ if inferred_live is None:
+ inferred_live = os.environ.get("AGENTSCOUT_LIVE_HN", "").lower() in {
+ "1",
+ "true",
+ "yes",
+ }
+ brief = render_brief(stories, watch_mode="live_hn" if inferred_live else "sample")
+ payload = brief.to_dict()
+ payload["delivery_note"] = (
+ "This demo renders the Hacker News digest and handoff text. Wire the "
+ "returned text/html to your email, Slack, or ticketing sender when you deploy it."
+ )
+ return payload
diff --git a/always_on_agents/always_on_hn_briefing_agent/tests/eval/eval_config.yaml b/always_on_agents/always_on_hn_briefing_agent/tests/eval/eval_config.yaml
new file mode 100644
index 00000000..721554b0
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/tests/eval/eval_config.yaml
@@ -0,0 +1,20 @@
+eval_set_id: agent_scout_ambient_brief
+name: AgentScout ambient agent eval prompts
+description: Prompts for checking that AgentScout behaves like a scouting and handoff agent.
+eval_cases:
+ - name: daily_brief
+ prompt: Give me today's ambient AgentScout brief.
+ expected_behavior:
+ - Calls preview_agent_builder_brief.
+ - Returns ranked stories with engineering relevance.
+ - Includes concise next actions.
+ - name: top_three
+ prompt: Scout for the top 3 agent-builder stories and explain why they matter.
+ expected_behavior:
+ - Requests three stories from the scouting tool.
+ - Explains signal instead of dumping links only.
+ - name: no_false_delivery
+ prompt: Send this to the team.
+ expected_behavior:
+ - Does not claim to send email or Slack.
+ - Provides handoff-ready text or HTML payload.
diff --git a/always_on_agents/always_on_hn_briefing_agent/tests/unit/test_scheduler_api.py b/always_on_agents/always_on_hn_briefing_agent/tests/unit/test_scheduler_api.py
new file mode 100644
index 00000000..b6ddf1ef
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/tests/unit/test_scheduler_api.py
@@ -0,0 +1,51 @@
+import base64
+import json
+
+from fastapi.testclient import TestClient
+
+from always_on_hn_briefing_agent.scheduler_api import app, run_scheduled_scout
+
+
+def test_scheduled_scout_defaults_to_dry_run():
+ result = run_scheduled_scout({"top_n": 2})
+
+ assert result["dry_run"] is True
+ assert result["delivery"]["status"] == "dry_run"
+ assert len(result["brief"]["stories"]) == 2
+
+
+def test_trigger_endpoint_accepts_scheduler_payload():
+ client = TestClient(app)
+
+ response = client.post(
+ "/agent-scout/trigger",
+ json={"dry_run": True, "top_n": 1, "live": False},
+ )
+
+ assert response.status_code == 200
+ payload = response.json()
+ assert payload["dry_run"] is True
+ assert len(payload["brief"]["stories"]) == 1
+
+
+def test_pubsub_endpoint_decodes_scheduler_message():
+ client = TestClient(app)
+ message = base64.b64encode(
+ json.dumps({"dry_run": True, "top_n": 1, "live": False}).encode("utf-8")
+ ).decode("ascii")
+
+ response = client.post("/agent-scout/pubsub", json={"message": {"data": message}})
+
+ assert response.status_code == 200
+ payload = response.json()
+ assert payload["top_n"] == 1
+ assert payload["delivery"]["status"] == "dry_run"
+
+
+def test_trigger_endpoint_tolerates_empty_body():
+ client = TestClient(app)
+
+ response = client.post("/agent-scout/trigger")
+
+ assert response.status_code == 200
+ assert response.json()["delivery"]["status"] == "dry_run"
diff --git a/always_on_agents/always_on_hn_briefing_agent/tests/unit/test_scout.py b/always_on_agents/always_on_hn_briefing_agent/tests/unit/test_scout.py
new file mode 100644
index 00000000..4262c222
--- /dev/null
+++ b/always_on_agents/always_on_hn_briefing_agent/tests/unit/test_scout.py
@@ -0,0 +1,42 @@
+import datetime as dt
+
+from always_on_hn_briefing_agent.scout import (
+ AGENT_KEYWORDS,
+ PACIFIC,
+ curate_stories,
+ render_brief,
+ run_ambient_scout,
+)
+
+
+def test_curate_stories_returns_ranked_agent_signals():
+ stories = curate_stories(live=False, top_n=3)
+
+ assert len(stories) == 3
+ assert stories[0].points >= stories[-1].points
+ assert all(
+ any(keyword in f"{story.title} {story.summary}".lower() for keyword in AGENT_KEYWORDS)
+ for story in stories
+ )
+
+
+def test_render_brief_includes_text_html_and_next_actions():
+ stories = curate_stories(live=False, top_n=2)
+ now = dt.datetime(2026, 6, 8, 9, 0, tzinfo=PACIFIC)
+
+ brief = render_brief(stories, watch_mode="sample", now=now)
+
+ assert brief.subject == "AgentScout Hacker News brief - 2026-06-08"
+ assert "AgentScout Hacker News Engineering Brief" in brief.text
+ assert "<ol>" in brief.html
+ assert len(brief.next_actions) == 3
+
+
+def test_run_ambient_scout_returns_delivery_handoff_payload():
+ payload = run_ambient_scout(live=False, top_n=1)
+
+ assert payload["watch_mode"] == "sample"
+ assert payload["stories"]
+ assert "text" in payload
+ assert "html" in payload
+ assert "delivery_note" in payload