The Tech ArchiveThe Tech ArchiveThe Tech Archive
Small BusinessMarketingDevelopers
ArticlesTopicsSeriesAbout

Get the practical AI brief

Verified, no-hype AI tips you can actually use - in your inbox. Free.

No spam. We verify what we send. Unsubscribe anytime.

The Tech ArchiveThe Tech Archive

The Tech Archive

AI news, analysis & explainers

AboutSmall BusinessMarketingDevelopersArticlesTopicsSeriesMethodologyAI DisclosureCorrections

© 2026 All rights reserved.

Back to home
0 readers reading
  1. Home
  2. Articles
  3. Artificial Intelligence
  4. From Hallucinations to 92% Accuracy: The 'REPL' Blueprint for Financial AI Agents

Contents

From Hallucinations to 92% Accuracy: The 'REPL' Blueprint for Financial AI Agents
Artificial Intelligence

From Hallucinations to 92% Accuracy: The 'REPL' Blueprint for Financial AI Agents

Learn why finance AI agents fail at Excel and how a persistent REPL with verification loops can push accuracy to 92%. A blueprint for reliable automation.

Sham

Sham

AI Engineer & Founder, The Tech Archive

5 min read
0 views
July 8, 2026

Verdict: Traditional AI agents fail at spreadsheets because they treat workbooks as flat text rather than structured programs. The industry is shifting from "tool-chaining" (sequential API calls) to a persistent REPL architecture combined with high-fidelity verification loops. This shift has demonstrated an internal accuracy jump from 50% to 92% on complex financial benchmarks, making autonomous finance agents viable for enterprise production in 2026.

Why Finance AI Agents Fail at Spreadsheets

While a human analyst instantly grasps the structure of a P&L summary or a revenue table, a Large Language Model (LLM) initially perceives an Excel file as a flat collection of cell values and nested formulas. Academic research and early 2026 field reports show that models like Claude Fable 5 and GPT-5.6 still struggle with "quiet mistakes"—hallucinating formula results or misinterpreting formatting context.

The root cause isn't the model's intelligence, but the interface. Chaining 15+ separate tools (e.g., read_cell, write_cell, search_label) leads to high latency, context fragmentation, and frequent timeouts. By the time an agent reaches step 10, it has often lost the thread of the original financial logic.

The Breakthrough: The Persistent REPL Architecture

The most successful spreadsheet agents have abandoned static tool-calling for a Node.js REPL (Read-Eval-Print Loop). Instead of asking for cell values one by one, the agent writes a JavaScript script that explores the workbook, stores variables in persistent state, and iterates mid-task.

Capability Old Method (Tool-Chaining) New Standard (Persistent REPL)
Discovery 10-15 sequential API calls 1-2 scripts with shared variables
State Forgotten between turns Persistent variables across steps
Logic Handled by LLM reasoning Handled by code + LLM supervision
Latency High (round-trips per cell) Low (interleaved reasoning/action)

This architecture allows agents to use Vibe Coding principles to build complex financial models in minutes rather than hours. It also makes "API evolution" trivial: new methods are added to the JavaScript library rather than requiring a complete tool-schema update.

Building the "Self-Verification" Loop

