f8
Build, verify, and automate financial models in code with AI, compiled into live Excel.
I'm a CFA charterholder working in private M&A and project finance. I built f8 because I believe code is the best way to leverage AI for financial modeling. As a bonus, moving your models into code gives you 40 years of software engineering infrastructure (version control, automated tests, reusable modules, and live data pipelines) out of the box.
The problem
Excel is still the non-negotiable deliverable across finance, but today's ways of bringing AI or code into financial modeling each hit a wall:
- AI inside Excel (add-ins, Office.js, GUI agents): Still inherits everything painful about Excel — fragile grid edits, silent copy-paste errors, no version control or diffs, no automated tests, and awkward links to external data. Making AI click cells faster doesn't fix the foundation.
- Low-level workbook libraries (
openpyxl,xlsxwriter,exceljs): You're in code, but you (and your AI agent) are still babysitting raw cell addresses (C42:G42) where inserting one row breaks downstream formulas, more importantly, none of these libraries evaluate formulas, so your agent is flying blind. - DataFrames (
pandas,polars): Great for data pipelines, awkward for row-by-row 2D schedules (3-statement links, corkscrews, debt waterfalls), and they can't give your stakeholders a live, formula-driven .xlsx file.
How f8 works
f8 makes code your single source of truth, and turns .xlsx into a compiled output:
- Semantic 2D modeling: Write formulas using readable names (
PPE["end_balance", col.prev]).f8handles the grid layout and compiles your logic into native Excel A1 formulas. - Compiler-enforced rigor: A 6-pass Rust compiler checks types, shapes, grid completeness (no forgotten cells or formula overlaps), and blocks circular references via Tarjan cycle detection.
- Closed-loop verification: Evaluates every formula in memory in milliseconds, so your AI agent knows what went wrong immediately.
- Verified Excel parity: Matches Excel across all 37 supported functions, including error propagation and the 1900 leap-day quirk. Our uncached parity workbook lets Excel recalculate and grade every test case itself when you open it.
Who is f8 for
- Anyone who wants AI to build real financial models: Whether you're doing M&A and LBOs, fundamental equity research, project finance, FP&A, credit, or real estate — give your AI agent a real language and compiler so you get models you can actually diff, test, and hand to a client or IC as a live
.xlsx. - Quants and code-first analysts: Keep your financial statements and 2D schedules right next to live data feeds (SEC filings, market APIs, databases) and quant models in Python or TypeScript — with
compiled.save("model.xlsx")ready whenever someone asks for the spreadsheet. - Complex modeling beyond finance: Pricing models, operational forecasts, scenario planning — anything where you want software-grade reliability without giving up Excel as the deliverable.
Getting started
Install f8-engine in Python (imported as f8) or TypeScript / JavaScript:
# Python
pip install f8-engine # or: uv add f8-engine
# TypeScript / JavaScript
npm install f8-engine # or: pnpm add f8-engine
Using an AI coding agent? f8 ships with a bundled modeling skill and CLI reference you can drop right into your workspace:
f8 agent init # scaffolds .agents/skills/f8-modeling/
f8 theme init # generates a customizable theme.json in your workspace root
f8 guide --all # streams the full DSL, layout, function, and auditing guide to stdout
Quick look
from f8 import Model
years = ["2025A", "2026E", "2027E"]
capex = {"2025A": 25.0, "2026E": 30.0, "2027E": 35.0}
depr = {"2025A": -15.0, "2026E": -18.0, "2027E": -22.0}
model = Model("Operating Forecast")
sheet = model.add_sheet("Summary")
ppe = sheet.add_table("PPE", "PP&E Corkscrew Schedule", "($ in millions)")
ppe.add_column("item", role="descriptor", header="Line Item")
for year in years:
ppe.add_column(year, header=year, format="currency", decimals=1)
ppe.add_row(
"beg_balance",
cells={"item": "Beginning Balance", "2025A": 100.0},
expr='PPE["end_balance", col.prev]',
)
ppe.add_row("capex", cells={"item": "Capital Expenditures", **capex})
ppe.add_row("depreciation", cells={"item": "Depreciation", **depr})
ppe.add_row(
"end_balance",
cells={"item": "Ending Balance"},
expr='SUM(PPE["beg_balance".."depreciation", @col])',
style="total",
)
compiled = model.compile()
# Audit evaluated values in memory (or pass view="formulas" to inspect lowered Excel formulas)
print(compiled.table("PPE").to_markdown())
# Emit a live .xlsx workbook with native Excel formulas and styling (you don't have to)
compiled.save("forecast.xlsx")
TypeScript equivalent
import { Model } from "f8-engine"
const years = ["2025A", "2026E", "2027E"] as const
const capex = { "2025A": 25.0, "2026E": 30.0, "2027E": 35.0 }
const depr = { "2025A": -15.0, "2026E": -18.0, "2027E": -22.0 }
const model = new Model({ name: "Operating Forecast" })
const sheet = model.addSheet("Summary")
const ppe = sheet.addTable("PPE", "PP&E Corkscrew Schedule", {
subtitle: "($ in millions)",
})
ppe.addColumn("item", { role: "descriptor", header: "Line Item" })
for (const year of years) {
ppe.addColumn(year, { header: year, format: "currency", decimals: 1 })
}
ppe.addRow("beg_balance", {
cells: { item: "Beginning Balance", "2025A": 100.0 },
expr: 'PPE["end_balance", col.prev]',
})
ppe.addRow("capex", { cells: { item: "Capital Expenditures", ...capex } })
ppe.addRow("depreciation", { cells: { item: "Depreciation", ...depr } })
ppe.addRow("end_balance", {
cells: { item: "Ending Balance" },
expr: 'SUM(PPE["beg_balance".."depreciation", @col])',
style: "total",
})
const compiled = model.compile()
// Audit evaluated values in memory (or pass { view: "formulas" } to inspect lowered Excel formulas)
console.log(compiled.table("PPE").toMarkdown())
// Emit a live .xlsx workbook with native Excel formulas and styling (you don't have to)
compiled.save("forecast.xlsx")
Output
| Line Item | 2025A | 2026E | 2027E |
| :------------------- | ---------: | ---------: | ---------: |
| Beginning Balance | $100.0 | $110.0 | $122.0 |
| Capital Expenditures | $25.0 | $30.0 | $35.0 |
| Depreciation | ($15.0) | ($18.0) | ($22.0) |
| **Ending Balance** | **$110.0** | **$122.0** | **$135.0** |
Sample deliverables
Autonomous equity research models (mhcfa/faac)
Full TypeScript financial models, audited SEC/macro data bundles, compiled .xlsx workbooks, and valuation decks generated by autonomous multi-agent workflows live in mhcfa/faac:
| Engagement | Model | Excel Model | Valuation Deck |
|---|---|---|---|
Costco (COST) |
public-equity/costco |
costco-valuation.xlsx |
costco-equity-valuation.pdf |
Boeing (BA) |
public-equity/boeing |
boeing-valuation-model.xlsx |
boeing-initiation-deck.pdf |
Meta (META) |
public-equity/meta |
meta_model.xlsx |
meta_presentation.pdf |
Salesforce (CRM) |
public-equity/salesforce |
salesforce_financial_model.xlsx |
salesforce-initiation.pdf |
- Costco write-up: Running an Autonomous Agent on Costco Equity Research: Why It Called a Short (4-hour, ~$70 autonomous run across 50 SEC and macro sources with zero human intervention)
LBO model preview
Disclaimer: Sample deliverables are AI-generated technical demonstrations and do not constitute financial analysis or investment advice.
Trade-offs
Because f8 treats code as the source of truth and .xlsx as just an output, there are a few trade-offs to keep in mind:
- Structured layout only: You can't scatter ad-hoc cells wherever you want in the emitted workbook — everything is verified by strict schemas. (You wouldn't want a messy spreadsheet anyway, right?)
- Basic Python or TypeScript: You'll be working in code, though AI largely takes care of that for you.
- No circular references: Per FAST Standard Section 2.01. Revolver circularity has a clean closed-form formula anyway (and don't worry, AI knows it).
- No native charts or Pivot Tables: Charts are on the roadmap, and since you're already in Python or TypeScript, your language ecosystem handles aggregation far better than Pivot Tables.
- One-way flow (
code -> Excel): Manual edits to the emitted.xlsxwon't sync back and will be overwritten on the next compile. By design,.xlsxis a build artifact, not a source file.
Architecture
Under the hood, f8 pairs Python (python/f8/) and TypeScript/WebAssembly (ts/, crates/f8-wasm/) SDKs with a 6-pass Rust compiler (crates/f8-core/):
Spec -> IR Expansion -> DAG & Cycle Check -> Topological Evaluation -> Spatial Layout -> Formula Lowering -> .xlsx Emission
See docs/architecture.md for the full pipeline and invariants.
License
- Licensed under the Apache License, Version 2.0 (
Apache-2.0); seeLICENSE. - Copyright (C) 2026 Michael (Chencheng) Hu, CFA (
@mhcfa).
Metadata
Release files for f8-engine 0.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| f8_engine-0.8.2.tar.gz | 236.0 kB | With provenance | Details for f8_engine-0.8.2.tar.gz |
Built distributions (wheels)
Total release size: 8.9 MB
Release files / f8_engine-0.8.2.tar.gz
| Download URL | f8_engine-0.8.2.tar.gz |
|---|---|
| Size | 236.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6fa583a233b10928213b5e5bd408d5d3009291d252bbfcffd05aafbccdfbec5
|
|
BLAKE2b-256 checksum How to use checksums |
82dd57207b7e0dd3c63643265ce1769de9a5bf25ddbbac0151d089f6e08b3b81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / f8_engine-0.8.2-cp312-abi3-win_arm64.whl
| Download URL | f8_engine-0.8.2-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
272da74f22a889fd722def11a9bc6ad00b5cb01d62fba2f7902cbad16ed30df5
|
|
BLAKE2b-256 checksum How to use checksums |
7ba153207f9348eeb27ea5a071fdfacc650e935d660f24c0c281ea9421fc840e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / f8_engine-0.8.2-cp312-abi3-win_amd64.whl
| Download URL | f8_engine-0.8.2-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d8cf2b4112849bbcc5b9eb5a7e392e6ca3cbe1687fb064e1fa54c7a00966f4bd
|
|
BLAKE2b-256 checksum How to use checksums |
3a605c30e71e36302384461ff97e6226679e3d821e592f1ac6c15ca146e8769b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / f8_engine-0.8.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | f8_engine-0.8.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1537a319799cb62b58aa8a98d796e0cb93d9a10c76972d957e176ffb5b930948
|
|
BLAKE2b-256 checksum How to use checksums |
6f9dd1dd3ff284880970e627e810fa40d3a34be465207fd5134af56dc6ab5910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / f8_engine-0.8.2-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | f8_engine-0.8.2-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
15f929b1df101770c0b9081b481674e57a252e32876d02a16ed8c9e496208356
|
|
BLAKE2b-256 checksum How to use checksums |
3ef63d86ae458c7077a1726a4a736ae5649b9755a947a8af2f3ef75461589016
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / f8_engine-0.8.2-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | f8_engine-0.8.2-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
73b634a87d6ed290dab7fe1097fd58780765415888c06af3419410aeb41926b8
|
|
BLAKE2b-256 checksum How to use checksums |
afe74b096bb73b51aa1f0ea7cab56146807393f5893423211f383e2dbfaf52cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / f8_engine-0.8.2-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | f8_engine-0.8.2-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
76b7807b2e262b93bf95f1d98a685eeddb4d8fd6a6971b1087c4453b2592811a
|
|
BLAKE2b-256 checksum How to use checksums |
95fed21838ef61484c23b1b396563e7e56f42963c972a9abefef037917c0a488
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for f8-engine 0.8.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 7 files in this release have been uploaded with provenance metadata.
Attestation for f8_engine-0.8.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.