AI Native Lang
showcase

Showcase: Automated Invoice Aging Alerts for Small Businesses

Stop chasing overdue invoices manually. A compiled AINL workflow queries your DB daily, identifies invoices past 30 days unpaid, totals the exposure, and emails a digest — deterministically, no LLM required at runtime.

March 28, 2026·2 min read
#showcase#smb#business#finance#invoice#cron#postgres#compile-once-run-many
Share:TwitterLinkedIn

Audience: Small businesses, freelancers, accountants, operations managers

The problem

Chasing overdue invoices is operational drag that slips through the cracks — especially when your "alert system" is a manual spreadsheet filter or a forgotten reminder. Building a reliable automated alert in raw Python or a LangGraph agent means recurring orchestration cost plus fragile control flow.

The AINL solution

examples/autonomous_ops/invoice_aging.lang is a production-style AINL workflow that runs daily, queries the database, and alerts on overdue exposure:

# invoice_aging.lang (core pattern)
D InvoiceRec (id: str, due_date: int, status: str, amount: float)

S main
  X d30 (core.mul 30 86400)
  X cutoff (core.sub (core.now) d30)

  R db F "Invoice" ->invoices

  Filter invoices where (core.and
    (core.ne invoice.status "paid")
    (core.lt invoice.due_date cutoff)
  ) ->overdue

  X count (core.len overdue)
  X total_amount (core.sum (map overdue (lambda i i.amount)))

  If (core.eq count 0) ->L_ok ->L_alert

L_alert:
  R email G "Invoice Aging Alert" (core.join [
    "Overdue invoices: " (core.stringify count)
    " totalling $" (core.stringify total_amount)
  ])
  Ret "alerted"

L_ok:
  Ret "ok"

Why compile it

  • No model tokens at runtime — the logic is deterministic; whether to alert is decided by the data, not re-prompted each day
  • Typed data modelD InvoiceRec enforces schema at compile time, not at 2 AM when the job runs
  • Auditable — every run produces a JSONL trace; finance teams can replay exactly what was queried and what was sent
  • Composableinclude a retry or slack_notify module without rewriting the core logic

Extend it

Add a 60-day escalation tier, a Slack channel alert, or a weekly summary report — just add nodes to the graph and re-compile. The rest stays untouched.

pip install ainativelang
git clone https://github.com/sbhooley/ainativelang.git
ainl check examples/autonomous_ops/invoice_aging.lang --strict
A

AI Native Lang Team

The team behind AI Native Lang — building deterministic AI workflow infrastructure.

Related Articles