●2.5 ROUTE — Since 12/1, gemini-2.5-pro routes to 3.8 Flash and gemini-2.5-flash to 3.5 Flash-Lite, billed at the new model's rates●CARBON — Intro pricing for Gemini 4 Carbon and Argon has ended. Standard rates: $4.00 input, $20.00 output per 1M tokens●OMNI 1.1 — gemini-omni-1.1-flash starts routing to 1.2 Flash on 12/3, one day from now●COMPRESS — Some Gemini CLI users report auto-compression that barely shrinks the context, round after round●FALLBACK — Planning for model changes or traffic spikes? Decide your retry count and fallback model up front●LONG DOC — Feeding Gemini a long document? State your goal and the part to read first, and fewer details get dropped●2.5 ROUTE — Since 12/1, gemini-2.5-pro routes to 3.8 Flash and gemini-2.5-flash to 3.5 Flash-Lite, billed at the new model's rates●CARBON — Intro pricing for Gemini 4 Carbon and Argon has ended. Standard rates: $4.00 input, $20.00 output per 1M tokens●OMNI 1.1 — gemini-omni-1.1-flash starts routing to 1.2 Flash on 12/3, one day from now●COMPRESS — Some Gemini CLI users report auto-compression that barely shrinks the context, round after round●FALLBACK — Planning for model changes or traffic spikes? Decide your retry count and fallback model up front●LONG DOC — Feeding Gemini a long document? State your goal and the part to read first, and fewer details get dropped
Gemini API × Inngest: Building Fault-Tolerant AI Workflows for Production
Build Gemini API jobs that survive 429s, timeouts, and partial failures with Inngest v4 durable execution — v3-to-v4 rewrite, fan-out, approval gates, budget guards, onFailure, and a troubleshooting table, current as of November 2026.
I pasted my own sample code into a fresh Next.js project, ran npm install, and got the latest inngest. Before I had even opened the dashboard, the editor was covered in red squiggles. The trigger I'd passed as the second argument no longer type-checked, and EventSchemas didn't exist. I had written the guide against v3; npm had quietly moved on to v4.
My first instinct was to make the errors go away one at a time. I cast a few things to any, got something running, and almost called it done. Reading the logs the next morning, I saw the SDK had started in Cloud mode and was hunting for a signing key instead of talking to the local Dev Server. That was when it clicked for me: "it runs" and "it runs in the mode I intended" are two different claims.
This guide is built on that rewrite. It walks through a setup that works as of November 2026 for Gemini API jobs that can fail halfway and resume without throwing away the tokens you've already paid for.
Check Your Versions First (as of November 2026, verified against official docs)
Before copying any code, it's worth confirming your project matches this table. If it doesn't, the samples below won't compile as-is.
Component
What this guide assumes
How to check
What breaks if it differs
Inngest TypeScript SDK
v4 (npm latest is 4.26.2)
npm ls inngest
On v3 there are no triggers-in-options or eventType helpers
Gemini SDK
@google/genai (npm latest is 3.3.0)
npm ls @google/genai
The legacy @google/generative-ai has a different call shape
Main generation model
gemini-4-hydrogen
Model list in AI Studio
2.5 models are auto-routed elsewhere from December 1
High-volume light summaries
gemini-3.5-flash-lite
Same
Your cost and latency estimates shift
Local runs
npx inngest-cli@latest dev
Does the dashboard open?
v4 defaults to cloud mode, so dev mode must be explicit
On models: Google's deprecation page states that from December 1, 2026, API requests to gemini-2.5-pro are automatically routed to gemini-3.8-flash, and gemini-2.5-flash to gemini-3.5-flash-lite, billed at the destination model's rates. The original samples here used 2.5 models, so I replaced every one of them. I'd recommend pulling model IDs into environment variables — the next switch then won't touch your code at all.
Why Gemini Workloads Need Durable Execution
The core idea of durable execution is simple: the engine persists a function's progress, so when something fails, only the failed step runs again. Inngest, Temporal, and Restate are all built around this.
Run Gemini in production for a while and you'll meet the same handful of situations: a transient HTTP 429 (RESOURCE_EXHAUSTED) that stalls everything unless you retry; a stream that drops before the final chunk; a video or PDF analysis that times out; a function-calling result that triggers another API which fails for reasons unrelated to Gemini.
The naive try/catch plus setTimeout approach has one painful flaw: every retry pays again for the calls that had already succeeded. If a 10,000-item batch dies at item 5,000 and restarts from zero, that's real money on top. That's the gap durable execution fills.
I chose Inngest for three reasons. Anything inside step.run('name', fn) has its result saved on success and is skipped on replay. npx inngest-cli@latest dev shows each step on a timeline. And once event types are defined, the function side autocompletes, so a renamed field shows up at build time instead of in production.
✦
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
✦You'll be able to resume long Gemini jobs after a timeout, 429, or mid-run crash without paying again for the steps that already succeeded
✦You'll rewrite v3-style code (EventSchemas, three-argument createFunction) into v4 triggers and eventType, then build fan-out, approval gates, and dead-letter handling in working TypeScript
✦You'll be able to diagnose the production traps that bite first — the December 1, 2026 auto-routing of 2.5 models, the Cloud-mode signing key error, and more — straight from the symptom
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.
Step 1: The Minimal Setup in v4 (with the v3 Rewrite)
Start with the smallest realistic flow: accept an article-generation request, have Gemini produce an outline and a body, and save the result. Next.js App Router.
Before: the v3 shape (now a type error on current npm)
This is what the original version of this guide used — the trigger as the second argument, and types centralized on the client through EventSchemas.
// v3 style (for reference — does not work on v4)import { Inngest, EventSchemas } from "inngest";export const inngest = new Inngest({ id: "content-pipeline", schemas: new EventSchemas().fromRecord<Events>(),});inngest.createFunction( { id: "generate-article" }, { event: "article/generate.requested" }, async ({ event, step }) => { /* ... */ },);
Inngest's official v3-to-v4 migration guide lists the breaking changes: triggers move into the options object (the first argument), EventSchemas is replaced by eventType() and staticSchema(), event.user is removed, signingKey and friends move from serve to the client, and the default mode becomes cloud.
After: the v4 shape
Define each event type once with eventType() and reuse it for sending, waiting, and triggering. If you don't need runtime validation, staticSchema() is enough.
// src/inngest/client.tsimport { Inngest, eventType, staticSchema } from "inngest";// Point at the Dev Server while developing; in production, pass INNGEST_SIGNING_KEY via envexport const inngest = new Inngest({ id: "content-pipeline", isDev: process.env.NODE_ENV !== "production",});type GenerateRequested = { userId: string; topic: string; lengthHint: "short" | "medium" | "long"; requestId: string; // idempotency key, minted client-side};export const articleRequested = eventType("article/generate.requested", { schema: staticSchema<GenerateRequested>(),});export const approvalReceived = eventType("article/approval.received", { schema: staticSchema<{ draftId: string; approved: boolean }>(),});
staticSchema expects a type, not an interface — the docs call this out, and I still lost a while passing an interface and wondering why nothing was typed.
Keep model IDs in one place:
// src/lib/gemini.tsimport { GoogleGenAI } from "@google/genai";export const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY }); // keep the value (YOUR_API_KEY) in .env// switching models should only ever touch this fileexport const MODEL_MAIN = process.env.GEMINI_MODEL_MAIN ?? "gemini-4-hydrogen";export const MODEL_LIGHT = process.env.GEMINI_MODEL_LIGHT ?? "gemini-3.5-flash-lite";
Now the function itself. Every call that touches the outside world gets its own step.run:
// src/inngest/functions/generate-article.tsimport { inngest, articleRequested } from "../client";import { ai, MODEL_MAIN } from "@/lib/gemini";export const generateArticle = inngest.createFunction( { id: "generate-article", triggers: [articleRequested], // at most 3 concurrent runs per userId (runaway protection) concurrency: { key: "event.data.userId", limit: 3 }, retries: 4, // 4 is also the default; stating it helps the next reader }, async ({ event, step, logger }) => { const { topic, lengthHint, requestId } = event.data; // 1. Outline. If this fails, only this step re-runs const outline = await step.run("generate-outline", async () => { const res = await ai.models.generateContent({ model: MODEL_MAIN, contents: `Propose an article outline with five H2 headings.\nTopic: ${topic}\nLength hint: ${lengthHint}`, config: { temperature: 0.4 }, }); return res.text ?? ""; }); // 2. Body. If the outline is already saved, step 1 is skipped on replay const body = await step.run("generate-body", async () => { const res = await ai.models.generateContent({ model: MODEL_MAIN, contents: `Write the article body following this outline.\n\n${outline}`, config: { temperature: 0.6, maxOutputTokens: 8000 }, }); return res.text ?? ""; }); // 3. Save. Without checking the response, a failure gets recorded as success await step.run("save-to-db", async () => { const r = await fetch(`${process.env.API_BASE_URL}/articles`, { method: "POST", headers: { "content-type": "application/json", "idempotency-key": requestId }, body: JSON.stringify({ requestId, topic, body }), }); if (!r.ok) throw new Error(`save failed: ${r.status}`); }); logger.info("article generated", { requestId }); return { requestId, bodyLength: body.length }; },);
Three things changed from the original: the trigger lives in options, model IDs are constants, and the save step now checks the response. fetch doesn't throw on a 500, so without r.ok Inngest would happily record the step as a success and move on.
Expose the function through Next.js:
// src/app/api/inngest/route.tsimport { serve } from "inngest/next";import { inngest } from "@/inngest/client";import { generateArticle } from "@/inngest/functions/generate-article";export const { GET, POST, PUT } = serve({ client: inngest, functions: [generateArticle] });
Locally, start npx inngest-cli@latest dev and register http://localhost:3000/api/inngest. If you forget isDev, v4 stops with this error — quoted verbatim from the migration guide:
Error: Inngest error: A signing key is required to run in Cloud mode, but no signing key was found.
Either set isDev: true on the client or start with INNGEST_DEV=1 npm run dev. I'm deliberately not publishing timings or sample output from real Gemini calls; they move with model load from one run to the next. The check that actually matters is in the dashboard: generate-outline and generate-body appear as separate rows, and when you force one to fail, the other is not re-run.
Step 2: Fan-Out / Fan-In
Real workflows tend to fan out: one request becomes many subtasks. A news digest fetches 100 sources, summarizes each, then composes the result. In v4 you pass the function object itself to step.invoke and await with Promise.all — per the migration guide, string function IDs are no longer accepted.
// src/inngest/functions/digest-pipeline.tsimport { inngest } from "../client";import { eventType, staticSchema } from "inngest";import { ai, MODEL_MAIN, MODEL_LIGHT } from "@/lib/gemini";const summarizeRequested = eventType("digest/summarize.requested", { schema: staticSchema<{ url: string }>(),});const digestRequested = eventType("digest/build.requested", { schema: staticSchema<{ urls: string[]; digestId: string }>(),});// Child: summarize one URLexport const summarizeOne = inngest.createFunction( { id: "summarize-one", triggers: [summarizeRequested], // cap child launches at 60/min overall so we stay under Gemini's RPM throttle: { limit: 60, period: "1m" }, retries: 3, }, async ({ event, step }) => { const { url } = event.data; // trim before returning — a single step's return value is capped at 4 MiB const text = await step.run("fetch", async () => { const r = await fetch(url, { signal: AbortSignal.timeout(20_000) }); if (!r.ok) throw new Error(`fetch ${r.status}`); return (await r.text()).slice(0, 50_000); }); const summary = await step.run("summarize", async () => { const res = await ai.models.generateContent({ model: MODEL_LIGHT, contents: `Extract the key points from this HTML in three lines:\n${text}`, }); return res.text ?? ""; }); return { url, summary }; },);// Parent: fan out, then fan inexport const buildDigest = inngest.createFunction( { id: "build-digest", triggers: [digestRequested], retries: 2 }, async ({ event, step }) => { const { urls, digestId } = event.data; const summaries = await Promise.all( urls.map((url, i) => step.invoke(`summarize-${i}`, { function: summarizeOne, data: { url } }), ), ); const digest = await step.run("compose-digest", async () => { const joined = summaries.map((s) => `- ${s.summary}`).join("\n"); const res = await ai.models.generateContent({ model: MODEL_MAIN, contents: `Write a news digest from these summaries:\n${joined}`, }); return res.text ?? ""; }); await step.run("publish", async () => { const r = await fetch(`${process.env.API_BASE_URL}/digest`, { method: "POST", headers: { "content-type": "application/json", "idempotency-key": digestId }, body: JSON.stringify({ digestId, digest }), }); if (!r.ok) throw new Error(`publish ${r.status}`); }); return { count: summaries.length }; },);
Two things matter. throttle caps launches per minute across all children, and each step.invoke retries independently. If 3 of 100 URLs hit a 429, only those 3 replay; the 97 successes stay untouched.
There are ceilings, though. Inngest's limits page puts steps per function at 1,000, a single step's return value at 4 MiB, and total run state — event data, step outputs, and so on — at 32 MiB. If you're heading into thousands of URLs, split the parent or have children write results to storage and return only a reference.
Step 3: Waiting for a Human (waitForEvent)
Not publishing model output until a person has looked at it is close to unavoidable in production. step.waitForEvent lets you write a multi-day wait right inside the function — and in v4 you can pass the eventType from Step 1, so the returned event is typed.
// src/inngest/functions/article-with-approval.tsimport { inngest, articleRequested, approvalReceived } from "../client";export const articleWithApproval = inngest.createFunction( { id: "article-with-approval", triggers: [articleRequested], retries: 2 }, async ({ event, step }) => { // ... outline / body exactly as in Step 1 ... // derive the ID from requestId so replays always see the same value const draftId = await step.run("save-draft", async () => { const id = `draft_${event.data.requestId}`; // persist the draft here return id; }); await step.run("notify-reviewer", async () => { const r = await fetch(process.env.SLACK_WEBHOOK_URL!, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ text: `Review needed: /draft/${draftId}` }), }); if (!r.ok) throw new Error(`slack ${r.status}`); }); // wait up to 3 days, only for approvals matching this draftId const approval = await step.waitForEvent("wait-approval", { event: approvalReceived, timeout: "3d", if: `async.data.draftId == "${draftId}"`, }); if (!approval || !approval.data.approved) { await step.run("reject", async () => { await fetch(`${process.env.API_BASE_URL}/draft/${draftId}/reject`, { method: "POST" }); }); return { status: approval ? "rejected" : "auto-rejected", draftId }; } await step.run("publish", async () => { await fetch(`${process.env.API_BASE_URL}/draft/${draftId}/publish`, { method: "POST" }); }); return { status: "published", draftId }; },);
When a reviewer clicks Approve, your server sends inngest.send(approvalReceived.create({ draftId, approved: true })) and the function picks up where it paused. The if clause is a CEL expression, where async refers to the event being waited for.
The original version minted draftId with crypto.randomUUID(). Because step.run output is saved, it rarely broke anything — but every time I reread the code I had to re-convince myself the value wouldn't change on replay. Deriving it from the request removes the question entirely.
Inngest persists the state behind the scenes, so a server restart mid-wait doesn't lose your place. Waiting on a person and recovering from a failure use the same mental model — that, more than anything, is why I keep reaching for durable execution. Waits aren't unbounded, though: the limits page caps a run's total length, sleeps and waits included, at 30 days on Free and 90 days on Pro.
Step 4: Budget Guardrails
The production failure that keeps me up at night is cost runaway. A function-calling loop or a recursive agent with nothing to stop it will have stacked up many times the calls you planned for before anyone notices. Inngest's concurrency, throttle, and rateLimit shrink that worry considerably.
import { inngest } from "../client";import { eventType, staticSchema } from "inngest";const agentRequested = eventType("agent/run.requested", { schema: staticSchema<{ userId: string; task: string }>(),});export const safeAgent = inngest.createFunction( { id: "safe-agent", triggers: [agentRequested], concurrency: [ { scope: "fn", limit: 50 }, // 50 concurrent runs across the function { scope: "fn", key: "event.data.userId", limit: 1 }, // 1 concurrent run per user ], throttle: { limit: 30, period: "1m" }, // 30 launches/min; excess waits in the queue rateLimit: { limit: 1, period: "10s", key: "event.data.userId" }, // repeated triggers are dropped retries: 3, }, async ({ event, step }) => { const used = await step.run("check-budget", async () => { const r = await fetch(`${process.env.API_BASE_URL}/usage/${event.data.userId}`); if (!r.ok) throw new Error(`usage ${r.status}`); return (await r.json()) as { tokensUsedThisMonth: number }; }); if (used.tokensUsedThisMonth > 5_000_000) { return { status: "budget-exceeded", used: used.tokensUsedThisMonth }; } // ... Gemini calls go here ... },);
My shorthand for the three: concurrency is how many run at once; throttle is how many may start per window, with the excess queued; rateLimit is the same, except the excess is dropped. Use throttle to stay inside Gemini's RPM and TPM, and rateLimit to absorb the same user hammering a button.
On top of that, check usage in a check-budget step before every Gemini call. Return early when the monthly budget is gone, and no matter how hard a loop spins, it never reaches the next call.
Step 5: Catching What Finally Fails (onFailure and Dead-Letter)
Some events will exhaust every retry. In production you want what failed, when, and why routed to a separate channel from day one.
The original code had two mistakes. I assumed the event passed to onFailure was the original event, and I classified errors with e.message.includes("INVALID_ARGUMENT"). Per the docs, onFailure receives the inngest/function.failed system event, with the original event at event.data.event. Errors also arrive serialized, so instanceof can't tell custom error classes apart inside onFailure.
import { inngest, articleRequested } from "../client";import { NonRetriableError, RetryAfterError } from "inngest";import { ApiError } from "@google/genai";import { ai, MODEL_MAIN } from "@/lib/gemini";export const robustGeneration = inngest.createFunction( { id: "robust-generation", triggers: [articleRequested], retries: 5, onFailure: async ({ event, error, step }) => { const original = event.data.event; // the event that triggered the failed run await step.run("notify-deadletter", async () => { await fetch(process.env.OPS_WEBHOOK_URL!, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ functionId: "robust-generation", failedRunId: event.data.run_id, requestId: original.data.requestId, error: error.message, // instanceof won't work here, so keep it as a string }), }); }); }, }, async ({ event, step }) => { return step.run("generate", async () => { try { const res = await ai.models.generateContent({ model: MODEL_MAIN, contents: event.data.topic, }); return res.text ?? ""; } catch (e) { // classify here, in the main handler, where ApiError.status is readable if (e instanceof ApiError) { if (e.status === 429) { throw new RetryAfterError("rate limited", 30_000, { cause: e }); // retry after 30 seconds } if (e.status >= 400 && e.status < 500) { throw new NonRetriableError(`gemini ${e.status}`, { cause: e }); // won't fix itself — stop now } } throw e; // 5xx and network drops go through normal retries } }); },);
@google/genai throws an ApiError whose status holds the HTTP code. A 400 (INVALID_ARGUMENT) or a 404 for an unknown model won't change no matter how many times you retry, so stopping right away with NonRetriableError and handing the case to a person saves real spend. And if any code still names a 2.5 model after December 1, the call will still return text — just from a different model, at that model's price. Don't wait for an error; check the Step 1 constants.
Troubleshooting Table
These are the snags I hit during the rewrite, plus the symptoms the official migration guide and limits page describe — arranged so you can start from what you're seeing.
Symptom
Likely cause
How to check
Fix
Type error on the trigger in the second argument
Upgraded to v4 but still using v3 syntax
npm ls inngest shows 4.x
Move triggers into the options object
EventSchemas not found
Removed in v4
Check your imports
Switch to eventType() and staticSchema()
Startup fails with "A signing key is required to run in Cloud mode"
v4 defaults to cloud mode
Client isDev and the INNGEST_DEV env var
isDev: true or INNGEST_DEV=1 locally; INNGEST_SIGNING_KEY in production
step.invoke can't find the function
Passing a string function ID
The function: value
Pass the function object
Sending an event fails
Event exceeds the maximum size
Byte size of the JSON you send
Store the payload elsewhere and send a URL (limit: 256 KiB on Free, 3 MiB on Pro)
Can't read the original requestId in onFailure
Treating event as the original event
Log event.name
Read from event.data.event.data
Output quality or billing shifts suddenly on 2.5 models
December 1 auto-routing
Search your code for model IDs
Update the constants and review the migration guide's diffs
step.run results are saved and returned from storage on replay. Flip that around: if you call Date.now() or Math.random()outside a step, you'll get a new value every time the function resumes. Anything that must stay stable should be the return value of a step.
// ❌ timestamp changes on every resume and no longer matches saved stepsconst timestamp = Date.now();await step.run("save", async () => db.save({ value, timestamp }));// ✅ pin it as a step's return valueconst timestamp = await step.run("get-timestamp", async () => Date.now());await step.run("save", async () => db.save({ value, timestamp }));
Pitfall 2: wrapping streaming in step.run
generateContentStream returns an async iterator. Draining it inside step.run and returning the final text throws away the whole point — fast first tokens. Let Inngest own the background job, and stream to users over a separate path such as SSE or WebSockets.
Pitfall 3: stuffing large payloads into event.data
Events have a maximum size: the limits page lists 256 KiB on Free and 3 MiB on Pro and Business. (The original version of this guide said 512 KB; that was wrong.) Keep PDFs and video in storage and put only the URL in event.data. It also fits Gemini's Files API more naturally.
Misconceptions Worth Correcting
"Inngest retries mean I can stop worrying about Gemini 429s." Retries operate per step, but without throttle the failed calls all come back at once and hit the 429 again. Specify a wait with RetryAfterError when you get a 429, and keep launch volume in check with throttle — you need both layers.
"Wrapping a write in step.run guarantees it happens once." What gets saved is the result after the step returns successfully. If the process dies after the external write but before the step returns, the step runs again. That's exactly why idempotency, below, is the foundation.
"I can branch on instanceof NonRetriableError inside onFailure." As the docs note, errors reaching onFailure are deserialized as plain Error objects; custom classes are lost. If you need to branch, write the error kind into the message or metadata in the main handler before throwing.
Idempotency: The Quiet Foundation
Saving step.run results keeps you from calling Gemini twice — but if your database write or downstream API isn't safe to hit twice, most of that value evaporates.
Three habits cover nearly everything. Carry the client-issued idempotency key (requestId here) into every external call. Write with that key — INSERT ... ON CONFLICT DO NOTHING in Postgres, MERGE in BigQuery. And for APIs that accept an Idempotency-Key, such as Stripe, pass the same key straight through.
await step.run("persist", async () => { await db.execute( `INSERT INTO articles (request_id, topic, body) VALUES ($1, $2, $3) ON CONFLICT (request_id) DO NOTHING`, [requestId, topic, body], );});// Stripe: create a PaymentIntent with an idempotency keyconst intent = await step.run("create-payment-intent", async () => { const pi = await stripe.paymentIntents.create( { amount: 250, currency: "jpy", customer: customerId }, { idempotencyKey: `pi_${requestId}` }, ); return { id: pi.id, status: pi.status };});
The original used the legacy Charges API (stripe.charges.create with tok_visa). For anything new, PaymentIntents is the natural fit. I also changed the step to return only the fields used later rather than the whole Stripe object — less saved state, and further from the run-state ceiling.
When the write side can't be made idempotent — a legacy API that always creates on POST — use a claim pattern: a step.run("claim-or-skip", ...) that atomically marks the request in progress and returns whether this is the first attempt. Replays get false and short-circuit.
Observability: What I Actually Watch
Day to day, it's a small set of charts. The most useful is p50/p95 for the generate-body step; when it creeps upward, I suspect upstream latency before I suspect my code. Second is the retry-count distribution per function — a rise that doesn't come back down usually means a quota or auth problem is taking shape.
One step further: wrap each Gemini call in an OpenTelemetry span, with the model name and token count as attributes.
With the model as an attribute, a switch like December 1 shows up as a before-and-after on the same chart. I set it up this way precisely because, the week I swapped models, I couldn't turn "it feels slower" into a number.
Testing with @inngest/test
For v4 there's @inngest/test (it requires inngest 4.0.0 or later). It runs your function as-is and lets you mock steps and assert on how they were called.
Mock the Gemini steps and you can test branching without an API key. Functions that use step.waitForEvent or step.sleep must have those steps mocked, as the docs say — otherwise the test simply starts waiting. For retry behavior itself, failing for real against the Dev Server and reading the recorded attempts beats faking setTimeout.
Deployment Notes
/api/inngest must be reachable from Inngest Cloud (or your self-hosted control plane). Behind a strict firewall you'll either expose it through a reverse proxy or run the control plane yourself.
Function identity is the id. Change it and Inngest treats it as a new function; in-flight runs finish under the old id. That's convenient for breaking changes, but it means the old function has to stay deployed until those runs drain.
Keep signing keys and event keys (INNGEST_SIGNING_KEY, INNGEST_EVENT_KEY) separate per environment — shared keys are how a dev bug ends up sending production events. On serverless hosts, the migration guide recommends setting maxRuntime for checkpointing; check it alongside your host's execution timeout.
Inngest, Cloud Tasks, or Temporal?
Concern
Inngest
Cloud Tasks (lightweight queue)
Temporal
Resume per step
Yes (step.run)
No — you keep state in your own DB
Yes
Waiting on people or signals
waitForEvent
Build it yourself
Signals
Local reproduction
Dev Server shows the same flow
Production-like local runs take effort
Dev server available
Languages
TypeScript-first (Python and Go too)
Any
Go, Java, TypeScript, .NET, and more
Operational load
Low (on the cloud service)
Low
High (when self-run)
Typical duration
Seconds to hours; days with waits
Short one-shot jobs
Business processes spanning weeks
The decision fits in one sentence: if several Gemini-involving steps share state, use Inngest; if each task is independent and one-shot, use Cloud Tasks; if a business process runs for weeks and someone can own the platform, use Temporal. I haven't yet hit a Gemini workload of my own that Inngest couldn't handle, but for approvals that take weeks or long data migrations, I'd pick Temporal.
Production Readiness Checklist
Each external call sits in its own step.run, so replays never re-hit Gemini unnecessarily
Every event carries a stable requestId, and writes are idempotent on it
concurrency is set per user (or tenant)
throttle is set across the function and stays inside Gemini's RPM and TPM
The monthly budget is checked up front, with an early return when it's exceeded
As a first step, run npm ls inngest in your project and search the code for gemini-2.5 — once each. If either one turns something up, Step 1 is the shortest way back. That's where I restarted too, staring at an editor full of red squiggles.
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.