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

This is a personal, non-commercial side project I built to learn — not a product or service, and not connected to any company I work with.

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 a set of 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
These are 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. Not a template. 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

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 SendGrid or posted to a Slack channel. Takes about 10 lines of code.

SendGrid API / 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)