WorkflowForgeAI Agent and Workflow Laboratory
WorkflowForgeWorkflowsbakaya_v1
Home
WorkflowForge · AI Agent and Workflow Laboratory © 2026Built by Shivang GitHub
Workflows
Workflow

bakaya_v1

Entry point guard_input · 12 nodes · 4 branch points

workflows/bakaya_v1custom result view

Recovers overdue and short-paid money for a micro or small Indian supplier: audits short payments (Shortfall), works out MSMED Act due dates and statutory interest, plans each buyer's escalation and drafts the notices and an ODR claim pack. Nothing is sent.

Open in Playground

README

workflows/bakaya_v1/README.md

Bakaya

Recover overdue and short-paid money for a micro or small Indian supplier. Bakaya is Hindi for outstanding dues.

Big buyers pay micro and small suppliers late, and often short. The law gives the supplier strong rights:

  • the MSMED Act 2006 caps credit at 45 days (15 days without written terms);
  • it charges compound interest at three times the RBI Bank Rate on anything later;
  • it sends disputes to a fast-track council through the MSME ODR portal.

Few suppliers use those rights. Working out what is actually owed is hard: deductions blur the amount, interest is fiddly, and the documents are scattered. Bakaya works it out for each buyer and drafts what to send. A person reviews everything; nothing is sent.

For: micro and small manufacturers and service providers that sell on credit to corporates, modern trade, quick commerce or public sector buyers, and the CA firms that keep their books.

Try it

  • Demo: run the workflow with the prompt demo, or Extra inputs {"demo": true}. The demo month belongs to a fictional "Demo Foods Pvt Ltd" with four buyers, as of 8 October 2026. It makes about 18 LLM calls. {"demo": true, "options": {"max_llm_calls": 0}} runs it with rules only, at no cost.
  • Your own books: send them as Extra inputs (JSON, at most 32 KB). Any prompt works; it isn't parsed.

Graph nodes

execution order
  1. 1guard_inputguardrail
  2. 2intakedeterministic
  3. 3read_filesagent
  4. 4eligibilitydeterministic
  5. 5audit_deductions

Evaluation

workflows/bakaya_v1/evaluation · 7 cases · suite bakaya_v1_golden

Scores bakaya_v1 runs against hand-checked cases: MSMED due dates, statutory interest (to the rupee), eligibility and risk flags, recovery stages, the drafts each buyer needs, and, for the LLM case, delivery dates read from documents and plans that stay inside the computed figures.

Not evaluated yet.

All suites

Past runs

latest 50, including evaluation runs

No runs yet

Execute this workflow in the Playground; every run shows up here with a replay.

