PDF Report Builder: A Workflow Script Tutorial
Learn how to build a Workflow Script that researches a topic, writes a structured report, and outputs it as a downloadable PDF.
User provides a topic. The script researches it on Google, writes a structured report, and outputs it as a downloadable PDF.
Why build this
This tutorial introduces the Generate Asset action, which converts content into a file — in this case a PDF. You’ll see how a script can chain research, text generation, and asset creation into a single workflow that outputs a downloadable file rather than inline text. It’s the pattern behind any workflow where the result needs to leave the interface as a document.
Blocks you’ll use
- User Input — Collects the topic the user wants to research and generate a report on.
- Run Script — Houses the Workflow Script. Inside the script, a Search Google action researches the topic, a Generate Text action writes the structured report, and a Generate Asset action converts it to a PDF.
- Display Content — Shows a download link to the generated PDF.
Canvas flow
Start → User Input → Run Script → Display Content → End
The Run Script block is where your Workflow Script lives. It chains three actions — Search Google, Generate Text, and Generate Asset — to research a topic, write a structured report, and convert it to a downloadable PDF returned under the key pdf.
How to build it
-
Open the Automations Canvas — Open MindStudio. The Automations Canvas is displayed by default. You’ll see a Start block and an End block already in place.
-
Add a User Input block — Click + to add a block and select User Input. In the block settings on the right, click + to add a user input, then click Create New. Set the Type to Short Text and enter
topicin the Variable field — this is the name you’ll use to reference this input in the Run Script block. Set the Label to a short name — for example, “Topic”. Then set the Help Text to a description the user will see — for example, “What topic should the report cover?”Once you’ve set up the user input, click the Main.flow tab at the top of the editor to return to the workflow.
-
Add a Run Script block — Click + in the workflow, then select View All Blocks. From the Blocks screen, search for Run Script and select it. In the block settings, click Edit Script to open the script editor. Paste the prompt below to generate the script automatically.
Generate a script that takes a topic as input. Use a Search Google action to research the topic. Use a Generate Text action to write a structured report with a title, executive summary, key sections, and conclusion. Then use a Generate Asset action to convert the report into a downloadable PDF. Return the PDF URL under a key named pdf.- Return to the workflow — Once the script is generated, click the Main.flow tab to return to the workflow. The Input Variables and Output Variables settings will appear in the block settings on the right.
- Configure Input Variables — For the
topicparameter, set the Variable to{{topic}}. - Configure Output Variables — Confirm that
pdfis mapped to the variable{{pdf}}.
-
Add a Display Content block — Click + and select Display Content. Connect it after the Run Script block. In the block settings, set the Message field to
[Download Report]({{pdf}})— using Markdown link syntax to render the PDF URL returned by the script as a clickable download link. This displays the link to the generated report to the user. -
Name your AI agent — Click Untitled Agent at the top of the interface, then update the Agent Name field — for example, “PDF Report Builder.”
-
Preview your AI agent — Click the Preview button, then select Open Draft Agent to run the AI agent and test your workflow.
Try it in MindStudio
Open MindStudio and follow along with this tutorial. No coding required.