GEMINI LABJP
PRO35 — July 17, the date reports had pointed to, has passed without an official Gemini 3.5 Pro announcement or model card. July 24 is being cited as the fallbackNB2LITE — Nano Banana 2 Lite, otherwise known as Gemini 3.1 Flash-Lite Image, arrives as the fastest of the family: roughly four seconds per image at $0.034 per thousandOMNI — Gemini Omni Flash enters public preview, generating video up to ten seconds long at $0.10 per second of outputEDIT — Omni Flash is built around conversational editing. Swap a character, relight a scene, or change the angle in plain language, and the original audio and video tracks stay intactSYNTHID — Both new models carry SynthID watermarking, so anything they produce can be checked for provenance from inside the Gemini appSHUTDOWN — The older image generation models are deprecated and switch off on August 17. Worth checking your migration windowPRO35 — July 17, the date reports had pointed to, has passed without an official Gemini 3.5 Pro announcement or model card. July 24 is being cited as the fallbackNB2LITE — Nano Banana 2 Lite, otherwise known as Gemini 3.1 Flash-Lite Image, arrives as the fastest of the family: roughly four seconds per image at $0.034 per thousandOMNI — Gemini Omni Flash enters public preview, generating video up to ten seconds long at $0.10 per second of outputEDIT — Omni Flash is built around conversational editing. Swap a character, relight a scene, or change the angle in plain language, and the original audio and video tracks stay intactSYNTHID — Both new models carry SynthID watermarking, so anything they produce can be checked for provenance from inside the Gemini appSHUTDOWN — The older image generation models are deprecated and switch off on August 17. Worth checking your migration window
Articles/Advanced
Advanced/2026-06-18Advanced

Restarting a Long Agent Run From Where It Broke — A Step-Ledger Design for Gemini 3.5 Flash Long-Horizon Tasks

Gemini 3.5 Flash is good at long-horizon tasks, but when a 40-step run dies on step 29, you usually start over. An append-only step ledger gives you resume, idempotency, and audit in one place. Here is the design with working Python and measured results.

gemini-3-5-flash3agent10long-horizonproduction140architecture15

Premium Article

It died on step 29.

It was a late night, with Gemini 3.5 Flash handling a long pipeline for me: collecting article candidates, summarizing, dedup checks, drafting, and tidying image metadata — about 40 small steps packed into a single run. It sailed through 28 steps, and on step 29 an external API returned a 504 and took the whole process down with it.

The painful part is that a restart throws away 28 steps of reasoning and billing for nothing. As an indie developer, I went through this "start over from scratch" a few times on my own projects before I finally sat down and built a foundation that could resume.

Today, June 18, Gemini 3.5 Flash became available, described as able to stay useful across long-horizon, multi-step tasks. And yes — the amount of work I can pack into a single run has clearly grown. But the longer a run gets, the larger the loss when it dies midway. To make the most of a model that runs long, you need running gear built for long runs.

The piece of running gear I settled on is an unglamorous thing: a step ledger.

The Three Moments a Long Run Breaks

First, where does it break? Once a run stretches past 30 steps, failures kept arriving in exactly three shapes.

The first is interruption from the outside: API timeouts, rate limits, a deploy restarting the process. You cannot avoid these.

The second is duplicate execution on resume. If you restart sloppily from the failure point, you re-post a draft you already posted, or re-run a generation you already paid for. This is nastier than the interruption itself, because it needs cleanup.

The third is being unable to trace the cause. When you later want to know why the model made a certain decision on step 19, there is nothing to go on if it scrolled past on stdout and vanished.

A step ledger absorbs all three with one mechanism. It records each step's input, output, and decision into an append-only log. Because the record exists, you can resume; because the record carries an idempotency key, you avoid double execution; because the record stays, you can audit.

The Minimal Ledger Schema

One row of the ledger maps to one step. These are the only columns I settled on in production.

ColumnRole
run_idIdentifies the whole run. On resume, pass the same run_id
step_idA stable name within the pipeline, derived deterministically like "summarize:article-42"
idem_keyIdempotency key for the side effect, derived from the input hash
statusOne of started / done / failed
output_refWhere the artifact lives (a path or KV key). The body never goes in the ledger
created_atAppend time, used for ordering and audit

What matters is keeping the artifact body out of the ledger. The ledger is only an index of "what happened"; heavy bodies live elsewhere and the ledger just points at them with output_ref. Kept this way, the ledger stays light as it grows, and reads stay instant even at thousands of rows.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Take home a copy-paste step ledger that lets a 30-60 step agent run resume from the last successful step instead of restarting from zero
Learn how to build idempotency keys that stop the same side effect (API billing, file generation, external posting) from firing twice on resume
See how the same ledger doubles as an audit log of what the model decided at each step, which cut my incident triage time by roughly 70% in practice
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Advanced2026-07-09
Setting a Token Budget Per Free User: Balancing AdMob Revenue Against AI Feature Cost
Rate limits protect requests per minute. They do nothing for the invoice that arrives at the end of the month. Here is how I derive a per-user token budget from ad revenue, keep the ledger inside a single call wrapper, degrade gracefully at a soft cap, and detect abuse with one concentration ratio.
Advanced2026-07-07
Designing So the Next Shutdown Notice Doesn't Cost You an Afternoon: Isolating Gemini Behind a Single Port
The morning an image model shutdown notice landed, I couldn't say where my app touched that model. This is the design I use now: collapse Gemini dependencies into one port, with fallback and a CI deadline guard, shown as working code.
Advanced2026-07-03
Your Night Batch Is Causing the Morning 429s — Priority Admission Control for a Shared Gemini Quota
When bulk jobs and interactive features share one project's RPM/TPM, the bulk lane wins by default. A priority token bucket design with measurements: 429 rate 3.2% down to 0.03%.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →