Post #2 Companion — The CFO & AI Series

Inside the AI CFO Agent:
What It Does, Step by Step

A visual walkthrough of how the agent works — from raw data to a board-ready report. No chatbot. No button pressing.

📄 Boris Dračka · ⏱ 4 min read · 📦 Code on GitHub
The core idea
Why this is different from a chatbot

In Post #2, I explained the difference between a chatbot and an agent. Here I want to show you exactly what that difference looks like — not in theory, but in practice.

A chatbot waits. You have to open it, type a question, and interpret the answer yourself. An agent runs on its own. It pulls data, processes it, computes KPIs, writes a report, and delivers it — without anyone sitting in front of a screen.

"The question isn't whether AI can help with finance. It's whether you're buying a tool that makes one person faster — or building a system that makes a whole process disappear."

Below is the exact pipeline this agent runs. Every step. In order. Automatically.


The pipeline
5 steps. Zero button presses.
This runs every Monday morning at 7:00 AM. The CEO opens their inbox and the report is already there.
1
🔌
Pull data from the source
The agent connects directly to your accounting system — ERP, Xero, QuickBooks, or a Google Sheet. No manual CSV exports. No emails. It retrieves exactly what it needs: GL balances, revenue figures, payroll, accounts receivable.
Automated data retrieval
2
🧹
Clean and transform the data
Real accounting data is messy. Duplicate entries, inconsistent category names, rounding differences. The agent applies transformation rules to normalize everything before any number gets calculated. This step alone used to eat a full Monday morning for a junior analyst.
Validation · Normalization · Deduplication
3
📐
Calculate KPIs
With clean data, the agent computes the metrics that matter — gross margin, burn rate, DSO, operating leverage, revenue growth. Using the same formulas, every time. Not whoever happened to build the model this quarter.
Gross Margin · Burn Rate · DSO · Operating Leverage
4
🤖
Generate the AI narrative report
The KPIs go into a structured prompt. The AI writes a CFO-grade commentary — what moved, why it matters, what risks to watch, and one concrete action. Not a template. Not copy-paste. A fresh analysis generated from the actual numbers every single time.
Gemini API · Structured prompt · Narrative output
5
📬
Deliver the report
The finished report lands in the right inbox — CEO, board, finance team. Via email, Slack, or a shared dashboard. Formatted. Ready to read. No one had to stay late Sunday to make it happen.
Email · Slack · Dashboard

Step 3 output
What the KPI dashboard looks like
Sample numbers from a SaaS company. The agent produces this in under a second — from raw data.
Sample output Acme SaaS Ltd. · May 2026
66.0% Gross Margin ▲ +1.5pp vs last month
+$40K Net Income ● Profitable
$0 Burn Rate ● Cash-flow positive
+9.6% Revenue Growth MoM ▲ Growing
7d Days Sales Outstanding ⚠ Watch trend
2.4x Operating Leverage ▲ Scaling efficiently

Each card is color-coded: green = healthy, amber = watch, red = action needed.


Step 4 output
What the AI report looks like
The agent writes this from scratch using the actual KPIs. The narrative changes every month based on what the numbers say.
cfo-report-2026-05.txt AI-Generated
Generated: Monday, May 27, 2026 — 07:00 AM

May 2026 closed on a strong note. Revenue reached $285,000 — up 9.6% month-over-month — while gross margin expanded to 66.0%, reflecting disciplined cost management on the COGS side. The business is operating profitably with net income of $40,000, and cash reserves stand at $1.24M with no active burn rate to speak of.

The clearest improvement this month is operating leverage: at 2.4x, the business is growing revenue faster than it is growing costs. That is the dynamic you want to see at this stage. Operating expenses actually declined by $7,000 compared to April despite the revenue increase — that is not an accident, and it should be explicitly recognized in the board discussion.

Two risks warrant attention heading into June. First, days sales outstanding came in at 7 days — healthy in isolation, but the accounts receivable balance has tightened alongside it. If payment terms shift with any key customers, this metric can deteriorate quickly and will need to be watched weekly, not monthly. Second, the revenue growth rate of 9.6% is strong but was partially driven by a single large contract close. Organic baseline growth without that contribution is closer to 4%, which is below the trajectory needed to hit Q3 targets.

Recommendation: initiate a pipeline review for June with specific focus on whether the contract funnel supports sustained growth above 7% MoM. The margin and cost structure are healthy — the variable is entirely on the top line.


Under the hood
What this is actually built with
Nothing exotic. Tools that have been available for years — most of them free.

🔌 Data source

Connects to any system that exports CSV or has an API. Google Sheets works perfectly for getting started.

Google Sheets → CSV → Python

🧠 AI model

Google Gemini API for generating the narrative report. Free tier is sufficient for weekly reports.

gemini-2.0-flash

⏰ Scheduler

A GitHub Action triggers the agent every Monday morning. Free. No server needed. Runs in the cloud.

cron: '0 7 * * 1'

📬 Delivery

The report is emailed via Gmail SMTP or posted to a Slack channel. About 10 lines of code.

Gmail SMTP / Slack webhook

Want to build this
yourself?

The full source code for this agent is on GitHub. Clone it, plug in your numbers, and run it — the README walks you through every step.

github.com/LuliBobo/cfo-agents

What's in the repository

  • Complete Python script for the 5-step pipeline
  • Sample financial data (CSV) to test with immediately
  • Gemini API integration with prompt template
  • GitHub Actions workflow for weekly automation
  • README with step-by-step setup guide (30 minutes)