I Built an AI Agent That Reads Release Notes So I Don't Have To
Versions used in this post — read this first: Python 3.12.3 · requests 2.34.2 · google-genai 2.33.0 · Model: gemini-3.6-flash. Everything runs from one file, digest_agent.py, printed in full below — the exact file in the companion repo.
The direct answer
Build an AI agent in Python, step by step, that reads release notes for you. One small Python file is enough to stop reading changelogs by hand. Think of the agent as the smallest useful harness — three steps with a strict contract between them: fetch, summarize, write. It fetches the newest GitHub release of each project it tracks from the project's public releases feed, sends the release notes to Gemini with an instruction to return three summary bullets plus any breaking changes as JSON, and writes one Markdown file: digest.md, with the breaking changes collected at the top. Schedule it for 7:15 every morning and yesterday's releases are a one-page read with your coffee. No GitHub account, no token, no framework — the only credential is a Gemini API key, and the free tier covers this easily.
What you will build
- A feed fetcher — reads
https://github.com/<owner>/<repo>/releases.atomfor CPython, FastAPI, and the Azure CLI. The first entry in a releases feed is the newest published release. Feeds are public web pages, so nothing here touches the GitHub REST API and its 60-requests-per-hour unauthenticated limit. - A summariser — one function that strips the notes' HTML to text, truncates anything very long, and asks Gemini for exactly three bullets and a breaking-changes list, as JSON.
- A digest writer — assembles
digest.md: a dated header, a ⚠ Breaking changes section across all projects, one section per project (version, date, bullets, link), and a footer with the run's real token counts and estimated cost. - A schedule — the same script run daily by Windows Task Scheduler or cron (both shown below).
Two design choices are deliberate. The agent reads feeds, not the API: simpler, unauthenticated, and nothing to rate-limit at three projects a day. And it has no memory: it always summarises the newest release in each feed, whether or not you read yesterday's digest. Remembering where it left off is the first upgrade, listed at the end.
Environment setup — do this first
Prerequisites: Python 3.10 or newer (this post uses 3.12.3), a terminal, and a Gemini API key. The free tier is enough; no card is needed.
Get your Gemini API key, click by click:
- Go to aistudio.google.com and sign in with a Google account.
- Click Get API key in the left sidebar (the key icon).
- Click Create API key, choose or create a Google Cloud project when asked, and click Create.
- Copy the key that appears — it stays visible in that same key list.
- Keep it secret like a password: never paste it into code, a screenshot, or a public repository. This agent reads it only from an environment variable.
Create the project and install the pinned dependencies:
mkdir release-digest && cd release-digest
python3 -m venv .venv && source .venv/bin/activate
# Windows PowerShell: py -m venv .venv ; .venv\Scripts\Activate.ps1
pip install requests==2.34.2 google-genai==2.33.0(The code goes in this folder as digest_agent.py — it is printed in full in the steps below, and the companion repo has it as a ready-made file.)
Set the key, then verify the setup:
export GEMINI_API_KEY=<redacted>
# Windows PowerShell: $env:GEMINI_API_KEY=<redacted>
python -c "import requests, google.genai; print('setup ok')"If that prints setup ok, the environment is ready. Every error the run itself can throw is listed in "Errors you may hit" near the end.
Step 1 — Config, data shapes, and stripping the HTML
The top of the file is everything you are allowed to tweak: the model name as one constant (you will see why in the errors section), the list of projects to watch, the feed URL pattern, and the published per-token rates the cost footer uses. Below that, two small dataclasses — Release (what a feed hands us) and Summary (what the model hands back) — and a minimal HTML-to-text converter, because feed content arrives as HTML and Gemini should read words, not markup.
"""Release-notes digest agent: read the changelogs so you don't have to.
Companion code for the Visual Studio Learn post and video
"I Built an AI Agent That Reads Release Notes So I Don't Have To".
Once a run, the agent fetches the latest GitHub release of each project
in PROJECTS below, asks Gemini to summarise the release notes in three
bullets and flag anything breaking, and writes one Markdown digest
(digest.md) with a breaking-changes section at the top.
Requires: Python 3.10 or newer, the packages in requirements.txt, and a
Gemini API key in the GEMINI_API_KEY environment variable. See README.md.
"""
import json
import logging
import os
import sys
import xml.etree.ElementTree as ET
from dataclasses import dataclass, field
from datetime import date
from html.parser import HTMLParser
import requests
from google import genai
logger = logging.getLogger("digest_agent")
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
MODEL = "gemini-3.6-flash"
# The projects to watch: (display name, GitHub "owner/repo"). Add or
# remove lines here — nothing else in the file needs to change.
PROJECTS = [
("CPython", "python/cpython"),
("FastAPI", "tiangolo/fastapi"),
("Azure CLI", "Azure/azure-cli"),
]
FEED_URL = "https://github.com/{repo}/releases.atom"
USER_AGENT = "release-digest-agent/1.0 (Visual Studio Learn tutorial)"
FETCH_TIMEOUT_SECONDS = 30
MAX_NOTES_CHARS = 12_000 # truncate very long notes before the model call
# Published pay-as-you-go rates for gemini-3.6-flash, US$ per 1M tokens.
INPUT_RATE_PER_MILLION = 0.75
OUTPUT_RATE_PER_MILLION = 3.75
OUTPUT_FILE = "digest.md"
ATOM = {"a": "http://www.w3.org/2005/Atom"}
# Tags that mean "new line" when release-note HTML is flattened to text.
BLOCK_TAGS = {"p", "br", "div", "li", "ul", "ol", "h1", "h2", "h3", "h4", "pre", "tr"}@dataclass
class Release:
"""The latest release of one project, as published in its feed."""
project: str
title: str # feed title, e.g. "v3.13.18" or "Azure CLI 2.91.0"
published: str # ISO date from the feed, e.g. "2026-10-25"
url: str
notes: str # release notes as plain text (HTML already stripped)
@dataclass
class Summary:
"""Gemini's reading of one release, plus what the call cost."""
bullets: list[str] = field(default_factory=list)
breaking: list[str] = field(default_factory=list)
input_tokens: int = 0
output_tokens: int = 0
class _TextExtractor(HTMLParser):
"""Minimal HTML-to-text: keep the words, drop the markup."""
def __init__(self) -> None:
super().__init__()
self.parts: list[str] = []
def handle_starttag(self, tag, attrs):
if tag in BLOCK_TAGS:
self.parts.append("\n")
def handle_data(self, data):
self.parts.append(data)
def html_to_text(html: str) -> str:
"""Flatten release-note HTML to readable plain text."""
extractor = _TextExtractor()
extractor.feed(html)
lines = (line.strip() for line in "".join(extractor.parts).splitlines())
return "\n".join(line for line in lines if line)Step 2 — Fetch the newest release from the feed
One function per project: GET the feed with a polite user agent and a timeout, parse the XML, take the first entry, and flatten its HTML body to text. raise_for_status() means a dead or renamed repo fails loudly in the log instead of producing a quietly empty digest.
def fetch_latest_release(project: str, repo: str) -> Release:
"""Fetch the newest entry of a project's GitHub releases Atom feed.
The feed lists the 10 most recently published releases; the first
entry is the newest. No GitHub account or token is needed — the
feed is a public web page, not the rate-limited REST API.
"""
url = FEED_URL.format(repo=repo)
logger.info("Fetching %s", url)
response = requests.get(
url, headers={"User-Agent": USER_AGENT}, timeout=FETCH_TIMEOUT_SECONDS
)
response.raise_for_status()
root = ET.fromstring(response.content)
entry = root.find("a:entry", ATOM)
if entry is None:
raise ValueError(f"{repo}: the releases feed has no entries")
title = entry.findtext("a:title", default="", namespaces=ATOM).strip()
updated = entry.findtext("a:updated", default="", namespaces=ATOM)
link = entry.find("a:link", ATOM)
content = entry.find("a:content", ATOM)
notes_html = content.text if content is not None and content.text else ""
return Release(
project=project,
title=title,
published=updated[:10],
url=link.get("href", "") if link is not None else "",
notes=html_to_text(notes_html),
)Step 3 — Ask Gemini for bullets and breaking changes
This is the only function that talks to the model, and its contract is strict: work only from the notes text provided, return JSON and nothing else — exactly three summary bullets, plus a list of changes that could break existing code, config, or command lines. Two honesty guards live here. If a release ships with no notes at all, the function returns a line saying so without spending a model call. And if the model's answer is not the expected JSON, the code keeps the raw text as a single bullet and logs a warning, rather than crashing the morning run.
def summarize_release(client: genai.Client, release: Release) -> Summary:
"""Ask Gemini for three bullets and any breaking changes in a release.
The model only ever sees the notes text fetched above — it is told
to work from that text alone and to say so when the notes are thin.
Its answer comes back as JSON and is parsed defensively.
"""
if not release.notes.strip():
# Nothing to summarise: don't spend a model call on an empty page.
logger.info("%s: no release notes published — skipping the model call",
release.project)
return Summary(bullets=["No release notes were published with this release."])
prompt = f"""You are summarising a software release for a working developer.
Project: {release.project}
Release: {release.title} ({release.published})
Release notes (plain text, converted from the project's own feed):
---
{release.notes[:MAX_NOTES_CHARS]}
---
Answer with ONLY a JSON object, no markdown fences, in exactly this shape:
{{"summary": ["bullet", "bullet", "bullet"],
"breaking": ["one line per breaking change, or empty list"]}}
Rules:
- "summary" is exactly 3 short bullets, based only on the notes above.
- If the notes contain no real change details, say that honestly in one
bullet instead of inventing changes.
- "breaking" lists only changes that could break existing code, config,
or command lines — behaviour changes count. Ignore download hashes,
links, and housekeeping.
""" response = client.models.generate_content(model=MODEL, contents=prompt)
usage = response.usage_metadata
text = (response.text or "").strip()
if text.startswith("```"): # strip code fences if the model adds them
text = text.strip("`")
text = text[text.find("{"):]
try:
data = json.loads(text)
bullets = [str(b) for b in data.get("summary", [])][:3]
breaking = [str(b) for b in data.get("breaking", [])]
except (json.JSONDecodeError, AttributeError):
logger.warning("%s: model answer was not the expected JSON; "
"keeping the raw text as a single bullet", release.project)
bullets = [text] if text else ["The model returned an empty answer."]
breaking = []
return Summary(
bullets=bullets,
breaking=breaking,
input_tokens=usage.prompt_token_count or 0,
output_tokens=usage.candidates_token_count or 0,
)
def estimate_cost(input_tokens: int, output_tokens: int) -> float:
"""Estimated US$ cost of the run at the published per-token rates."""
return (
input_tokens * INPUT_RATE_PER_MILLION
+ output_tokens * OUTPUT_RATE_PER_MILLION
) / 1_000_000Step 4 — Assemble the digest and run
build_digest puts the breaking changes first — across every project — because that is the section that decides whether today is a reading day or an upgrading day. main loops the projects, and a failure in one (a feed down, a repo renamed) is logged and skipped, not fatal: a digest with two of three projects beats no digest. Only if every project fails does the run exit without writing a file.
def build_digest(entries: list[tuple[Release, Summary]]) -> str:
"""Assemble the one-page Markdown digest from all summaries."""
today = date.today().strftime("%A, %B %d, %Y")
total_in = sum(s.input_tokens for _, s in entries)
total_out = sum(s.output_tokens for _, s in entries)
lines = [f"# Release Digest — {today}", ""]
breaking_lines = [
f"- **{release.project} {release.title}** — {item}"
for release, summary in entries
for item in summary.breaking
]
lines += ["## ⚠ Breaking changes", ""]
lines += breaking_lines or ["None flagged in this run."]
lines.append("")
for release, summary in entries:
lines += [
f"## {release.project} — {release.title}",
"",
f"Released: {release.published} · [Release notes]({release.url})",
"",
]
lines += [f"- {bullet}" for bullet in summary.bullets]
lines.append("")
lines += [
"---",
f"*Generated by digest_agent.py · Model: {MODEL} · "
f"Tokens: {total_in:,} in / {total_out:,} out · "
f"Estimated cost: ${estimate_cost(total_in, total_out):.6f}*",
]
return "\n".join(lines) + "\n"def main() -> int:
api_key = os.environ.get("GEMINI_API_KEY")
if not api_key:
logger.error("GEMINI_API_KEY is not set. Get a key in Google AI "
"Studio and set it in the environment — see README.md.")
return 1
client = genai.Client(api_key=api_key)
entries: list[tuple[Release, Summary]] = []
failures = 0
for project, repo in PROJECTS:
try:
release = fetch_latest_release(project, repo)
entries.append((release, summarize_release(client, release)))
logger.info("%s: %s (%s)", project, release.title, release.published)
except Exception:
failures += 1
logger.exception("%s: fetch or summary failed — continuing "
"with the remaining projects", project)
if not entries:
logger.error("Every project failed; no digest written.")
return 1
with open(OUTPUT_FILE, "w", encoding="utf-8") as fh:
fh.write(build_digest(entries))
logger.info("Wrote %s (%d project(s), %d failure(s))",
OUTPUT_FILE, len(entries), failures)
return 0
if __name__ == "__main__":
sys.exit(main())Step 5 — Run it, and read the digest
python digest_agent.pyThe log shows each feed fetched and each release found, and the run writes digest.md in the same folder. When this post was prepared (Sunday, October 25, 2026), the three feeds' newest releases were CPython v3.13.18 (published that same day), FastAPI 0.162.0 (October 23), and Azure CLI 2.91.0 (October 5) — the agent re-fetches on every run, so your digest always carries whatever is newest that morning.
Two of the three feeds teach an honest lesson about release notes. CPython's GitHub release body is a one-liner ("Python 3.15.2") — its real changelog lives on docs.python.org — and the Azure CLI's body is mostly a link to its full notes page plus download hashes. The prompt tells Gemini to say so instead of inventing changes, and to ignore hashes; the summaries for those two are thin because the notes are thin, and the digest does not pretend otherwise.
Here is the complete digest.md from the live production run of this exact file, made on Monday, October 26, 2026 — real Gemini bullets, a real breaking-change flag, and the run's real token counts in the footer. One change from prep is visible in it: the CPython feed's newest entry had advanced to v3.15.2 (published October 25, after the prep fetch), while FastAPI and Azure CLI stood still — the feed reports what was published last, and the digest prints it as-is:
# Release Digest — Monday, October 26, 2026
## ⚠ Breaking changes
- **FastAPI 0.162.0** — FastAPI no longer infers False for omitted boolean form fields; unsubmitted fields without a default will now raise a missing-field error instead of evaluating to False.
## CPython — v3.15.2
Released: 2026-10-25 · [Release notes](https://github.com/python/cpython/releases/tag/v3.15.2)
- Python 3.15.2 release announced on 2026-10-25.
- The provided release notes contain no detailed changelog or change descriptions.
- No specific features, bug fixes, or updates were documented in the notes.
## FastAPI — 0.162.0
Released: 2026-10-23 · [Release notes](https://github.com/fastapi/fastapi/releases/tag/0.162.0)
- Omitted bool and bool | None form fields now use declared defaults or raise missing-field errors instead of automatically inferring False.
- Applies across individual form parameters, form models, and form model unions, bringing behavior in line with standard Pydantic logic.
- Omitted boolean fields are now excluded from model_dump(exclude_unset=True) and no longer count as submitted fields during union selection.
## Azure CLI — Azure CLI 2.91.0
Released: 2026-10-05 · [Release notes](https://github.com/Azure/azure-cli/releases/tag/azure-cli-2.91.0)
- The release notes contain no detailed change log or feature notes.
- Checksums (SHA256) are provided for official Linux, macOS, and Windows release artifacts.
- Artifacts cover arm64 and x86_64 architectures along with MSI and ZIP packages.
---
*Generated by digest_agent.py · Model: gemini-3.6-flash · Tokens: 1,313 in / 252 out · Estimated cost: $0.001930*Scheduling it daily
Windows — Task Scheduler: Create Basic Task → Daily, your morning time → Action: Start a program → Program: C:\path\to\release-digest\.venv\Scripts\python.exe, Arguments: digest_agent.py, Start in: C:\path\to\release-digest. Set GEMINI_API_KEY once as a user environment variable (Settings → Environment Variables) — the scheduled task does not inherit your open PowerShell window's variables.
macOS / Linux — cron:
15 7 * * * cd /path/to/release-digest && GEMINI_API_KEY=<redacted> .venv/bin/python digest_agent.py >> digest.log 2>&1(On a shared machine, keep the key in a protected file or secret store rather than the crontab.)
Errors you may hit
GEMINI_API_KEY is not set— the agent stops before doing any work. The variable must exist in the same shell (or scheduled environment) that runs the script; setting it in one terminal does not set it in another, and Task Scheduler tasks never see your interactive shell's variables.- A 404 naming the model — "
gemini-…is no longer available to new users" — Google retires model names for new API keys first: the model can be listed in the docs and still refuse a fresh key. This exact error is why the model is a single constant at the top of the file. Verified example:gemini-2.5-flashreturned it to newly created keys in October 2026. Fix: open Google's models page, take the current Flash model it names, updateMODEL. This post pinsgemini-3.6-flash, verified current and stable in Google's docs on October 26, 2026 — the pin moved fromgemini-3.8-flashduring production, for the reason in the 503 entry below. - 429 / quota errors from Gemini — the free tier has request limits; three small summaries a day sit far below them, but a brand-new key can be throttled and heavy same-day experimenting adds up. Wait for the daily reset, or enable billing.
- 503 UNAVAILABLE — "The model is currently experiencing high demand" — the model itself is temporarily overloaded; this is not your key, your code, or your quota. This exact error shaped this post: during production on October 26, 2026,
gemini-3.8-flashreturned 503s (and quota 429s under retry load) across ten runs of this exact file, completing only single-project digests. The fix applied is the one the file is designed for — the pin moved togemini-3.6-flash, one constant, identical published rates — and the unchanged-everything-else file completed the full capture the same day. For a scheduled daily job the softer fix also works: wait, and let the next run try again. - One project logs "fetch or summary failed" but the run completes — that feed was unreachable, the repo was renamed, or the feed returned no entries. A renamed repo empties its old feed; update the path in
PROJECTS. - The ⚠ section says "None flagged in this run" — that is a result, not an error: the model found nothing in the notes that could break existing code. Skim the bullets before trusting it.
- Oddly thin bullets for CPython or the Azure CLI — expected (see Step 5): their GitHub bodies carry almost no prose. The agent summarises the feed it is given, no more.
- Digest shows an older version line than you expected — feeds order by publish time, not version number. On October 25, 2026, CPython published several releases the same day — security fixes for older branches (v3.13.18 among them) and v3.15.2 on the current line; the digest's CPython line is whichever was published last — v3.15.2 — not the day's highest-profile release. The digest always prints the version and date so the ordering is visible, and for a "what shipped most recently" digest that ordering is the honest one.
Where to go next
Three upgrades, in the order a daily tool earns them: memory (a small state file recording the last release seen per project, so the agent only summarises what is actually new and can say "nothing new today"), delivery (mail or message the digest to yourself instead of leaving it as a file — the agent from Topic #1 has the tool-calling pattern for it), and more sources (any GitHub project is one line in PROJECTS; projects that publish proper changelogs — frameworks, CLIs, SDKs — digest best). Previous in this series of agent builds: Topic #1's tool-calling agent and Topic #2's MCP server; the PDF Q&A app (Small AI App #1) is the same Gemini pattern pointed at documents instead of feeds.
Get the code
The complete digest_agent.py, pinned requirements.txt, and this post's setup as a README live in the companion repository:
https://github.com/sajjad037/visual-studio-learn-code/tree/main/topic-04-release-digest
Sources
- CPython releases feed — https://github.com/python/cpython/releases.atom (latest at prep: v3.13.18, 2026-10-25)
- FastAPI releases feed — https://github.com/tiangolo/fastapi/releases.atom (latest at prep: 0.162.0, 2026-10-23)
- Azure CLI releases feed — https://github.com/Azure/azure-cli/releases.atom (latest at prep: Azure CLI 2.91.0, 2026-10-05)
- GitHub REST API rate limits (60 requests/hour unauthenticated, the reason this agent uses feeds) — https://api.github.com/rate_limit and GitHub's API docs
- Gemini models (gemini-3.6-flash listed as Stable) — https://ai.google.dev/gemini-api/docs/models
- Gemini API pricing ($0.75 / $3.75 per 1M tokens for gemini-3.6-flash through Dec 31, 2026) — https://ai.google.dev/gemini-api/docs/pricing
- Package versions — https://pypi.org/project/requests/ (2.34.2), https://pypi.org/project/google-genai/ (2.33.0)
Enjoying these tutorials?
Get new Visual Studio Learn posts by email — free, no spam:
Comments
Post a Comment