Give every Gemini call retries, fallback, and an audit trail.

The Gemini API answers a single prompt, but production use needs a retry when it returns a 503, a fallback across model versions when the outage is sticky, and one place to see what ran. Kestra wraps every ChatCompletion, StructuredOutputCompletion, and MultimodalCompletion call in that missing layer, using a direct API key rather than a GCP project, then chains the result into whatever runs next.

Blueprints for Gemini orchestration.

The plugin-gemini package calls Google's models directly with an API key: ChatCompletion, TextCompletion, MultimodalCompletion, StructuredOutputCompletion, and Veo video generation. None of that ships with a scheduler, a retry policy, or a queue. Kestra adds the trigger that starts the call, the retry and fallback chain that survives a provider outage, the concurrency cap that protects your quota, and one audit trail across the Gemini call and whatever it feeds next: a Slack alert, a BigQuery table, or a Git-versioned prompt. Teams standardized on Vertex AI for GCP-native model serving reach for this plugin instead when a flow just needs a Gemini API key and nothing else from Google Cloud.

Turn a natural-language question into a structured go/no-go decisionOpen blueprint
Route each prompt to the best-fit model across four providersOpen blueprint
Extract structured expense data from receipt imagesOpen blueprint
Browse all 21 Gemini blueprints

Above the Gemini API, around every call.

Gemini answers a prompt with a single API key. Kestra decides what triggers the call, shapes the answer into typed JSON, reads images alongside text, fans out a queue at controlled throughput, and retries and falls back across model versions, all in one audit trail.

Typed JSON, not prose, out of every call

io.kestra.plugin.gemini.StructuredOutputCompletion forces the response into application/json shaped by a jsonResponseSchema you define, so a downstream If or database write gets typed fields instead of a string you regex out of a paragraph. Token counts are emitted as metrics on every call, and the same schema keeps every run's output shape identical.

API-key auth, no GCP project required

plugin-gemini authenticates with a single apiKey secret against the public Gemini API: no service account, project ID, or IAM role to provision. Teams standardized on GCP IAM for model serving should look at Vertex AI instead; this plugin is for the API-key path most Gemini flows start on and many never leave.

Retries and fallback across model versions

A retry policy absorbs a transient 503 in a second; a chain of ChatCompletion tasks gated by runIf falls back to an older model version when the newest preview model stays down. A flow-level concurrency block caps simultaneous calls so a traffic spike never exceeds your own Gemini quota.

Multimodal input in a single call

io.kestra.plugin.gemini.MultimodalCompletion sends mixed text and image parts, including file URIs pulled from Kestra storage, in one request and returns text plus any generated images, saved back to storage as URIs. No separate OCR or vision service to wire in.

Fan-out classification at controlled throughput

Wrap StructuredOutputCompletion or TextCompletion in a ForEach with concurrencyLimit set, and a queue of hundreds of items to classify becomes a bounded, resumable batch instead of an unthrottled loop that trips your rate limit halfway through.

Veo video generation, gated the way marketing actually gates it

io.kestra.plugin.gemini.VideoGeneration creates a 1 to 60 second video with Google's Veo 3 model through the same API key. Pair it with a Pause task before anything publishes externally: unlike a routine classification call, a generated video going out under the brand is one of the few Gemini outputs teams genuinely want a person to look at first.

How teams use Gemini and Kestra

Patterns AI and platform teams run in production today. Each one shows the flow end to end, with the real plugin classes in play.

Structured output

Turn a natural-language question into a structured, actionable decision

StructuredOutputCompletion answers in application/json shaped by a schema you define, so a boolean or numeric field drives an If branch directly. No regex against a paragraph, no brittle matching on the model's phrasing, just a notification and a calendar write when the JSON says to act.

Typed fields every run

The schema guarantees the same fields every time, so If never parses free text for an answer.

Conditional execution

Actions fire only when the JSON verdict says so, not on every scheduled run regardless of outcome.

Runs unattended on a cron

A disabled Schedule trigger runs the check every morning, no person involved.

What you get

Published as the ai-check-weather-gemini blueprint in the Kestra catalog.

StructuredOutputCompletion icon
Ask Gemini
structured prompt
If icon
Branch
If condition
SlackIncomingWebhook icon
Notify
Slack
InsertEvent icon
Calendar
block time
Multimodal

Read images and documents, then reshape the answer into typed fields

MultimodalCompletion reads an uploaded image alongside a text prompt in one call. A second StructuredOutputCompletion pass reshapes that free-text read into a fixed JSON schema, so a folder of receipts, screenshots, or product photos becomes typed records a database can ingest directly.

No separate OCR service

One multimodal call reads the image directly; no dedicated vision or OCR pipeline to stand up.

Two focused calls

One call reads the image, a second reshapes the answer, so each prompt stays simple and easy to debug.

New files picked up automatically

A storage trigger polls the inbox, so nobody has to manually upload files to a processing tool.

What you get

