Request icon
Download icon
Parse icon
ChatCompletion icon

AI Annual Report Finder and Data Strategy Summary

Kestra pipeline that searches for an annual report PDF, downloads it, extracts text with Apache Tika, and produces an OpenAI summary of the data strategy.

Categories
AI

Go from a company name to a cited summary of its data and IT strategy in one run. This Kestra blueprint queries the Google Custom Search API for the company's annual report PDF, downloads the first hit into internal storage, extracts the full text with Apache Tika, and asks an OpenAI model to summarize the report with a deliberate focus: data services, data orchestration, real-time data, analytics, and IT infrastructure, quoting the source text where possible. Both the original PDF and the markdown summary are exposed as typed flow outputs, so a parent flow, an app, or an API caller can consume them directly. It is a practical document-intelligence skeleton for sales research, competitive analysis, or investment screening.

How it works

  1. The look_for_report task (io.kestra.plugin.core.http.Request) calls the Google Custom Search API with the query "company annual report filetype:pdf", authenticated by GOOGLE_SEARCH_API_KEY and the search engine id GOOGLE_SEARCH_CX.
  2. The download_report task (io.kestra.plugin.core.http.Download) extracts the first result link with jq and streams the PDF into Kestra internal storage.
  3. The extract_text task (io.kestra.plugin.tika.Parse) converts the PDF to plain text with contentType: TEXT and store: false, keeping the extracted content inline at outputs.extract_text.result.content.
  4. The summary task (io.kestra.plugin.openai.ChatCompletion) prompts the model chosen in the model SELECT input (defaulting to gpt-4o-mini) at a low temperature of 0.3 for factual output, instructing it to quote the report in support of every claim.
  5. Flow outputs publish the PDF as a FILE output named report and the markdown text as the summary string.

What you get

  • A hands-free pipeline from company name to sourced strategy summary.
  • Robust PDF text extraction with Apache Tika, no custom container images or parsing scripts.
  • A focused analyst prompt that surfaces orchestration, analytics, and infrastructure plans rather than generic financial recaps.
  • Typed flow outputs (file plus string) ready for subflows, Apps, or API consumers.

Who it's for

  • Sales and solutions engineers researching a prospect's data stack before a call.
  • Analysts and strategy teams screening many companies for infrastructure investments.
  • Data teams building document-intelligence pipelines who need a proven fetch-parse-summarize skeleton.

Why orchestrate this with Kestra

Scripting this means juggling a search API client, temp files for a large PDF, a parsing library, and an LLM SDK, with nothing persisted when a step fails. Kestra chains the same steps declaratively: internal storage moves the PDF between tasks without local disk, the Tika plugin handles extraction for dozens of formats beyond PDF, secrets keep all three API credentials out of the YAML, and each execution stores the exact search result, document, and prompt for reproducibility. Add a schedule or a ForEach over a company list and the one-off becomes a screening service.

Prerequisites

  • A Google Programmable Search Engine configured to search the web, plus its API key and engine id.
  • An OpenAI API key with access to the selected model.
  • Enough model context for the extracted text; very large reports may need truncation or chunking.

Secrets

  • GOOGLE_SEARCH_API_KEY: Google Custom Search JSON API key.
  • GOOGLE_SEARCH_CX: Programmable Search Engine id (cx) used for the query.
  • OPENAI_API_KEY: OpenAI API key used by ChatCompletion.

Quick start

  1. Create a Programmable Search Engine at programmablesearchengine.google.com and enable the Custom Search JSON API.
  2. Add the three secrets above to your Kestra namespace.
  3. Execute the flow with a company name such as the default Snowflake.
  4. Download the PDF from the report output and read the markdown summary output.

How to extend

  • Loop over a list of companies with io.kestra.plugin.core.flow.ForEach and aggregate summaries into one digest.
  • Post the summary to Slack or Notion, or store it in a warehouse for later retrieval.
  • Truncate or chunk result.content in a Python task before the LLM call for very long reports.
  • Swap OpenAI for Gemini or Anthropic chat tasks, or use io.kestra.plugin.ai.agent.AIAgent with a JSON schema to extract structured fields like planned cloud migrations.
  • Add a validation step that checks the downloaded file is really a PDF before parsing.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.