New to Kestra?
Use blueprints to kickstart your first workflows.
Webhook-triggered pipeline that geocodes a city, calls weather and air quality APIs in parallel, and asks a Gemini AI agent for a short daily plan.
A compact, end-to-end pattern for AI-assisted API orchestration. This Kestra blueprint takes a city name, resolves it to coordinates with the Open-Meteo geocoding API, fans out to the weather and air quality APIs in parallel, and hands the raw JSON to an AI agent that writes a 3 to 5 sentence plan for the day, including cautions such as high PM2.5 or strong wind. It demonstrates the operational scaffolding real AI pipelines need: per-task retries, graceful degradation when one API fails, an execution SLA, a failure alert to Slack, and a typed flow output that downstream flows or callers can consume.
incoming_webhook trigger (io.kestra.plugin.core.trigger.Webhook) lets any HTTP caller request a plan on demand, secured by PLAN_MY_DAY_WEBHOOK_KEY. The flow also runs manually with the city input, defaulting to Austin.geocode_city task (io.kestra.plugin.core.http.Request) resolves the city name, and parse_geo (io.kestra.plugin.scripts.python.Script) extracts latitude and longitude, failing fast with a clear error when the city is unknown.parallel_tasks task (io.kestra.plugin.core.flow.Parallel) calls weather_api and air_quality_api concurrently. Both requests inherit retry and header policy from pluginDefaults and are allowed to fail individually.day_brief task (io.kestra.plugin.ai.agent.AIAgent) prompts gemini-3.5-flash-lite with both response bodies, substituting "not available!" for any missing data so the agent still produces a useful plan on partial failures.log_output records the answer, the flow exposes it as the brief output, the errors branch posts to Slack on failure, and a MAX_DURATION SLA cancels runs over 10 minutes.brief flow output that subflows, apps, or API callers can consume directly.The interesting part of this flow is not any single API call, it is the failure handling between them. Kestra provides Parallel for concurrent enrichment, pluginDefaults to declare retry and header policy once for every HTTP request, allowFailure for graceful degradation, an errors branch for alerting, and SLA enforcement, all without a line of orchestration code. The AIAgent task turns the LLM call into an observable task with logged requests, so you can see exactly what the model was given when a plan looks off.
GEMINI_API_KEY: Google Gemini API key used by the AIAgent task.SLACK_WEBHOOK: Slack incoming webhook URL for the failure alert.PLAN_MY_DAY_WEBHOOK_KEY: shared secret guarding the Webhook trigger.city default or pass it in the webhook payload to plan for other locations.Schedule trigger to deliver the plan every morning instead of on demand.responseFormat and branch on fields like a rain flag.