New to Kestra?
Use blueprints to kickstart your first workflows.
Kestra flow with dynamic dropdown inputs that feeds product data to a Gemini agent, enforces a JSON schema on the answer, and stores it in the KV store.
Turn an LLM opinion into data your pipeline can act on. This Kestra blueprint fetches every product in a category from the DummyJSON demo API, asks a Gemini-powered AI agent to weigh ratings, review sentiment, discounts, and return policies, and forces the answer into a strict JSON schema with title, justification, potentialDownside, and id. Because the output is structured, the flow can immediately store it in the KV store and call the API again to fetch the full record of the recommended product by id. It also demonstrates two UI features worth stealing: dynamic SELECT inputs populated live from an HTTP call, with the product dropdown depending on the chosen category, and task caching so repeated runs on the same data skip the LLM call.
category input (SELECT) populates its options at execution time with the Pebble http() function against the DummyJSON categories endpoint. The product input uses dependsOn to re-query options whenever the category changes.get_all_products task (io.kestra.plugin.core.http.Request) downloads the full product list for the chosen category, with allowFailed so a bad category does not hard-stop the run.recommend_product task (io.kestra.plugin.ai.agent.AIAgent) sends the product JSON to gemini-3.5-flash-lite with weighing criteria in the prompt. responseFormat: JSON plus a jsonSchema with required fields guarantees a machine-readable answer, and taskCache returns the cached recommendation when inputs have not changed.store_recommendation_in_kv task (io.kestra.plugin.core.kv.Set) persists the structured answer under the execution id with kvType: JSON.get_recommended_product_details task calls the products endpoint with outputs.recommend_product.jsonOutput.id, proving the structured output is directly usable in downstream expressions.log_recommendation task (io.kestra.plugin.core.log.Log) prints a human-readable summary ready to forward to Slack or email.taskCache to cut token spend on repeated runs.The hard part of production LLM use is not the prompt, it is trusting the output enough to chain actions on it. Kestra's AIAgent task enforces the response schema at the platform level, so the downstream HTTP call and KV write can reference jsonOutput.id safely. Dynamic SELECT inputs give the flow a real UI without building a frontend, taskCache deduplicates identical LLM calls, secrets keep the API key out of the YAML, and every recommendation is traceable to the exact product payload the model saw.
GEMINI_API_KEY: Google Gemini API key used by the AIAgent task.GEMINI_API_KEY secret to your Kestra namespace.recommend_product output and the log summary.taskCache skip the model call.io.kestra.plugin.notifications.slack.SlackIncomingWebhook.If task before publishing.ForEach to generate a full recommendation sheet on a schedule.provider block, the schema contract stays identical.