All jobs

Budget vs Actual Variance Analysis in QuickBooks

A bookkeeping firm for nonprofits gives each client an agent that reads the client's QuickBooks budget and actuals each month and explains every line off budget.

Run this on RushOpens the console with this prompt ready to send. Connect QuickBooks there first.

What the agent does

This is for a bookkeeping firm whose clients are nonprofits: food banks, arts groups, youth programs, each with a board-approved annual budget entered in QuickBooks Online and often split by program or grant with classes. Every month the bookkeeper sends the treasurer a budget vs actual package, and the part that takes the time is not the numbers but the variance notes: why program supplies ran 40% over in October, whether a shortfall in grant revenue is timing or a real gap, which line was simply budgeted in the wrong month. The firm gives each client an agent that reads that client's books, builds the comparison and drafts the notes for the bookkeeper to edit.

The firm connects its own QuickBooks company once and saves the agent as a template with POST /o/{org}/agents, naming quickbooks in connections and instructions that allow reads only. When a client signs on, the firm's client portal calls POST /o/{org}/agents {"template": "<template id>", "name": "budget-<client id>"}, stores the agent id against the client, then calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "quickbooks"} and shows the authorize_url to the client's finance contact inside the portal. They sign in on Intuit's page, Rush stores the company's realm id as that agent's account, and the firm registers no Intuit app of its own.

A run reads the budget first. QuickBooks keeps it as a Budget entity, so the agent queries select * from Budget and picks the active one whose StartDate and EndDate cover the month and whose BudgetType is profit and loss. Each BudgetDetail line carries an AccountRef, a BudgetDate, an Amount, and, when the budget was split that way, a ClassRef, DepartmentRef or CustomerRef. The agent keeps those splits, because a nonprofit's budget by class is usually its budget by program or grant. If the client has two active budgets for the same year, the agent stops and asks which one the board approved instead of picking.

Then it reads actuals from the ProfitAndLoss report for the month and the fiscal year to date, with summarize_column_by set to Month, the accounting_method the client's budget was built on, once in total and once filtered to each class the budget uses. It matches report rows to budget lines by account, adds both up for the month and the year to date, and computes the variance in dollars and percent. A line is flagged when it passes both thresholds the firm sets in the prompt, so a $40 line that is 300% over does not crowd the notes. For each flagged expense line it lists the largest transactions behind it from the matching detail rows, and for each flagged revenue line it says whether the budget spread the amount evenly while the money arrived in one month, a common source of timing variances in grant revenue. It records, changes and deletes nothing in QuickBooks.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "<agent id>",
  "input": "Budget vs actual for October 2026 and fiscal year to date (fiscal year starts 2026-07-01). Read only. Query the Budget entity and use the active profit and loss budget covering October 2026; if more than one matches, stop and list them. Keep each BudgetDetail line's account and class. Read the ProfitAndLoss report for 2026-10-01 to 2026-10-31 and 2026-07-01 to 2026-10-31 with summarize_column_by=Month and accounting_method=Accrual, once in total and once for each class the budget uses. Match rows to budget lines by account and class. For every line compute actual, budget, variance in dollars and percent, for the month and year to date. Flag a line when the month variance is over $500 and over 10%. For each flagged expense line list its five largest October transactions (date, payee, amount, memo). For each flagged revenue line, say whether the budget spreads the amount evenly while the actual arrived in fewer months. Write variance.md: a summary table by class, then one draft note per flagged line in plain words for a nonprofit treasurer, marked DRAFT. Write variance.csv with one row per line. List any account with actuals but no budget line, and any budget line whose account is inactive. Create, change or delete nothing in QuickBooks."
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

Each run produces a budget vs actual table by class, with a draft note for every line off budget. It comes back as variance.md and variance.csv, the second holding every budget line, as session artifacts. The firm's webhook handler matches the run.completed event to the client by the execution_id it stored, files both, and opens a review task for the bookkeeper on that client.

The bookkeeper reads the notes against what they know about the client: a note can say that program supplies are over because of three large purchases from one vendor, but only the bookkeeper or the executive director knows whether that was the planned fall event bought early. They also check the two lists at the end. An account with actuals and no budget line usually means a new account was added mid-year, and a budget line on an inactive account means the budget points at an account that was merged away, so its whole amount shows as unspent.

Nothing in the package goes to the treasurer or the board until the bookkeeper has edited it. The agent writes no conclusions about whether a program should be cut or a grant renegotiated; it shows where the money went against the plan.

Run it on every month close, per client

When the bookkeeper marks a client's month as closed in the firm's portal, the portal sends one POST /o/{org}/sessions with that client's agent id as agent, the month, fiscal year start and the client's thresholds in input, and a request_id that is a UUID v5 of the client id and month, so a double click starts one run. Starting from the close, rather than from a fixed date, means the agent never reads a month that still has unreconciled bank lines.

Before starting, the portal reads GET /o/{org}/agents/{agent}/connections. When the QuickBooks connection's status is needs_reauth, which happens when someone at the client revokes Rush's access in Intuit, it asks the client's finance contact to sign in again instead of starting a run that cannot read the books.

The use case this job follows, with its automation and trigger: Run an agent per customer task.

Why run it on Rush?

Each client's QuickBooks sign-in is held in Rush's connection under that client's agent, so the firm stores no Intuit tokens and one client's run cannot open another client's company. Each session lists the QuickBooks realm id it acted as in accounts, and GET /o/{org}/sessions?account=<realm id> lists every run that read a given client's books, which answers a board member who asks who has looked at their ledger.

Each run gets its own computer for the budget lines, report rows and transaction details it reads, and a record of every QuickBooks call it made. At month end the firm's clients close on different days, and each close starts its own run, so a late client never waits behind a large one. GET /o/{org}/sessions?agent=<agent id> adds up total_cost_usd per client, which shows the firm what the package costs to prepare for each account.

Frequently asked questions

What if the client never entered a budget in QuickBooks?

The agent finds no active Budget for the month and stops, saying so in variance.md. Some clients keep the budget in a spreadsheet instead; the firm can enter it in QuickBooks once a year, or attach the spreadsheet to the run as a file and change the prompt to read the budget from it.

Does it handle budgets split by program or grant?

Yes, when the split is in QuickBooks. A BudgetDetail line can name a class, department or customer, and the agent reads the profit and loss report filtered to the same class, so each program's comparison uses only that program's activity. A split that exists only in someone's head shows up as one budget line against one actual line.

Why does the agent ask which budget to use?

QuickBooks allows several budgets for one fiscal year, and organizations often keep a draft and an approved version side by side. Guessing would compare actuals to a plan the board never voted on, so a run that finds two stops and lists both.

Can the agent post adjusting entries for the variances it finds?

No. QuickBooks' sign-in grants accounting access, but the template's instructions and every prompt allow reads only, and the run's record shows each call it made. Entries stay with the bookkeeper.

More QuickBooks jobs

More jobs like this: Run an agent per customer task

Keep reading