Published as the gemini-multimodal-receipt-extraction blueprint in the Kestra catalog.

Trigger icon
New file
S3 trigger
MultimodalCompletion icon
Describe image
multimodal
StructuredOutputCompletion icon
Reshape to JSON
structured pass
GoogleChatIncomingWebhook icon
Notify
Google Chat
Resilience

Keep classifying when Gemini's preview tier goes UNAVAILABLE

A retry absorbs a one-off 503. When the outage is sticky, a chain of ChatCompletion tasks gated by runIf falls back to an older stable model, and a flow-level concurrency queue keeps a traffic burst from exhausting the quota. Slack fires only when a fallback actually runs.

Retry before fallback

A one-second retry absorbs transient noise before the fallback chain ever fires.

Concurrency caps your quota

A flow-level queue keeps a traffic spike from exceeding your own Gemini rate limit.

One alert per outage

Slack fires only when a fallback model actually ran, not on every retry attempt.

What you get

Published as the gemini-model-fallback-resilience blueprint in the Kestra catalog.

Webhook icon
Webhook
inbound event
ChatCompletion icon
Classify
primary model
ChatCompletion icon
Fallback
older model version
SlackIncomingWebhook icon
Alert
Slack, only if used
Multi-model routing

Route each prompt to the model that's actually good at it

A cheap classifier tags every prompt as coding, reasoning, search, or general, then a Switch sends it to the right provider: Gemini for reasoning, Claude for code, Perplexity for anything needing live web context. Stop paying frontier prices for simple questions and stop sending hard problems to a model not built for them.

Cost-aware by design

A cheap classifier gates expensive models, so frontier pricing only applies where it earns its keep.

Vendor-agnostic routing

Swapping or adding a provider is a new Switch case, not a rewrite of the calling code.

Full lineage per request

Every classification decision and every provider's response is visible in one execution.

What you get

Published as the ai-model-router blueprint in the Kestra catalog.

ChatCompletion icon
Classify prompt
cheap model
Switch icon
Route
Switch
ChatCompletion icon
Reasoning branch
Gemini
ChatCompletion icon
Coding branch
Anthropic
Batch classification

Moderate a review queue without tripping your own rate limit

ForEach with a concurrencyLimit wraps a StructuredOutputCompletion call, so hundreds of pending reviews get classified for toxicity and spam five at a time instead of all at once. Each verdict writes back to the source system immediately, so a failed run resumes without re-classifying what already succeeded.

Bounded, resumable batches

A concurrency cap keeps throughput predictable no matter how large the queue grows.

Typed verdicts

Every review gets an approve, flag, or reject verdict plus a reason, not free text to parse.

One completion ping

A single notification per batch replaces one message per review.

What you get

Published as the gemini-batch-review-moderation blueprint in the Kestra catalog.

Schedule icon
Nightly schedule
cron
Request icon
Fetch queue
pending reviews
ForEach icon
Classify
ForEach, cap 5
StructuredOutputCompletion icon
Verdict
typed JSON
When Gemini 3.1 Pro returned a 503 'model is currently experiencing high demand' response in the middle of our issue triage, the flow didn't stop. It tried Gemini 3.0, then Gemini 2.5, set the fields the rest of the flow needed, and logged a single Slack message so we'd know it happened. The model provider had a bad minute. The workflow didn't.
Anna Geller, Product Lead at Kestra
~1 every 2 daysGemini 3.1 Pro outage cadence observed
15 minutesTime to add retry, fallback, and alerting

Kestra vs the orchestration alternatives Gemini teams evaluate

Capability
Python scripts + LangChain
n8n
Temporal
Retry and fallback across model versions
Native retry policy plus a runIf-gated fallback chain
Hand-rolled try/except per callNo native model fallback, a custom Function node requiredDurable execution retries the activity automatically
Structured JSON output enforcement
Native StructuredOutputCompletion with a jsonResponseSchema
Pydantic or JSON-mode parsing glued on top of the SDKManual JSON parsing inside a Function nodeApplication code owns schema validation
Batch fan-out with concurrency control
ForEach with a concurrencyLimit
asyncio.Semaphore or a queue librarySplit In Batches node, no native rate limitingChild workflows per item, more setup
Multimodal input (image plus text)
Native MultimodalCompletion
google-genai SDK called directlyHTTP Request node to the Gemini APIAn activity wraps the same SDK call
Execution history and lineage
Full UI history per task, per attempt
Custom logging, no built-in UIExecution log per node runBuilt-in workflow history, code-first
Team already comfortable withDeclarative YAML, versioned in GitPython and prompt engineeringLow-code, drag-and-dropGo, Java, or Python SDK and durable-execution concepts

Gemini & Kestra: common questions

Find answers to your questions right here, and don't hesitate to Contact Us if you couldn't find what you're looking for.

See How

Ready to orchestrate your Gemini calls?

Add retries, model-version fallback, concurrency limits, and full execution history around every Gemini call, from a direct API key to whatever runs next.