Inspiration
Chains win on consistency and lose on feeling local. Head office cannot know 200 neighbourhoods, so every store gets the same specials and the same playlist, while the independent café next door knows its block. We wanted a weekly routine that head office runs on Monday morning, for every store at once, with the reasons for each choice on screen.
What it does
Once a week, for each store in a chain, Local Edition builds an edition from the taste of that store's block:
- Special: one drink or bite, always a variation of an item the chain already sells (read from a Square catalog, a photo of the menu board, or a CSV).
- Sound brief: what to play in the room, with artists that skew local.
- Local partner: a neighbouring place worth a tie-in, with an offer idea.
- Event night: something to host that week, tied to a real local event when one is found.
Every item carries its evidence (source, endpoint, numbers). An item without evidence is dropped, never shown. A Nemotron 3 Ultra reviewer reads the whole chain together and sends back any store whose edition repeats another's. Head office approves on a map of all stores, and each approved edition becomes a one-page staff card with a public link.
Try it in 30 seconds
No account needed (sign-up is free too, with email and password). Open https://localedition.pages.dev and press Try the sample chain. Each visitor gets a private copy of Kettle & Kiln, a sample coffee chain of eight New York stores at real corners. Press Build this week's editions and watch the agent work store by store, with tool calls, models, tokens and cost streaming in. Open any store, open the evidence drawer, press Approve all, then open the staff card. /proof shows what ran, on which model, at what cost, including each NeMo Guardrails job. /limits shows every budget. Spend is capped, so if a build is refused with a budget message, the stored editions and /proof still show every step.
How we built it
Every model call goes to Nebius Token Factory through one OpenAI-compatible client with a spend meter. Each model has one job:
| Model on Token Factory | Its job in Local Edition |
|---|---|
NVIDIA Nemotron 3.5 Super VL (nvidia/Nemotron-3.5-Super-VL) |
Runs the agent loop: plans each store's edition by calling tools (Qloo block profile, nearby places, local artists, brands, what is rising; Tavily events). Also reads a photo of the menu board into structured items. |
NVIDIA Nemotron 3 Ultra (nvidia/Nemotron-3-Ultra-550b-a55b) |
The reviewer: judges every store's edition against the others and asks for a regenerate with a hint. |
NVIDIA Nemotron 3.5 Lightning (nvidia/Nemotron-3_5-Lightning) |
Copy for items and staff cards, triage of Tavily event results, the live guardrail self-check, and sorting store email replies (sold out, sold well, change request, problem, other). |
Qwen3 Embedding 8B (Qwen/Qwen3-Embedding-8B, not an NVIDIA model) |
Matches menu items and nearby places to each block's taste, and finds near-identical items across stores. |
Token Factory features we use: function calling (Super VL calls two tools in one turn with valid arguments), vision input (the menu photo), response_format: json_schema with strict output on all three Nemotrons (so structured steps need no repair path), embeddings, and a system prompt ordered so repeat calls share a prefix for implicit caching. Reasoning is switched per call: copy and classification run with reasoning_effort: "none" plus chat_template_kwargs.enable_thinking: false; the agent loop keeps default reasoning. We also tried /v1/rerank for partner ranking; it returned 404 model_not_found, so ranking uses embedding cosine.
NVIDIA NeMo Guardrails 0.24.1 on a Nebius Serverless Job. One Python job (jobs/, guardrails/; python:3.12-slim on cpu-d3 2vcpu-8gb) runs NeMo Guardrails in two modes: certify checks the week's items with a custom health-and-allergen claim rail, prompt-injection stripping for text taken from web pages, and NeMo's self check output rail on Lightning; eval runs a 50-phrase red-team set. We start it from the CLI on demand with npx tsx scripts/nebius-job.ts certify eval. It is not on a schedule. Secrets go in as injected files, never environment variables; the code ships as one gzipped pack of injected files, so no container image is built; the runner deletes the job afterwards. The job posts signed results back to the app, and /proof lists each run as manual with its Nebius job name. Between job runs, every edit and every build is checked live inside the Worker by a TypeScript mirror of the same claim rails plus the Lightning self-check; those items are marked checkedBy: live.
Tavily finds this week's events near each store (one search, one batched extract, then Lightning triage), cached for 7 days, and crawls the chain's own site to draft its brand voice. Tavily is never called on page load or by regenerate, and one global credit ledger caps it.
Qloo Taste AI supplies the block profile: what the people near each store lean toward, and how that differs from the city. The code calls GET /search, GET /v2/insights, GET /v2/trending and GET /v2/analysis/compare. Only store coordinates, entity ids and tag URNs are sent; no customer or personal data.
Cloudflare runs the app: Next.js on Workers (OpenNext) behind Pages; D1 for data; KV for provider caches; R2 for menu photos; Durable Objects for the spend meter, build lock and call ledgers; Workflows for builds (one retried step per store). A cron (0 0 * * MON, 08:00 Monday in Kuala Lumpur) is registered on the deployed Worker for the weekly rebuild, which runs on Token Factory and Tavily only. The map uses MapLibre with OpenFreeMap tiles, and zod checks every input.
Tests: 1,360 Vitest tests in 115 files (196 of them on the Square, Slack, Gmail/Outlook and calendar code), Playwright end-to-end tests, 115 pytest tests for the NeMo rails and 12 for the job scripts.
Measured
- NeMo Guardrails job
local-edition-certify-eval-202610300615(Nebius Serverless Job, started from the CLI): completed in 257 s (260 s wall, most of it thepip install), exit 0. Certified 5 of 5 pending items as passed. The eval caught 40 of 40 red-team phrases and wrongly blocked 0 of 10 benign ones. Job cost about $0.005; Token Factory spend inside it about $0.0003. Both signed results show on/proofasmanualruns with this job name. - Menu-board read on Super VL, live smoke test of 29 Oct: 22 of 22 items, every name, price and category exact, in 5.3 s.
- One live store build (agent, copy and review): 36 s and $0.0075 on Token Factory. A second build of the same store used 0 Tavily credits (cache).
- One Ultra review: 936 ms, 713 tokens in, 86 out, $0.0008. Its verdict was
needs_changewith the reason "The partner offer includes a discount not supported by the evidence". - Reasoning switch on Lightning: a one-word reply went from 96 completion tokens to 2 with thinking off.
- Whole first live smoke session: about $0.12 on Token Factory at list prices.
- LoRA fine-tune of an NVIDIA open model (Nebius Serverless Job
local-edition-finetune-20261030151856, 1x H100 in eu-north1, 586 s from create to complete, deleted after):nvidia/Llama-3.1-Nemotron-Nano-4B-v1.1(NVIDIA Open Model License plus Llama 3.1 Community License), LoRA r=16, 3 epochs, 44 s of training, learning to write a store's special as strict JSON in the house rules (length limits, staff first-person voice, no health, allergen or superlative claims). Training data: 600 examples written by Nemotron 3 Ultra on Token Factory from structured specs built from the sample chain's own menu, kept only if they passed our rule checker (896 of 900 did); no Qloo or Tavily data. Held out: 120 specs with different menu items and neighbourhoods (0 exact and 0 near duplicates against training). Base zero-shot vs tuned on those 120, same prompt, greedy: all checks pass 30.0% vs 100%; length compliance 38.3% vs 100%; JSON valid 98.3% vs 100%; first-person voice 82.5% vs 100%; rule violations 3.3% (4 of 120) vs 0%. Caveats: most of the gain is length and voice, the base already rarely breaks the claim rules, the checker also filtered the training data, and the tuned model is not yet wired into the app. Cost: at most about $0.73 of GPU time plus about $0.38 of Token Factory data generation.
Dollar figures for Token Factory are tokens at list prices as recorded by our spend meter, not read back from Nebius billing.
Challenges we ran into
- The 9 Nov model removal. Nemotron 3 Super and Nano leave Token Factory before judging, so we built the agent on Nemotron 3.5 Super VL and the copy on Lightning from the first live call, and added Ultra as the reviewer.
- The control plane from Cloudflare. We had written a Worker-side job start (service-account JWT, token exchange, job create, poll, delete). From the deployed Worker, every Nebius AI Cloud control-plane host timed out with a Cloudflare 522, while Token Factory answered from the same Worker. We removed that path before it shipped and moved the start to the CLI. Rather than claim a schedule that does not run, we start the job by hand and say so.
- Reasoning tokens on Lightning. With thinking on, a 20-word copy request ran to 600+ tokens, stopped on
length, and put the thinking incontent. We switch reasoning off per call and measured which switches work. - The injected-files limit. Each job file was under 64 KiB, but together they came to about 74 KB as base64, which Nebius rejects on create (a dry run accepts it). We ship one gzipped pack instead.
- A model vanishing mid-week. On 30 Oct Super VL went missing from Token Factory for a while. A model that disappears now skips its step with a plain note instead of failing the whole run.
- Capacity in launch week. The first calls to Super VL got
529 System is overloadedthree times in a row; later calls took 0.6 to 1 s. The client retries 5xx. - Workers runtime details. The first Tavily prefetch of a week can outlast the agent's 25 s tool timeout; the work still finishes and is cached.
What is real and what is sample data
- Kettle & Kiln is sample data, labelled so in the app. It is a sample chain at real New York street corners. It is not a customer.
- Nemotron, Qwen3 Embedding and Tavily calls are live on the deployed app (Token Factory and Tavily in live mode).
- NeMo Guardrails on Nebius is real and recorded (job above), but it runs only when started from the CLI.
- Qloo is live: since 30 Oct 23:33 MYT the deployed app calls Qloo live (
/api/statusreports qloolive). Every Qloo result on screen comes from a real Qloo call, either live or a cached copy of a live answer (14-day cache, so repeat visits spend nothing), and each evidence row says "Live Qloo call" or "Cached live Qloo answer" with its time. If a Qloo call fails, the screen shows a retry or error state. A capped ledger protects the key (2,000 calls through 15 Dec, 200 a day;/limitsshows the count). The sample chain's editions were rebuilt on live Qloo and reviewed by Nemotron 3 Ultra. Real answers are sparser than a demo would like: items with no Qloo evidence are dropped, so this week several stores have no sound brief and two have no special, listed as coverage gaps on/limits. Real Qloo responses are never committed to the repo. - Some stores show fewer than four items. An item with no evidence is dropped, so in the sample chain some stores have no sound brief or event this week (
/limitslists each one). - Square, Slack and Gmail/Outlook (through Composio) are built and tested against the providers' APIs; live sandbox connection pending (none is connected on the deployed app yet). The calendar feed (a private
.icslink per store) runs today, since it needs no account.
Limits
- A $5 cap on Token Factory spend, enforced in one Durable Object with reserve-then-settle; each visitor workspace gets a $0.40 sub-budget and each network a $0.80 daily cap.
- Qloo: at most 300 live calls in total and 40 a day, reserved before each call, plus a 14-day response cache. Regenerate never reaches Qloo.
- Tavily: one global ledger of 80 credits in total and 10 a day, results cached 7 days; live search is limited to the demo workspace's unmodified sample stores and chain setup.
- Rate limits per workspace and per IP on builds, regenerate, staff cards, edits, menu reads, brand search and brand-voice drafting; at most 60 new workspaces an hour, and workspace data expires.
- The weekly cron does not call Nebius AI Cloud; NeMo Guardrails runs only on demand.
What's next
- Certification on a schedule, from a runner that can reach the Nebius control plane.
- Live Square, Slack and mailbox connections, then email-code sign-in (sign-up is free with email and password today).
- A second Qloo pass with a wider radius when a block returns too few answers, so sparse weeks still get a sound brief.
- More POS systems (Toast, Lightspeed, Clover), each chain's own rebuild day and time, and Square sales per special feeding the next week's edition.
The repository's first commit is 29 Oct 2026; all code was written for this entry. MIT licence.
Built With
- next.js
Log in or sign up for Devpost to join the conversation.