Try it in the Playground
KeyWhat it holds
suppliername, udyam_number, udyam_registered_on, category (micro/small/medium), activity (manufacturing/services/trading), optional gstin, pan, address, email.
buyersname, type (company, cpse, government, llp, partnership, proprietorship, other), optional aliases, country, relationship (key/normal), gstin, address, email, recovery_log: [{on, action}] (reminders already sent).
invoicesinvoice_no, buyer, date, gross (incl. GST), optional taxable_value, items, po_no, po_date, delivery_date, credit_days, terms_in_writing, objection: {raised_on, removed_on}, receipts: [{on, amount, tds}].
documentsPOs, agreements, GRNs, PODs, emails: doc_id, kind (po, agreement, contract, grn, pod, delivery_challan, email, objection, invoice, other), buyer, invoice_nos, and either text or file_id (an uploaded PDF or image).
filesUploaded files not tied to a document: ["<id>", ...]. Each is read and sorted. A payment advice goes to Shortfall; anything else becomes a document, with its kind, buyer and invoice numbers guessed from the file name and text. The Playground's Attach files fills this for you.
advices, bank_credits, rate_contracts, credit_notes, tds_creditsPayment data, passed to Shortfall in its own shapes.
as_ofThe date to compute to (default: today, India time).
optionsmax_llm_calls (30, at most 40), top_n_buyers (3), rate_mode (floating or fixed_at_start), bank_rate_override: [{from, bank_rate_pct}], unresolved_deductions (exclude/include), unallocated_receipts (fifo/ignore), audit (Shortfall's options).

Amounts accept Indian formatting ("₹1,18,000.50"). Dates accept YYYY-MM-DD or day-first (24/06/2026).

What you get

The report (markdown) gives:

  • what is recoverable;
  • a plan per buyer;
  • the dates that give you leverage;
  • what Shortfall found in the short payments.

The structured output (shown in the result viewer) holds, per buyer:

  • invoices:
    • delivery, acceptance and due dates, with the basis for each;
    • payments;
    • outstanding principal and statutory interest;
    • flags;
    • every deduction and what it does to the amount owed.
  • plan:
    • the stage: friendly reminder → statement of account → statutory notice → ODR filing;
    • levers with dates;
    • a settlement ladder (never below the principal);
    • next steps;
    • the rationale;
    • whether it came from the strategist agent or from rules, and why.
  • drafts:
    • reminder;
    • statement of account with an interest annexure;
    • statutory notice;
    • Shortfall's deduction disputes, advice requests and TDS follow-ups.
  • odr_pack:
    • the ODR portal's claim-form fields (missing ones marked [to fill]);
    • the invoice schedule;
    • totals;
    • a statement of facts;
    • a documents checklist saying what's on file and what's missing.

How it works

guard_input → intake → [read_files] → eligibility → [audit_deductions] → [read_documents] → build_ledger
            → [compute_interest] → plan_recovery → draft_documents → assemble_report → guard_output

Bracketed nodes are skipped when they have nothing to do.

  1. intake validates the inputs and scans every text field for prompt injection. The demo runs only when asked for.

    • read_files runs only when files were uploaded. It reads them through the platform (app.files): PDF text directly, images and scans with the vision model (at most 6 calls). Their text gets the same prompt-injection check, and loose files are sorted into documents and advices.
  2. eligibility. The MSMED delayed-payment rules cover micro and small suppliers with a Udyam registration. They don't cover medium enterprises or traders (traders' Udyam registration is for priority-sector lending only).

  3. audit_deductions runs Shortfall on the payment advices and bank credits. It works out where every rupee of a short payment went and gives each deduction a verdict.

  4. read_documents is the evidence clerk. One LLM call per buyer reads the documents for:

    • delivery dates;
    • payment terms agreed in writing;
    • written objections.

    A fact is used only if all three checks pass:

    • its word-for-word quote is in the document;
    • the value is inside the quote;
    • it is plausible.

    Terms count as written only when they come from a PO, agreement, contract or email. Structured fields always win over what the clerk reads.

  5. build_ledger joins the audit with the invoices:

    amount due  = gross − supported deductions (− unresolved ones, by default)
    payments    = net paid + tax withheld, dated by the bank credit
    outstanding = amount due − payments
    

    Disputable deductions stay owed. A shortage or damage claim first raised more than 15 days after delivery, with no written objection, is flagged late_claim; if no delivery record is on file, it is treated as disputable. Bank credits nobody could explain are applied first-in-first-out to the buyer's oldest dues, marked provisional.

  6. compute_interest: MSMED s.16 interest per eligible invoice, including invoices already paid late.

  7. plan_recovery is the strategist, a tool-calling agent run for the largest buyers. Its tools are interest_if_paid_by, settlement_options and lever_calendar, and its tool calls show in the replay. Code checks its plan:

    • the stage must be one the code allows;
    • every offer must come from settlement_options and none may fall below the principal;
    • the rationale may only use figures the code computed.

    A plan that fails, times out or runs out of budget is replaced by the rule plan, and the reason is recorded.

  8. draft_documents fills templates and builds the ODR pack. The LLM writes only the ODR statement of facts, from computed facts, and the text is kept only if every amount and date in it was computed.

The LLM never decides an amount, a date or eligibility. Every LLM step has a soft deadline and a fallback, so a slow or failing LLM degrades the run instead of failing it.

Legal basis and the rules encoded

RuleIn code
s.2(b) Explanation: acceptance on delivery; a written objection within 15 days moves it to the day the objection is removedmsmed.acceptance
s.15: pay by the agreed date, at most 45 days from acceptance, or within 15 days with no written agreementmsmed.due_date
s.16: compound interest with monthly rests at 3 × the RBI Bank Rate, whatever the contract saysinterest.accrue
s.23: interest not deductible for the buyer; Income-tax Act 2025 s.37(2)(g) (formerly 43B(h)): the buyer deducts late-paid MSE dues only when paiddata/levers.json
MSME Form I: companies report MSE dues unpaid beyond 45 days (Apr–Sep by 31 Oct, Oct–Mar by 30 Apr)levers.next_form1_due
MSMED (Amendment) Act 2026 (Act 16 of 2026, assent 13 Aug 2026): CPSEs to settle through TReDS (s.15A), faster council timelinesshown as enacted, pending commencement
ODR portal (odr.msme.gov.in), mandatory for new cases since 15 Oct 2025odr_pack.py
Bombay HC, Mahindra Defence v. Ranjana Industries (30 Sep 2025): the 15-day objection window is bindinglate_objection, late_claim flags
SC, Sonali Power (Jul 2025): the Limitation Act applies to s.18 arbitration, not conciliationtime_barred_risk
Registration after the contract: Silpi/Mahakali vs NBCC (Jan 2025); a larger bench is pendingregistered_after_supply (a risk flag); registered_after_invoice (not claimable on ODR)

