A weekly report agent is a scheduled agent with a fixed output: the same sections, the same sources, the same time every week. The report must be defined before the agent is built, because an agent that invents its own report format will write a different report every week. The check is the first report, read by a human, against the definition.
Before you start
The data sources the report needs, the report template, and a schedule for the run.
Define the report section by section
Write the report template: the sections, the numbers each one needs, and the source of each number. A section without a named source is a section the agent will invent.
Set the rules for missing data: a number that cannot be found is reported as missing, never guessed.
Schedule the run and the state
Schedule the agent to run at the same time each week, such as Monday at 07:00, and give it a state store where it records what it sent and when. The state is what stops a duplicate report if the run retries.
Make the run idempotent: a second run in the same week must not send a second report.
Check the first report against the template
Read the first report section by section against the template and check every number against its source. Count the wrong numbers, not just the missing ones: a wrong number in a report is worse than a missing one.
Fix the template or the sources where the numbers were wrong, then check the second report the same way.
Practice check: fictional Maple Corner weekly report, 4 sections, first run
The table below is fictional practice material, worked out by hand from the stated template. It is the expected result for the practice report, not a run of any agent.
| Section | Numbers | Correct | Verdict |
|---|---|---|---|
| Orders this week | 3 | 3 | Pass |
| Refunds this week | 2 | 2 | Pass |
| Top products | 3 | 2 | Fail – one wrong product |
| Open tickets | 1 | 1 | Pass |
Eight of nine numbers are correct; one top product is wrong. The fix is in the source query for that section, not in the agent, and the second report is checked the same way.
Expected result. UNTESTED: the counts in the practice table are worked out by hand, not measured by running an agent. Define your own report template with a named source per number, schedule the run, and check every number in the first report against its source.
Limits
- A number that cannot be found must be reported as missing, never guessed.
- A weekly report that changes format every week is not a report: freeze the template.
