Download icon
OllamaCLI icon
SlackIncomingWebhook icon

Summarize Documents with a Local Ollama Model

Summarize documents with a local Ollama model orchestrated by Kestra. Download a file, run llama3.2 on your own infrastructure, and notify Slack.

Categories
AI

Every summarization call to a cloud LLM ships your document to someone else's servers and bills you per token. This blueprint keeps both: io.kestra.plugin.ollama.cli.OllamaCLI runs llama3.2 (or any Ollama model you pass as an input) directly where Kestra executes, so the document never leaves your network and the only cost is compute you already own. The flow downloads a page, summarizes it in three bullet points, stores the result as an execution artifact, and tells Slack where to find it.

How it works

  1. download_page (io.kestra.plugin.core.http.Download) fetches the document at page_url into Kestra internal storage, so the model always sees the exact bytes the execution recorded.
  2. summarize (io.kestra.plugin.ollama.cli.OllamaCLI) maps the stored file into the working directory through inputFiles, runs ollama run {{ inputs.model }} with a summarization prompt that inlines the file via $(cat input.txt), and redirects the answer to summary.txt.
  3. outputFiles uploads summary.txt to internal storage, making it a downloadable execution artifact and addressable as {{ outputs.summarize.outputFiles['summary.txt'] }}.
  4. enableModelCaching: true persists the pulled model between runs, so only the first execution pays the model download.
  5. notify posts a Slack message pointing at the artifact. The summary content itself stays out of the JSON payload on purpose, since raw LLM output can contain quotes and newlines that break message payloads.
  6. The errors block posts a distinct alert when the download or the model run fails.

What you get

  • Fully local summarization: no API key, no per-token cost, no document leaving your infrastructure.
  • The summary as a first-class execution artifact, downloadable from the UI and consumable by downstream tasks.
  • A model picker as a flow input, so the same flow serves quick drafts on a small model and careful passes on a large one.
  • Model caching that makes every run after the first start in seconds instead of re-pulling gigabytes.

Who it's for

  • Platform teams offering LLM summarization as an internal service without routing company documents through external APIs.
  • Engineers processing docs, changelogs, or reports on a budget of zero API spend.
  • Anyone evaluating the Ollama plugin who wants a complete download-infer-notify pipeline in one copy-paste.

Why orchestrate this with Kestra

Running ollama run in a terminal works once; running it as a service needs what Kestra adds around the same command: a typed input for the model name, internal storage passing the document in and the summary out, execution history recording which model summarized which document, and Slack notification with failure alerting. Swap the HTTP download for an S3 download or a file trigger and the inference task does not change.

Prerequisites

  • The default containerImage runs Ollama inside Docker, so the Kestra worker needs access to a Docker daemon. On self-hosted workers that already have Ollama installed locally, set the task's taskRunner to Process to use the local install directly.
  • Enough disk and memory for the chosen model; llama3.2 runs comfortably on CPU-only machines.
  • A Slack incoming webhook for notifications.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL.

Quick start

  1. Add the SLACK_WEBHOOK_URL secret to your Kestra namespace.
  2. Execute the flow with the defaults; the first run pulls llama3.2, later runs reuse the cached model.
  3. Open the Slack message, then download summary.txt from the execution's outputs.

How to extend

  • Point page_url at your own docs, incident reports, or meeting notes, or replace the download with an S3 or GCS task.
  • Ask for JSON instead of bullets and parse it downstream, as shown in the Ollama structured extraction blueprint.
  • Process many documents per run with a shell loop inside commands, as shown in the Ollama batch classification blueprint.
  • Chain a translation or rewrite pass by adding a second OllamaCLI task that takes summary.txt as its inputFiles.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.