Complete AI Training

AI agent for financial analysts

Financial Model Formula Repair Agent

A model that passes all test cases after the repair.

Financial Model Formula Repair Agent: what goes in, what the agent does and what you get

What it does

Broken spreadsheet formulas create silent errors in finance models. When an error is reported, this agent traces the failing output back through its dependencies to the first formula that produces a wrong value. It forms a repair hypothesis, patches the formula in a copy, recalculates and runs the test cases. If a repair fixes one case but breaks another, for example by double-counting a subtotal, it restores the formula and revises its hypothesis. It accepts a fix only when all tests pass. The model owner approves replacing the live model; business assumptions are never changed by the agent. Edge case: the error comes from a hard-coded number, not a formula, so the agent flags it rather than guessing the right value.

How it works

Follow the arrows from top to bottom. The orange dashed arrow is the loop: when a check fails, the agent goes back and tries again.

Start and resultWhat it doesA check on its own workWaits for your OKGoes back and retries
Yes, continueApprovedNo 1 STARTS WHEN Model error reported 2 USES A TOOL Trace the failing output's dependencies 3 DOES Form a repair hypothesis for the first wrong formula 4 USES A TOOL Patch it in the copy and recalculate 5 CHECKS THE RESULT Do all test cases pass? If not: restore and revise the hypothesis. Back to step3. 6 YOU APPROVE Model owner approves replacing the live model 7 RESULT Tested repair proposal
Read the steps as a list
  1. Model error reported
  2. Trace the failing output's dependencies
  3. Form a repair hypothesis for the first wrong formula
  4. Patch it in the copy and recalculate
  5. Do all test cases pass?If not: restore and revise the hypothesis. Back to step 3.
  6. Model owner approves replacing the live modelThe agent waits here for your OK.
  7. Tested repair proposal

How it decides

It follows the dependency chain from the failing output to the first wrong formula and accepts a fix only when all tests pass.

  • Repair target: the first wrong formula in the dependency chain.
  • Accept a fix only when all test cases pass.
  • Hard-coded values are flagged, not changed.
  • After three failed hypotheses, hand the trace to the model owner.

Make it yours

Every agent is a starting point. You choose these settings for your own situation.

  • Test cases to run after every repair
  • Model copy location
  • Maximum repair attempts before asking the owner (default 3)
  • Who approves replacing the live model
  • Change log format

What keeps you in control

It always asks you first

  • Business assumptions
  • Replacing live models

Hard limits

  • Copy only.

It stops when

  • Done: tests pass.

Set it up

We guide you through the set-up, step by step

Members get the full set-up guide for this agent. No technical skills needed: you copy, paste and upload.

10 minto set it up in your AI
5 AIsChatGPT, Claude, Copilot, Gemini, Grok
  • One set of instructions to paste into your AI, with the clicks for ChatGPT, Claude, Microsoft 365 Copilot, Gemini and Grok
  • The agent then walks you through connecting your own data, one source at a time
  • A downloadable copy with the flow chart, the rules and the full guide
Get access to this agent

An example run

What happensOn August 8 the regional total in a sales model is $210,000 too high. The agent traces it to a SUM range. Its first fix double-counts the West subtotal, so test case 4 fails. It restores the original and corrects the range reference in the total instead. All 12 test cases pass. The model owner reviews the before-and-after and approves replacing the live model.

More agents for financial analysts