AI Daily Digest

Selected Build · Automation & AI

AI Daily Digest

A personal daily digest that aggregates news, weather, sports, entertainment, and health data into a single mobile-friendly HTML email. A Python orchestrator calls six source modules that draw on eight external providers, the modules that need an LLM call it themselves, and the result lands in my inbox every morning — running locally or as a scheduled AWS Lambda.

Python AWS Lambda EventBridge OpenAI OpenAI Agents SDK Serper Tavily S3 cache Gmail SMTP
6
Source modules, 8 external providers
Daily
Scheduled by EventBridge
1
Mobile-friendly email out
90d
Of health history analysed

What it does

Every morning the app assembles a personal briefing and emails it as a single, clean HTML message. Each section comes from a dedicated module so sources can be added or swapped without touching the others:

Same code, two homes: the exact same orchestrator runs locally with python main.py or as an AWS Lambda triggered by EventBridge on a daily schedule — with a lambda_handler() entry point and S3 holding state between runs.

Architecture

main.py is the orchestrator: it calls each source module, then assembles and renders the email in plain Python and sends it. Modules are independent and fail soft, so one flaky API doesn't sink the whole digest. A failure while sending the mail does fail the run.

flowchart TD
    accTitle: Daily Digest architecture
    accDescr {
        EventBridge triggers main.py on a daily schedule. main.py calls six source modules and gets their results back: news.py (Serper, or an OpenAI fallback), weather.py (NWS and Open-Meteo), sports.py (CricAPI and RSS feeds, no LLM), rugby.py (OpenAI hosted web search), movies.py (Tavily) and oura_pull.py (Oura API, with an S3-backed smart_cache.py). The modules that use an LLM (news, weather, rugby, movies and the Oura analysis) call it themselves; there is no central LLM step. main.py then renders the HTML and plain-text email in plain Python. An optional AI validator checks the rendered email, advisory only, and the email always sends through Gmail SMTP.
    }
    EB[EventBridge
daily schedule] --> M M[main.py
orchestrator] M <--> N[news.py
Serper or OpenAI fallback
uses LLM] M <--> W[weather.py
NWS + Open-Meteo
uses LLM] M <--> S[sports.py
CricAPI + RSS
no LLM] M <--> R[rugby.py
OpenAI hosted web search
uses LLM] M <--> MV[movies.py
Tavily
uses LLM] M <--> O[oura_pull.py
Oura API
uses LLM analysis] O <--> SC[smart_cache.py
S3-backed cache] M --> H[render HTML + plain-text email
plain Python] H --> V[AI validator
advisory only] V --> G[Gmail SMTP send] classDef llm fill:#fef3c7,stroke:#d97706,color:#000 class N,W,R,MV,O,V llm

Six source modules report back to the orchestrator, which renders the email in plain Python; the modules that need an LLM call it themselves, and an advisory validator checks the result before send.

Data sources

Each module owns one topic, and some use more than one API (weather: NWS + Open-Meteo; sports: CricAPI + RSS). Six modules draw on eight external providers: Serper, NWS, Open-Meteo, CricAPI, BBC/ESPN RSS feeds, OpenAI hosted web search, Tavily and Oura. Each returns ready-to-render content to the orchestrator.

ModuleSource / APIProvides
news.pySerper (Google search) while credits last, otherwise an OpenAI fallbackSouth Africa & Amazon news
weather.pyNWS + Open-MeteoUS & international forecasts
sports.pyCricAPI + RSSSA cricket scores + sports feeds
rugby.pyOpenAI hosted web searchSpringboks rugby news
movies.pyTavily searchTop movies & TV shows
oura_pull.pyOura API (analysis cached in S3)Sleep, readiness & activity

Stack & components

Python orchestrator

main.py calls the modules, then sanitises, renders, and sends the email. Token usage is tracked for the direct OpenAI calls, and the Oura analysis keeps its own cost estimate.

AWS Lambda

A lambda_handler() entry point runs the same code in the cloud; it is deployed as a zip package.

EventBridge

A scheduled rule fires the Lambda once a day so the digest arrives without any manual trigger.

OpenAI

LLM calls live inside the modules that need them, mostly gpt-4o-mini via the OpenAI Agents SDK, as agents with tools (the Oura analysis agent has about 11). An optional validator checks the final email's formatting, advisory only.

Amazon S3

Holds state between Lambda runs — cached Oura metrics, analysis, and API usage counters.

Oura + smart cache

Fetches only the days it is missing into an S3 file, analyses the last 90 days, and re-fetches the last few days each run to heal late data, and caches the AI analysis to reduce cost.

Gmail SMTP

Assembles a MIME multipart message, with a plain-text copy alongside the HTML, and delivers the mobile-friendly email to the inbox.

Predictable summaries

Summaries are held to 2-4 sentences and regenerated if they get cut off, so the email stays tidy.

End-to-end run

Schedule fires

EventBridge triggers the Lambda (or a local cron / manual run) once a day to start the digest build.

Fan out to sources

The orchestrator calls each source module — news, weather, sports, rugby, movies, Oura — independently, so a single failing API degrades gracefully instead of breaking the run. A failure sending the mail does fail the run.

Summarise & sanitise

The modules that use an LLM condense noisy content themselves (cricket and RSS use none), with summaries held to 2-4 sentences. Links are relabelled with readable outlet names such as Reuters or News24, and URL and text sanitisers strip tracking params and de-dupe.

Heal & cache health data

Oura history is back-filled around the API's single-day quirk; only missing days are fetched into an S3 file, and the cached analysis means repeat runs don't re-spend tokens.

Render the email

All sections are assembled in plain Python into a mobile-friendly HTML template, with a plain-text copy, and packed into a MIME multipart message. An optional AI pass checks the formatting after rendering; it is advisory only and the email always sends.

Send

The digest goes out via Gmail SMTP and lands in the inbox — one concise briefing instead of a morning of scattered reading.

What it demonstrates