Entry point guard_input · 12 nodes · 4 branch points
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.
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:
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.
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.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.
Execute this workflow in the Playground; every run shows up here with a replay.
| Key | What it holds |
|---|
supplier | name, udyam_number, udyam_registered_on, category (micro/small/medium), activity (manufacturing/services/trading), optional gstin, pan, address, email. |
buyers | name, type (company, cpse, government, llp, partnership, proprietorship, other), optional aliases, country, relationship (key/normal), gstin, address, email, recovery_log: [{on, action}] (reminders already sent). |
invoices | invoice_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}]. |
documents | POs, 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). |
files | Uploaded 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_credits | Payment data, passed to Shortfall in its own shapes. |
as_of | The date to compute to (default: today, India time). |
options | max_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).
The report (markdown) gives:
The structured output (shown in the result viewer) holds, per buyer:
[to fill]);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.
intake validates the inputs and scans every text field for prompt injection. The demo runs only when asked for.
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.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).
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.
read_documents is the evidence clerk. One LLM call per buyer reads the documents for:
A fact is used only if all three checks pass:
Terms count as written only when they come from a PO, agreement, contract or email. Structured fields always win over what the clerk reads.
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.
compute_interest: MSMED s.16 interest per eligible invoice, including invoices already paid late.
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:
settlement_options and none may fall below the principal;A plan that fails, times out or runs out of budget is replaced by the rule plan, and the reason is recorded.
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.
| Rule | In code |
|---|---|
| s.2(b) Explanation: acceptance on delivery; a written objection within 15 days moves it to the day the objection is removed | msmed.acceptance |
| s.15: pay by the agreed date, at most 45 days from acceptance, or within 15 days with no written agreement | msmed.due_date |
| s.16: compound interest with monthly rests at 3 × the RBI Bank Rate, whatever the contract says | interest.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 paid | data/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 timelines | shown as enacted, pending commencement |
| ODR portal (odr.msme.gov.in), mandatory for new cases since 15 Oct 2025 | odr_pack.py |
| Bombay HC, Mahindra Defence v. Ranjana Industries (30 Sep 2025): the 15-day objection window is binding | late_objection, late_claim flags |
| SC, Sonali Power (Jul 2025): the Limitation Act applies to s.18 arbitration, not conciliation | time_barred_risk |
| Registration after the contract: Silpi/Mahakali vs NBCC (Jan 2025); a larger bench is pending | registered_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.
unresolved_deductions is include.This is not legal advice. Have a CA or lawyer check the figures and flags before sending a notice or filing a claim.
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.
verified_until date. Provisions of the 2026 amendment
apply only from the dates the Centre notifies.The evaluation/golden.json suite (bakaya_v1_golden) has seven hand-checked cases:
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.
These need a platform design or tables approved by the owner:
bakaya_claims / bakaya_claim_events);