Skip to content

Use case

The Weekly Executive Report ​

Assemble the Monday report on a schedule, and stop with an error when a source is down instead of producing a report with a hole in it.

  • Stack Cognipeer Flows + agent schedule trigger
  • Pattern Flow · Reporting
  • Read ~5 min

Overview ​

Every Monday, three people pull numbers from four systems and paste them into a deck. This flow calls each system, checks the answers, asks a model to write the narrative from the numbers, renders a PDF and mails it.

Enterprise module

Flows is the enterprise flows module. See Flows.

The shape of the flow ​

Start
  |
  v
HTTP request (sales API)  --> HTTP request (support API) --> HTTP request (finance API)
  |
  v
Condition: all three answered with data?  --false--> End (Finish as: Failed)
  |true
  v
LLM (narrative from the numbers) --> Create PDF --> Save file --> Send email --> End

Build it ​

  1. Pull the numbers. One HTTP request step per source. Put credentials in Config items and choose them under Authentication (Bearer token, Basic or Custom header) with Secret; they never appear in the step text. Leave Fail on 4xx / 5xx on, set a Timeout, and give each step an Attempts retry for flaky sources.
  2. Fail fast, on purpose. Add a Condition that checks each response has the fields the report needs. On the false branch use End with Finish as Failed and an Error message naming the missing source. A failed run shows up in the runs list; a report with a quiet hole does not.
  3. Write the narrative from the numbers. An LLM step gets the checked numbers in its Prompt and instructions to describe only what the numbers show: no figures that are not in the input, week-over-week movement first, then risks.
  4. Produce the artefact. Create PDF (source Markdown), then Save file (content Base64) into a bucket, and Send email to the readers with the narrative in the body. Declare the file id as a flow output.
  5. Run it on a schedule. A flow has no schedule of its own. Expose it as a tool on a Smart Agent (Expose as tool on the flow) and add a schedule trigger to the agent, for example 0 7 * * 1 with your time zone and a prompt such as "Run the weekly report". Or call the Flows API from your own scheduler.

Pitfalls ​

  • A test run is a real run. It calls the real systems and sends real email. While building, point Send email at a test mailbox.
  • Do not let the model do arithmetic. Compute totals in the flow (a Transform or Run code step) and give the model the results.
  • Check the failure path. Switch a source off once and confirm the run fails with your message.