New to Kestra?
Use blueprints to kickstart your first workflows.
Automate book chapter summaries with Kestra and Perplexity AI. Generate a search-grounded recap, format it as HTML, and email the result in one flow.
Turn any book chapter into a clear, search-grounded summary delivered straight to your inbox. This Kestra flow chains two Perplexity AI calls and an SMTP send so you can read a chapter, capture what it covered, and get a polished recap email without copy-pasting prompts or wrangling output formats by hand. It is a practical pattern for AI summarization, retrieval-augmented recaps, and automated email delivery built entirely from declarative YAML.
book (a STRING, defaulting to "The Hunger Games by Suzanne Collins") and chapter (an INT for the chapter you just finished).get_chapter_summary task calls io.kestra.plugin.perplexity.ChatCompletion with a SYSTEM prompt that asks for a clear, concise summary mixing paragraphs and bullet points, and a USER prompt built from your book and chapter inputs. The search-grounded sonar model keeps the recap factual.convert_to_html task feeds {{ outputs.get_chapter_summary.rawResponse }} into a second ChatCompletion call that reformats the plain summary into a clean HTML snippet and appends a Resources section linking the sources Perplexity used.send_summary task uses io.kestra.plugin.email.MailSend to deliver {{ outputs.convert_to_html.outputText }} over Gmail SMTP (smtp.gmail.com, port 465) with a subject line built from the book title and chapter number.pluginDefaults block applies the Perplexity apiKey, model: sonar, and temperature: 0.7 to every ChatCompletion task so configuration stays in one place.Perplexity's API answers one prompt at a time and has no scheduler, no retry logic, and no memory of prior steps. Kestra wraps the whole chain in declarative YAML: you can add event or schedule triggers to summarize on a cadence, set retries on the API and SMTP tasks for transient failures, and pass outputs between tasks with clear lineage from input to delivered email. The orchestrator handles the glue that the LLM API alone cannot.
sonar model.host, port, from, and to for another provider).PERPLEXITY_API_KEY: authenticates the Perplexity ChatCompletion tasks.G_EMAIL: the SMTP username for the sending Gmail account.G_APP_PASSWORD: the Gmail app password used as the SMTP password.PERPLEXITY_API_KEY, G_EMAIL, and G_APP_PASSWORD secrets to your Kestra instance.from and to addresses in the send_summary task to your own email.book title and the chapter number.