Skip to main content

f8

Author, verify, and automate financial models with code and AI agents, compiled into live Excel workbooks.

Who is f8 for

  1. People who want AI to reliably build complex Excel models (financial and beyond): Give AI agents a semantic 2D DSL and compile-time verification to produce clean and error-free .xlsx workbooks with live formulas.
  2. People doing financial analysis in pure code (no Excel required): Run row-by-row financial statements, corkscrew schedules, and cross-table dependency graphs in Python or TypeScript (where columnar DataFrames fall short), with compiled.save("model.xlsx") ready whenever a stakeholder asks for the spreadsheet.

Why f8

I am a CFA charterholder working in private M&A and project finance, where complex Excel models remain the non-negotiable deliverable despite fragile manual work, silent copy-paste errors, and zero version control.

AI agents struggle to manipulate raw spreadsheets (openpyxl, Office.js, or GUI) for two reasons:

  • Brittle coordinates: Agents must reason in spatial cell addresses (C42:G42) instead of domain semantics; inserting one row shifts every downstream reference.
  • No verification loop: Spreadsheet libraries do not evaluate formulas, leaving agents blind until the .xlsx file is opened and inspected.

f8 turns the .xlsx workbook into a compiled artifact rather than a hand-edited canvas:

  • Semantic 2D modeling: Author models with readable table, row, and column identifiers; f8 handles spatial layout and lowers logic into native Excel formulas.
  • Compiler-enforced rigor: A 6-pass Rust compiler verifies grid completeness (zero unassigned cells or formula overlaps) and enforces a strict DAG via Tarjan cycle detection.
  • Closed-loop verification: Evaluates formulas in memory so AI agents and test suites (pytest, vitest) can audit tables, trace dependencies, and verify accounting checks in milliseconds, without opening Excel.
  • Verified Excel parity: Matches Excel across all 34 supported functions, combining compile-time type and shape verification with exact Excel domain error propagation and the 1900 leap day bug. The parity workbook ships without cached values, so Excel itself recalculates and grades every case on open (ParityVerification sheet: exact match for integers, text, dates, and lookups; 1e-9 relative tolerance for floating-point and iterative functions; runtime error check via ISERROR; plus a dedicated ExcelDivergences sheet documenting intentional runtime domain and solver divergences from legacy Excel quirks).

Getting started

Python

Install from PyPI (package name is f8-engine, imported as f8):

pip install f8-engine
# or
uv add f8-engine

TypeScript / JavaScript

Install from npm (package name is f8-engine):

npm install f8-engine
# or
pnpm add f8-engine

If you are working with an AI coding agent, f8 ships with a bundled modeling skill and CLI reference you can drop straight into your workspace:

f8 agent init    # scaffolds .agents/skills/f8-modeling/
f8 theme init    # generates a customizable theme.json in the workspace root
f8 guide --all   # streams the full DSL, function, and auditing guide to stdout

Quick look

Python

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

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

Inspect compiled deliverables generated from real-world models:

  • costco-valuation.xlsx: Compiled 3-statement, DCF, and trading comparables financial model with live Excel formulas.
  • costco-equity-valuation.pdf: Equity valuation report and presentation rendered from the compiled f8 model.
  • lbo_model.xlsx: Multi-sheet leveraged buyout (LBO) model with transaction structuring, debt waterfall, and returns analysis.

LBO model demo

Complete model repo: https://github.com/mhcfa/f8-demo (this one is written in Python)

LBO Executive Dashboard

LBO Transaction Balance Sheet Bridge

Disclaimer: Sample deliverables are AI-generated technical demonstrations and do not constitute financial analysis or investment advice.

Trade-offs

f8 treats code as the single source of truth, and .xlsx is just an output. So there are some trade-offs to consider:

What you gain What you lose
Clean structure and strict schema Hidden mistakes no one notices
Git and line-by-line diffs Model_v14_Final_(2).xlsx and guessing what changed since v13
Instant DAG and completeness verification in Rust The opportunity to mess up your model right before a client meeting
Superior AI modeling Being an Excel Ninja
Readable semantic code and logic The joy of hunting down a hidden #REF! at 2 AM

