Python — Automation Systems

Automation for Agency Client Reporting

Direct answer

Agency reporting automation is a pipeline: pull metrics from each platform's API on a schedule, normalize everything into one metrics table per client, compute the numbers deterministically in code, then render branded reports from templates — with an optional LLM pass that writes commentary from the computed figures but never does its own math. Done well, the monthly cycle collapses from analyst-days of copy-paste into a review-and-send step.

Client reporting is the tax every agency pays on its own success: more clients means more end-of-month scrambling, and the hours are rarely billable. I've built reporting pipelines for agency-style businesses, and the difference between a fragile dashboard project and a system the team trusts comes down to a few architectural choices covered here.

Key facts, with sources

  • Grand View Research sized the robotic process automation market at $4.68 billion in 2025 and projects it to reach $35.84 billion by 2033, a 29.0% compound annual growth rate. (Grand View Research)
  • Gartner's worldwide market share analysis found RPA software generated about $3.8 billion in revenue in 2024, an 18% year-over-year increase, even as generative AI and agentic tools slowed the segment's growth rate. (Gartner)
  • TestGuild's 2025 survey put Playwright at 45.1% adoption among QA professionals with a 94% retention rate, versus 22% and declining for Selenium. (TestDino)
  • Playwright job postings grew 180% year over year in 2025, making it the fastest-growing category in QA automation hiring. (TestDino)
  • Playwright leads browser automation tooling with roughly 30 million weekly npm downloads compared to Cypress at 6.5 million, after growing from about 1.2 million weekly downloads in January 2022. (Tech Insider)

Reporting is unbilled hours and quiet errors

The visible cost of manual reporting is time — often a meaningful chunk of an account manager's month spent exporting CSVs, pasting into slide decks, and rewriting the same three insights per client. The less visible cost is errors, and those are worse: last month's numbers left in a template, a chart from the wrong client, a metric computed slightly differently by two analysts. Every one of those erodes exactly the trust the report exists to build.

Automation attacks both at once. The hours drop because the pipeline does the collection and assembly; the errors drop because numbers are computed one way, by code, from source data — not re-derived by hand in a spreadsheet at 6 p.m. on deadline day.

Pull and normalize: one schema for every source

Each marketing and analytics platform gets its own small fetcher that authenticates, pulls the reporting window's data, and maps it into a shared schema — typically client, source, channel, metric name, period, and value. All downstream logic works against that one normalized table and stops caring where numbers came from. Adding a new platform to reports becomes writing one new fetcher, not touching every report.

I store raw API responses alongside the normalized rows. Platforms restate data, rename metrics, and occasionally return nonsense, and when a client questions a number, the raw payload is the evidence trail. It also means a bug in normalization gets fixed by reprocessing stored data rather than re-pulling from APIs with lookback limits.

Compute in code, narrate with an LLM

Every figure in the report — totals, period deltas, budget pacing, top movers — is computed deterministically in Python from the normalized table. Then, optionally, an LLM writes the narrative layer: it receives the already-computed metrics and produces the plain-language commentary clients actually read. The division is absolute: the model narrates numbers, it never generates them. Any figure in the prose must appear in the computed input, which makes hallucinated performance claims a checkable defect instead of a silent one.

Commentary still goes through human review before sending — an account manager skims it, tweaks tone, and catches context the pipeline can't know, like a campaign the client paused mid-month. The LLM eliminates the blank-page hour, not the accountability.

Render documents from templates, not dashboards

Agencies keep trying to replace reports with live dashboard access, and clients keep not logging in. Most clients want a document: something skimmable in two minutes, forwardable to their boss, and fixed in time so everyone discusses the same numbers. So the pipeline renders each report from an HTML template — per-client branding, sections toggled by service line — and converts to PDF for delivery.

Templates also enforce consistency across the roster. Every client gets the same rigor and structure regardless of which account manager owns them, and improving the template once upgrades every subsequent report.

Rendering a client report from a template
from jinja2 import Environment, FileSystemLoader

env = Environment(loader=FileSystemLoader("templates"), autoescape=True)
template = env.get_template("monthly_report.html")

