Request icon
Log icon
ChatCompletion icon
OpenAI icon
SlackIncomingWebhook icon
Webhook icon
Schedule icon

AI enrichment example: Getting started with Kestra

A green-on-first-run AI example. Fetch public data and log a preview, then add an OpenAI (or Anthropic or Gemini) key to summarize and classify records.

Categories
Getting StartedAI

A getting started AI enrichment flow that runs successfully on the very first execution with zero secrets. It fetches a few public sample records over HTTP and logs a preview, so a new user sees a real result immediately. To make it yours, add one LLM API key and enable a provider task to summarize the data and classify the sentiment of each record. It is the quickest way to see the fetch, then enrich with an LLM pattern working in Kestra before wiring in your own model and data.

How it works

  1. The extract task (io.kestra.plugin.core.http.Request) fetches a small public sample of quotes from a public API. No authentication is required.
  2. The preview task (io.kestra.plugin.core.log.Log) logs the HTTP status and body so the first run shows real data.
  3. The optional enrich task (io.kestra.plugin.ai.completion.ChatCompletion) sends the data to your chosen LLM provider with a system and user prompt, asking for a one-sentence theme summary and a POSITIVE / NEUTRAL / NEGATIVE sentiment classification per record.
  4. The optional ai_result task logs the model's textOutput, and the optional notify task posts it to Slack.

What you get

  • A working AI-shaped run on the first click, with no keys to configure.
  • A ready-to-enable ChatCompletion task you swap between OpenAI, Anthropic, and Gemini.
  • A clear prompt that both summarizes and classifies in one call.
  • Optional Slack alerting and webhook or schedule triggers.

Who it's for

  • Teams evaluating Kestra for AI and LLM-backed data enrichment.
  • Anyone new to Kestra who wants a green first run before adding a model key.
  • Engineers building fetch, enrich, and notify pipelines over their own data.

Why orchestrate this with Kestra

Calling an LLM from a script is easy; operating that call is not. Kestra wraps the model call in a declarative pipeline with retries, full input and output logging, secret management for the API key, and the ability to trigger on a schedule or an event. Swapping OpenAI for Anthropic or Gemini is a single provider change, and the enriched output flows into downstream tasks (Slack, a warehouse, another flow) with tracked lineage a bare API call cannot give you.

Prerequisites

  • A running Kestra instance with the AI plugin available.
  • (Optional) An API key for OpenAI, Anthropic, or Google Gemini to enable enrichment.
  • (Optional) A Slack incoming webhook for notifications.

Secrets

The default green path uses no secrets. Optional steps use:

  • OPENAI_API_KEY (or ANTHROPIC_API_KEY / GEMINI_API_KEY): the key for whichever provider you enable on the enrich task. OpenAI is the default.
  • SLACK_WEBHOOK: Slack incoming webhook URL for the notify task.

Quick start

  1. Add this flow to your Kestra instance and Execute it. It runs green with no setup.
  2. To enrich with an LLM, add your provider key under Tenant > Secrets (namespace scoped).
  3. Remove disabled: true from the enrich task and from ai_result to see the model output. The default provider is OpenAI; to use Anthropic or Gemini instead, swap the provider block (the flow shows the exact lines).
  4. (Optional) Enable notify and a trigger to alert and automate.

How to extend

  • Swap the provider from OpenAI to Anthropic (io.kestra.plugin.ai.provider.Anthropic) or Google Gemini (io.kestra.plugin.ai.provider.GoogleGemini) by replacing the provider block.
  • Point extract at your own data source instead of the public sample.
  • Use structured output to get typed JSON back instead of free text.
  • Route the result to a warehouse, a ticket, or another flow.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.