Generation module workflow

The deferred black box, now specified: a Render cron job runs a Python loop every 5 minutes, checks the generation queue, and for each waiting business calls a configured LLM/agent (model-agnostic — no vendor lock) using the ep044_group skill library and the shared image library, then commits the built site to ep_044_web_apps on GitHub and reports completion back. Four prerequisites are genuinely outstanding — three of them are hosting/data gaps found by inspecting the repo, not design choices.

Already built & live-testedTo build (this module)Model-agnostic adapterOutstanding prerequisite

Render cron job — the 5-minute loop

To build

Render Cron Job fires

Every 5 minutes. Cloud-hosted, independent of any laptop or local session.

*/5 * * * *
→
To build

Python loop starts

Single run, exits when done. Container has Python + git.

generate_sites.py
→
Built

Check the queue

GET the queue endpoint; returns 0..n businesses awaiting generation.

GET /api/internal/site-generation/queue
→
Gate

Any waiting?

Empty queue → exit cleanly, no cost incurred. Otherwise iterate one-by-one.

→
To build

Claim the business

Prevents two overlapping 5-minute runs double-generating the same site.

needs a lock field

Inputs the generation step needs

To build

Business data

Name, category, town, contact details — comes back with the queue response.

+
Prerequisite

Skill library access

Tracked in git (35 files) — but the cron container still needs a way to fetch it.

skills/ep044_group
+
Prerequisite

Image library access

Not in git at all. 114 MB / 103 files, local-only. Nothing to fetch yet.

ep_044_web_apps/_images
+
Prerequisite

LLM provider + key

Which provider(s), and a real API key with real per-run billing.

env config
+
Prerequisite

Chat-widget opt-in flag

No column exists on businesses to record who requested a chat widget.

needs migration

Generation and hand-back

Adapter

Model-agnostic adapter

One tool-calling loop; provider chosen by config, not hardcoded. No vendor SDK as the whole solution.

→
To build

Build the site

Agent follows the skill blueprint: writes HTML/CSS/JS, sources and verifies images.

→
To build

Add chat widget (if opted in)

Only for businesses that requested it — reuses the existing embed pattern.

assistant-embed.js
→
Gate

Verify the build

Blueprint's definition of done: every image loads, section counts met, no thin screens.

→
To build

Commit & push

Writes into the existing per-business folder convention; GitHub Pages then serves it.

ep_044_web_apps/<slug>/
→
Built

Report completion

POST businessId + the live URL; advances the stage to ready_for_preview.

POST …/complete
→
Built

Trigger notification

Same run sends any outstanding preview-ready emails. Idempotent.

POST …/notify