data/bank_rates.json holds the RBI Bank Rate history from May 2020 to the 7 October 2026 hike to 5.75%. It records its sources and the date it was last checked. When the as-of date is past that date, the run warns; options.bank_rate_override adds a newer change.

Assumptions (also in every run's output)

  • Day counting: due dates count days after the day of acceptance (General Clauses Act s.9). With no written terms, interest starts on day 16.
  • Interest:
    • It accrues daily (actual/365) and is capitalised at each monthly anniversary of the interest start date.
    • The rate is 3 × the Bank Rate in force each day.
    • Payments go to principal first, and interest stops once an invoice's principal is cleared.
  • Deductions: supported ones reduce what is due; disputable ones stay due; ones still under review or without evidence are left out of the claim unless unresolved_deductions is include.
  • Tax:
    • TDS and GST TDS/TCS withheld by the buyer count as paid.
    • GST may be payable on interest received (CGST Act s.15(2)(d)); it isn't computed.
  • Missing delivery date: the invoice date is used, and the invoice is flagged.

This is not legal advice. Have a CA or lawyer check the figures and flags before sending a notice or filing a claim.

Keys and cost

There are no keys of its own. The workflow uses the platform's LLM access (aicredits, gpt-4o-mini) within options.max_llm_calls, which defaults to 30. The demo uses about 18 calls.

Limits

  • Size. JSON inputs are limited to 32 KB, so this suits a handful of buyers and a few dozen invoices. Documents can also be uploaded files: up to 20 per run, 10 MB each. There's no Tally, bank or mailbox connector.
  • Nothing is sent, filed or tracked across runs. One run is one review.
  • Privacy. Every signed-in viewer of this lab can read every run's inputs (audit finding AWS-08). Use the demo or anonymised data until that is fixed.
  • Legal data. The legal data is current as of its verified_until date. Provisions of the 2026 amendment apply only from the dates the Centre notifies.

Evaluation

The evaluation/golden.json suite (bakaya_v1_golden) has seven hand-checked cases:

  1. on time, late and unpaid invoices across the October 2026 rate change;
  2. the 45-day cap, plus objections inside and outside the 15-day window;
  3. a medium enterprise;
  4. late registration and limitation;
  5. Shortfall's disputable deductions staying due;
  6. the demo with rules only;
  7. the demo with the LLM.

Cases 1–6 make no LLM calls and should always score 1.0.

Metrics, each from 0 to 1: run_completed, due_dates, principal, interest (to the rupee), flags, stage, drafts_present, and, for the LLM case, evidence_extraction and plan_valid.

The offline tests run every case, the LLM one against a faithful fake. They also cross-check the interest engine against a day-by-day calculation on 500 random schedules.

Not built yet

These need a platform design or tables approved by the owner:

  • human approval before anything goes out;
  • tracking each claim from notice to recovery (bakaya_claims / bakaya_claim_events);
  • scheduled nudges before the MSME Form I and 31 March deadlines;
  • connectors (Tally, bank statements, the receivables mailbox);
  • Hinglish WhatsApp reminders.
agent
  • 6read_documentsagent
  • 7build_ledgerdeterministic
  • 8compute_interestdeterministic
  • 9plan_recoveryagent
  • 10draft_documentsagent
  • 11assemble_reportdeterministic
  • 12guard_outputguardrail
  • Topology edges

    guard_inputintake
    read_fileseligibility
    read_documentsbuild_ledger
    compute_interestplan_recovery
    plan_recoverydraft_documents
    draft_documentsassemble_report
    assemble_reportguard_output
    intakeread_files | eligibility
    eligibilityaudit_deductions | read_documents | build_ledger
    audit_deductionsread_documents | build_ledger
    build_ledgercompute_interest | plan_recovery