html = template.render(
    client_name=client.name,
    period=period_label,
    metrics=computed_metrics,   # calculated in code, never by the LLM
    commentary=commentary,      # LLM-drafted prose, human-reviewed
    branding=client.branding,
)

The review queue, delivery, and the failure path

The pipeline's last stop before the client is a human: generated reports land in a review queue, the account manager approves or edits, and only then does automated delivery fire — email with the PDF, or upload to the client portal. Approval is deliberately cheap, a couple of minutes per client, because everything upstream has already been validated.

The failure path deserves equal design. If a platform's API fails or returns partial data for the window, that client's report is held with a clear reason, not sent with silent gaps — a report with a quietly missing channel is worse than a late one. The pipeline flags what's missing, retries the pull, and alerts the owner if the gap persists past a deadline buffer.

When to hire senior help

Bring in senior help when automations move from convenience scripts to business-critical paths, such as billing, order processing, or compliance reporting, where a silent failure has real financial consequences. An experienced engineer will add the monitoring, idempotency, and credential management that separates durable automation systems from fragile scripts. If your stack includes React Native + Python + AI, a senior engineer who owns the full product beats coordinating multiple juniors.

Bottom line

Dhairya Senjaliya ships Python — Automation Systems projects worldwide — book a scoping call to discuss your specific situation.

Common pitfalls to avoid

  • Automating a broken manual process as-is instead of mapping and simplifying it first, which just makes the inefficiency run faster
  • Building UI screen-scraping bots against internal apps that expose APIs, so every minor UI update breaks the automation
  • Running unattended automations with no monitoring or alerting, so a silently failing nightly job goes unnoticed until month-end numbers are wrong
  • Hardcoding credentials in scripts and running automations under a personal employee account, creating security exposure and a single point of failure when that person leaves

Frequently asked questions

How do agencies automate client reporting?

With a pipeline: scheduled fetchers pull metrics from each ad and analytics platform's API, normalize everything into one shared schema per client, compute totals and comparisons in code, and render branded PDF reports from templates. An account manager reviews each report in a queue before automated delivery. Optionally, an LLM drafts the narrative commentary from the computed numbers, subject to the same human review.

Can AI write client performance report commentary?

Yes, with one hard rule: the AI narrates numbers computed by code, it never calculates or invents them. Feed the model the finished metrics table and have it draft plain-language commentary, then route it through human review before sending — an account manager catches missing context like paused campaigns. This removes the blank-page hour per client while keeping every figure traceable to source data.

Should agencies send PDF reports or give clients dashboard access?

Send documents, in most cases. Dashboard logins go unused because clients want something skimmable, forwardable to their boss, and frozen in time so everyone discusses the same numbers. A templated PDF delivers that and enforces consistent structure across every client and account manager. Dashboards work as a supplement for the minority of clients who genuinely check numbers weekly, not as the primary deliverable.

Should we buy an RPA platform or build custom Python automation?

RPA platforms (a $4.68 billion market in 2025 per Grand View Research) suit non-technical teams automating legacy GUI workflows with vendor support. Custom Python automation is cheaper at scale, version-controllable, and testable, but requires engineering ownership. Teams with any engineering capacity usually get more durable results from Python plus APIs than from licensed bot seats.

What ROI should we expect from automation?

Returns depend on frequency times manual effort times error cost of the process automated; high-volume, rule-based back-office tasks recoup build cost fastest. The 18% annual growth Gartner measured in RPA spending reflects that companies consistently find positive returns, but the biggest wins come from processes measured first, automated second.

How do we stop automations from constantly breaking?

Prefer API integrations over UI automation wherever possible, add monitoring with alerts on both failures and anomalous outputs, and treat automation code like production software with version control and tests. Modern tooling like Playwright with auto-waiting selectors also breaks far less than legacy screen-position scripts.

Bottom line: Dhairya Senjaliya ships Python — Automation Systems projects worldwide. Book a scoping call at https://dhairyasenjaliya.com/#book-call.

Sources

Related guides

Keep up with new guides

New deep-dive guides on React Native, Python, and AI ship regularly. Subscribe via RSS or follow on LinkedIn.

Want help implementing this?

30-minute scoping call · Clear milestones · Senior engineer ownership