For an agent to master Excel, it needs a "source of truth" to check its own work before reporting back. This requires two high-fidelity engines running server-side:

  1. Formula Engine: A dedicated recalculation engine (often built in high-performance languages like C# or Rust) that allows the agent to evaluate complex formulas like SUMPRODUCT or XLOOKUP deterministically.
  2. Render Engine: A tool that renders cell ranges into images. This provides the agent with "visual context"—the same intuitive layout a human uses to understand a spreadsheet's structure.

The Golden Rule: The agent must be instructed to "use the model's formula engine, not JavaScript math." The spreadsheet's formulas are the only source of truth.

How to Test: Moving to Deterministic Evaluation

"LLM as a judge" is no longer enough for high-stakes finance. The new standard is Black-Box Testing using "Golden Spreadsheets."

  • Step 1: Define a set of "Golden Inputs" and expected "Golden Outputs."
  • Step 2: Pass the inputs to the agent-produced spreadsheet.
  • Step 3: Compare the outputs deterministically.

If the outputs match to the cent, the agent passes. This method eliminates the subjectivity of LLM grading and ensures compliance-grade accuracy.

What this means for you

If you are building or deploying AI agents for your small business, move away from "chat-with-data" wrappers. Invest in tools that provide a persistent runtime and a verification loop. Start by implementing a REPL for your agents, which can save up to 80% on token costs by reducing redundant context in long tool-chains.

FAQ

Q: Why is a REPL better than individual tool calls? A: A REPL allows the agent to maintain state and perform multiple operations in a single execution. This reduces the number of round-trips to the LLM, lowers token usage, and prevents the agent from losing context during long tasks.

Q: Which scripting language is best for spreadsheet agents? A: JavaScript (Node.js) is currently the industry favorite because it is easy to sandbox and familiar to most LLMs. Python is a strong runner-up, but the "Code Mode" standard is increasingly TypeScript-first.

Q: What is a "High-Fidelity" engine? A: It is a calculation or rendering engine that mirrors 100% of Excel’s behavior. Incomplete engines (supporting only 50% of formulas) cause agents to fail because they cannot trust the verification loop.

Q: Can agents handle complex nested formulas? A: Yes, provided they have access to a formula engine. They shouldn't be asked to calculate the result themselves; they should write the formula, let the engine calculate it, and then reason based on the result.

Sources
  • Nuno Campos, "Teaching Coding Agents to do Spreadsheets," LLMday London, May 28, 2026. (Confirmed)
  • Witan Labs, "Witan Research Log: Four Months of Engineering an LLM Spreadsheet Agent," GitHub, 2026. (Confirmed)
  • Anthropic, "Claude Fable 5: Safety and Performance Specs," Anthropic News, June 10, 2026. (Confirmed)
  • Cloudflare, "Code Mode: Programmatic Tool Calling in 2026," Cloudflare Blog, 2026. (Reported)
Updates & Corrections
  • 2026-07-08: Article published; verified accuracy benchmarks and REPL architecture standards.
  • 2026-05-11: Witan Labs closed $7.36M seed round led by LocalGlobe and Positive Sum.

Get the practical AI brief

Verified, no-hype AI tips you can actually use - in your inbox. Free.

No spam. We verify what we send. Unsubscribe anytime.

Discussion

0 comments
Sham

Sham

AI Engineer & Founder, The Tech Archive

AI engineer (Azure AI-102/AI-900). Writes practical, tested, hype-free guides on using AI for real work and small business at The Tech Archive.

Related Articles

View all
The End of AI Slop: How to Build High-Quality Autonomous Content Engines
Artificial Intelligence

The End of AI Slop: How to Build High-Quality Autonomous Content Engines

5 min
The Forward-Deployed Builder: A 2026 Framework for Shipping Production AI
Artificial Intelligence

The Forward-Deployed Builder: A 2026 Framework for Shipping Production AI

5 min
Harness Engineering: The 2026 Guide to Building Reliable AI Coding Agents
Artificial Intelligence

Harness Engineering: The 2026 Guide to Building Reliable AI Coding Agents

5 min
How to Use NotebookLM Short Video Overviews: Turn Any PDF into a 60-Second Short
Artificial Intelligence

How to Use NotebookLM Short Video Overviews: Turn Any PDF into a 60-Second Short

5 min
Vibe Coding with Claude Fable 5: The 2026 Guide to Mythos-Class Building
Artificial Intelligence

Vibe Coding with Claude Fable 5: The 2026 Guide to Mythos-Class Building

6 min
India's iPhone Export Surge: How Tata Electronics Outpaced Foxconn
Artificial Intelligence

India's iPhone Export Surge: How Tata Electronics Outpaced Foxconn

7 min