Jokes aside, writing models in code gives you 40 years of software infrastructure out of the box, line-by-line git diff reviews, automated pytest and vitest checks, reusable modules, and parametric loops. The only real downsides I can think of are:

  1. You can't do whatever you want when it comes to layout in the emitted workbook; everything has to be structured. But you wouldn't want your spreadsheet to be a mess anyway, right?
  2. You have to learn some Python or TypeScript. But that is largely solved by AI now.
  3. Constantly re-compiling just to peek at the Excel workbook can be a bit annoying, so we provide in-memory inspection methods in both SDKs. Once you get used to printing tables in the terminal, you don't need to open the .xlsx all the time (or just ask AI to do it).
  4. There are no circular references or iterative solvers (as per FAST Standard Section 2.01). There is a closed-form formula that solves the revolver circularity problem without circular references anyway (and don't worry, AI knows it).
  5. There is no native Excel chart emission yet (on roadmap), and no Pivot Tables. But since you are already in code, your language ecosystem handles data aggregation much better.
  6. It is a one-way flow (code -> Excel). Editing the emitted .xlsx workbook won't sync back to your code, and re-compiling will overwrite manual changes. This is by design, .xlsx is a compiled deliverable, not a source file.

Architecture

Under the hood, f8 provides Python (python/f8/) and TypeScript/WebAssembly (ts/, crates/f8-wasm/) SDKs backed by a 6-pass Rust compiler (crates/f8-core/):

Spec -> IR Expansion -> DAG & Cycle Check -> Topological Evaluation -> Spatial Layout -> Formula Lowering -> .xlsx Emission

  • Architecture overview: docs/architecture.md
  • Python modeling skill: python/f8/skills/f8-modeling/SKILL.md
  • TypeScript modeling skill: ts/skills/f8-modeling/SKILL.md
  • Syntax, grid, and formatting reference: python/f8/skills/f8-modeling/references/syntax-and-grid.md / ts/skills/f8-modeling/references/syntax-and-grid.md
  • Function reference: python/f8/skills/f8-modeling/references/functions.md / ts/skills/f8-modeling/references/functions.md
  • Auditing and repair reference: python/f8/skills/f8-modeling/references/auditing-and-repair.md / ts/skills/f8-modeling/references/auditing-and-repair.md

License

  • Licensed under the Apache License, Version 2.0 (Apache-2.0); see LICENSE.
  • Copyright (C) 2026 Michael (Chencheng) Hu, CFA (@mhcfa).

Metadata

Release files for f8-engine 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for f8-engine 0.6.1
File Size Uploaded Provenance Actions
f8_engine-0.6.1.tar.gz 207.4 kB With provenance Details for f8_engine-0.6.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for f8-engine 0.6.1
File Actions
f8_engine-0.6.1-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details for f8_engine-0.6.1-cp312-abi3-win_arm64.whl
f8_engine-0.6.1-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for f8_engine-0.6.1-cp312-abi3-win_amd64.whl
f8_engine-0.6.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for f8_engine-0.6.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
f8_engine-0.6.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for f8_engine-0.6.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
f8_engine-0.6.1-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for f8_engine-0.6.1-cp312-abi3-macosx_11_0_arm64.whl
f8_engine-0.6.1-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for f8_engine-0.6.1-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 8.3 MB

Release files / f8_engine-0.6.1.tar.gz

Download URL f8_engine-0.6.1.tar.gz
Size 207.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8ee2e14b0eb8ae3f3f679d7073c76d3c7d3fba686211c05d17b0deea00886229
BLAKE2b-256 checksum
How to use checksums
65760a0bdd896cc8ae47b5baf37aeafba2d866a6de8f92b35853806ed2d50b54
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 18, 2026.

Transparency log

Release files / f8_engine-0.6.1-cp312-abi3-win_arm64.whl

Download URL f8_engine-0.6.1-cp312-abi3-win_arm64.whl
Size 1.3 MB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
9eb4ca91e4584b9234fa4ed1b9d2996b4b53f75895aa982c10ff1561a3c9199c
BLAKE2b-256 checksum
How to use checksums
a71dc4cf1039e26d27d47120718ec5efc1f4e63c3280056998464f082ecda8ba
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 18, 2026.

Transparency log

Release files / f8_engine-0.6.1-cp312-abi3-win_amd64.whl

Download URL f8_engine-0.6.1-cp312-abi3-win_amd64.whl
Size 1.3 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
06e28fa3cff5e7363228cf8bb9da9640cfe2b2e1fe59ae20c5873f1d1643f29d
BLAKE2b-256 checksum
How to use checksums
d1ec81805432e82e2519ad7e112db317c3f3aa578bebfe9f4a151d9cd27ff939
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 18, 2026.

Transparency log

Release files / f8_engine-0.6.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL f8_engine-0.6.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.4 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
3f6c1cd520fc6f54dc961fd73b5d357f2a50b04ea4f32605dde674be09edab63
BLAKE2b-256 checksum
How to use checksums
9c6d95dab0948c7e8e245b02f80421e621c50b51f344bab1cf166ea536ab4056
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 18, 2026.

Transparency log

Release files / f8_engine-0.6.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL f8_engine-0.6.1-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
f896cd033ecfe53cef48325e4ba128a4881d837864a858c53ff2257640e6bbb7
BLAKE2b-256 checksum
How to use checksums
2b84d3556ecb711a320afbf2dbfa7e642b603baaf56515ab4a962a92a7174154
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 18, 2026.

Transparency log

Release files / f8_engine-0.6.1-cp312-abi3-macosx_11_0_arm64.whl

Download URL f8_engine-0.6.1-cp312-abi3-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
06a20b5dcf6013f43c2b0823af77276b4d5bb7a7eaa67d58e0843915e686c7ec
BLAKE2b-256 checksum
How to use checksums
6d019a952b212940f5c011b6895ba73695d32f48daf193166fa98dc3ce31acd1
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 18, 2026.

Transparency log

Release files / f8_engine-0.6.1-cp312-abi3-macosx_10_12_x86_64.whl

Download URL f8_engine-0.6.1-cp312-abi3-macosx_10_12_x86_64.whl
Size 1.4 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b488e47c5cc2e77ff447c3a243a24c161f441084c802571ff91261356d457d4d
BLAKE2b-256 checksum
How to use checksums
f8d2d7a2e4d078b69a7845ea1c95b02f63268cb479598aa94b12f7a0a25f9756
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 18, 2026.

Transparency log

Security for f8-engine 0.6.1

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.

Select from 7 files

Attestation for f8_engine-0.6.1.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 18, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page