AIAgent icon
GoogleGemini icon

Summarize Text with an AI Agent, Generate Multilingual Summaries in Short, Medium, or Long Format

Build an AI agent text summarizer in Kestra. Generate short, medium, or long summaries in seven languages with Google Gemini, then chain a one-sentence English recap.

Categories
AI

Turn long, messy text into clean, factual summaries on demand using an AI agent. This blueprint automates multilingual text summarization with the Kestra AI plugin and Google Gemini, letting you pick the summary length and output language at runtime. It solves a common content problem: large volumes of documents, articles, tickets, and transcripts that need to be condensed quickly and consistently, without copy-pasting into a chat UI or writing custom glue code for every downstream system.

How it works

  1. Three inputs drive the run: summary_length (a SELECT of short, medium, long), language (a SELECT of ISO codes en, fr, de, es, it, ru, ja), and text (the STRING content to summarize, with a default example).
  2. The multilingual_agent task (io.kestra.plugin.ai.agent.AIAgent) summarizes the input. Its systemMessage enforces a precise, factual tone and maps each length choice to a strict format: 1-2 sentences for short, 2-5 for medium, up to 5 paragraphs for long.
  3. The english_brevity task (a second io.kestra.plugin.ai.agent.AIAgent) chains off the first, reading {{ outputs.multilingual_agent.textOutput }} to produce exactly one English sentence for previews or indexing.
  4. pluginDefaults wires both agents to the io.kestra.plugin.ai.provider.GoogleGemini provider on gemini-2.5-flash, with request and response logging enabled.

What you get

  • On-demand summaries in seven languages from a single declarative flow.
  • Length control (short, medium, long) selected per execution.
  • A guaranteed one-sentence English recap for cards, search indexes, or alerts.
  • Repeatable, low-noise output thanks to explicit system instructions.

Who it's for

  • Data and platform engineers building content pipelines.
  • Knowledge and support teams condensing tickets, docs, and transcripts.
  • Product teams generating previews, snippets, and search metadata.

Why orchestrate this with Kestra

A model API call alone has no scheduler, no retries, and no record of what ran. With Kestra you can trigger summarization from events (a new file, a webhook, an upstream flow), add automatic retries when the provider throttles, and capture full execution lineage and outputs for audit and replay. Everything is declarative YAML, version controlled, and the chained textOutput passing makes multi-step agent logic explicit, something a bare LLM SDK or a model provider's own playground cannot orchestrate.

Prerequisites

  • A Kestra instance (open source or Enterprise).
  • A Google Gemini API key with access to gemini-2.5-flash.

Secrets

This flow reads the Gemini credential from the Kestra KV store, not a secret:

  • GEMINI_API_KEY via {{ kv('GEMINI_API_KEY') }}

Quick start

  1. Add your Gemini API key to the KV store under the key GEMINI_API_KEY.
  2. Add this blueprint to a namespace in your Kestra instance.
  3. Execute the flow, picking a summary_length, a language, and pasting your text.
  4. Inspect the outputs: the multilingual summary and the one-sentence English recap.

How to extend

  • Swap io.kestra.plugin.ai.provider.GoogleGemini for another supported provider or model.
  • Add a trigger (schedule, webhook, or flow trigger) to summarize incoming content automatically.
  • Persist results to storage, a database, or Slack by adding downstream tasks.
  • Add more languages to the language input or feed text from a file or API response.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.