The camera recipes send frames as images, up to 16 in one request, by https URL or as base64. With video, send a few seconds of frames with their timestamps and ask what happened over time, such as how many cars passed or which way a vehicle turned.
Traffic at a junction#
Problem: a city wants to know how each approach is flowing and to catch wrong-way drivers the moment they appear. Build: send each camera's latest frame by URL with four questions: a Number for the cars on the approach, a Score for congestion, and two Truth questions for a wrong-way driver and a pedestrian crossing away from the crossing.
{
"model": "decisionnode-flash",
"state": {
"camera": "Junction 12, northbound approach",
"lanes": 3,
"local_time": "08:14"
},
"images": [
{
"id": "frame",
"url": "https://cams.example.com/junction-12/north/0814.jpg"
}
],
"questions": {
"cars": {
"type": "number",
"instructions": "How many cars are on the approach?",
"min": 0,
"max": 60
},
"congestion": {
"type": "score",
"instructions": "How congested is the approach?",
"criteria": ["free flow", "busy", "slow", "standstill"]
},
"wrong_way": {
"type": "truth",
"instructions": "Is any vehicle driving against the direction of traffic?"
},
"crossing": {
"type": "truth",
"instructions": "Is a pedestrian crossing the road away from the marked crossing?"
}
}
}a = answers
metrics.record(camera, cars=a["cars"]["number"], congestion=a["congestion"]["score"])
if a["wrong_way"]["truth"] >= 0.8:
signs.show(camera, "WRONG WAY") # acts at once
alert(control_room, camera, frame)
elif a["wrong_way"]["truth"] >= 0.4:
recheck.schedule(camera, model="decisionnode") # unsure: re-check the next frame with the full model
if a["congestion"]["score"] >= 2:
signals.extend_green(camera, seconds=10)People in an area#
Problem: a station needs to know when the concourse fills up, before it is a problem. Build: send both cameras in one request, so one Number counts the people across them, a Score reads the crowding and a Truth checks the exits. The count is spread over a few values (85 at 0.21, 84 to 87 together at 0.73): act on the range, not only the top value.
{
"model": "decisionnode-flash",
"state": {
"site": "Central station, main concourse",
"capacity": 400,
"cameras": "gate_a looks north over the gates, gate_b looks south"
},
"images": [
{
"id": "gate_a",
"url": "https://cams.example.com/central/gate-a/latest.jpg"
},
{
"id": "gate_b",
"url": "https://cams.example.com/central/gate-b/latest.jpg"
}
],
"questions": {
"people": {
"type": "number",
"instructions": "How many people are in the concourse, across both cameras?",
"min": 0,
"max": 200
},
"crowding": {
"type": "score",
"instructions": "How crowded is the concourse?",
"criteria": ["empty", "comfortable", "busy", "crowded", "overcrowded"]
},
"blocked_exit": {
"type": "truth",
"instructions": "Is any marked exit blocked by people or objects?"
}
}
}const { people, crowding, blocked_exit } = answers;
const crowded = crowding.probabilities["3"] + crowding.probabilities["4"];
if (blocked_exit.truth >= 0.7) await alerts.send("exit_blocked", { site });
if (crowded >= 0.5) {
await gates.open({ site, extra: 2 });
await signage.show(site, "Use the south entrance");
}
await dashboard.update(site, { people: people.number, crowded });Incidents on a surveillance camera#
Problem: a closed site has dozens of cameras and nobody watching them at night. Build: every few seconds, send each camera's frame with three questions: smoke or fire, a break-in, and how serious the scene is. Fire, smoke, theft and break-ins set off the right response on their own.
{
"model": "decisionnode",
"state": {
"camera": "Warehouse 3, loading yard, east fence",
"site_status": "closed, no staff on site",
"local_time": "02:37"
},
"images": [
{
"id": "frame",
"url": "https://cams.example.com/warehouse-3/east-fence/0237.jpg"
}
],
"questions": {
"smoke_or_fire": {
"type": "truth",
"instructions": "Is there smoke or fire anywhere in the frame?"
},
"break_in": {
"type": "truth",
"instructions": "Is someone forcing a door, a window, a gate or the fence?"
},
"severity": {
"type": "score",
"instructions": "How serious is what the frame shows?",
"criteria": ["normal", "unusual", "suspicious", "emergency"]
}
}
}a = answers
if a["smoke_or_fire"]["truth"] >= 0.5:
fire_alarm.trigger(site, camera) # a false alarm is cheaper than a late one
if a["break_in"]["truth"] >= 0.8:
site.lock_all_doors()
alert(security_service, camera, frame)
elif a["severity"]["score"] >= 2:
recorder.keep(camera, minutes=10) # suspicious: keep the footage, check the next frameWith video, the same questions run over the last seconds of footage, so a break-in is judged on what happened, not on one frame.
Sorting line: one decision per item#
Problem: a sorter has to route every item the moment it passes the camera, and rules change with every customer. Build: one request per item, on DecisionNode Flash: a Choice picks the lane from the rules in the state, and four Truth questions say whether the package is yellow, damaged, mislabelled or upside down. Change the rules and the lanes follow, with no retraining.
{
"model": "decisionnode-flash",
"state": {
"line": "Outbound 2, sorter camera",
"rules": "Yellow packages go to lane 2. Damaged, mislabelled or upside-down items go to rework. Everything else goes to lane 1.",
"expected_label": "SHIP-4471-NL"
},
"images": [
{ "id": "item", "media_type": "image/jpeg", "data": "<base64>" }
],
"questions": {
"lane": {
"type": "choice",
"instructions": "Which lane should this item go to?",
"criteria": {
"lane_1": "standard parcels",
"lane_2": "yellow packages",
"rework": "damaged, mislabelled or upside down"
}
},
"yellow": { "type": "truth", "instructions": "Is the package yellow?" },
"damaged": { "type": "truth", "instructions": "Is the package damaged?" },
"mislabelled": {
"type": "truth",
"instructions": "Does the label differ from the expected label?"
},
"upside_down": {
"type": "truth",
"instructions": "Is the package upside down?"
}
}
}a = answers
problem = max(a["damaged"]["truth"], a["mislabelled"]["truth"], a["upside_down"]["truth"])
if problem >= 0.5 or a["lane"]["confidence"] < 0.7:
sorter.divert(item, "rework") # the safe lane, still automatic
else:
sorter.divert(item, a["lane"]["choice"])The same camera does more than sort. A Number question counts the products on a tray or a pallet, and a Truth question on the latest frame says whether the belt has jammed or stopped; with video, it reads the last seconds of the line instead.
Answers that say where#
Two new question types answer where: point gives one spot in the image, box draws a rectangle around the thing. You get coordinates you can draw, crop or hand to a machine, and every answer says how likely the thing is there at all and how likely the place is right. See Points and boxes.
Pick point on a conveyor#
Problem: a robot arm has to take the right package off a moving belt, and "the right one" changes with the order. Build: one point question per frame, with the condition in the instructions. The answer is a spot in pixels the arm can go to.
{
"images": [
{
"id": "belt",
"url": "https://files.example.com/line-3/cam-2/0917.jpg"
}
],
"questions": {
"pick": {
"type": "point",
"instructions": "Point to the yellow package with an intact label closest to the robot arm."
}
}
}Run the conveyor pick in the playground: the answer is drawn on the frame.
a = result["answers"]["pick"]
if a["present"] > 0.8:
robot.pick(a["x"], a["y"])
else:
robot.hold() # unsure: hold, and ask again on the next frameDefect box at quality control#
Problem: a paint line has to reject a scratched panel and keep a record of where the scratch was. Build: a box around the scratch and a Truth on whether there is one, in the same request on the same image.
{
"state": { "part": "door panel, painted, batch 2210" },
"images": [
{
"id": "panel",
"url": "https://files.example.com/qc/station-4/panel-88213.jpg"
}
],
"questions": {
"scratch": {
"type": "box",
"instructions": "Draw a box around the scratch on the panel."
},
"scratched": {
"type": "truth",
"instructions": "Is the paint on the panel scratched?"
}
}
}Run the panel scratch in the playground: the answer is drawn on the frame.
a = answers
if a["scratched"]["truth"] >= 0.8 and a["scratch"]["present"] > 0.8:
box = a["scratch"]
line.reject(panel) # off the line at once
report.attach(panel, image.crop(box["x1"], box["y1"], box["x2"], box["y2"]))
elif a["scratched"]["truth"] >= 0.4:
line.divert(panel, "second_camera") # unsure: a second look, still automaticPerson at the fence#
Problem: a closed site has to act on a climber at once and know where to point the light. Build: a box around the person and a Truth on whether someone is climbing, on the latest frame of the perimeter camera.
{
"state": "Perimeter camera 7, north fence, site closed since 22:00.",
"images": [
{
"id": "fence",
"url": "https://files.example.com/site-2/cam-7/latest.jpg"
}
],
"questions": {
"climber": {
"type": "box",
"instructions": "Draw a box around the person climbing the fence."
},
"climbing": {
"type": "truth",
"instructions": "Is someone climbing the fence?"
}
}
}Run the fence watch in the playground: the answer is drawn on the frame.
a = answers
if a["climbing"]["truth"] >= 0.8:
box = a["climber"]
alarm.raise(zone="north fence", frame=frame)
floodlight.aim((box["x1"] + box["x2"]) / 2, (box["y1"] + box["y2"]) / 2)
camera.zoom_to(box["x1"], box["y1"], box["x2"], box["y2"])
elif a["climbing"]["truth"] >= 0.4:
camera.watch(zone="north fence", seconds=30) # unsure: keep asking on every frameLanding marker from a drone#
Problem: a drone has to find its landing marker in the downward camera. Build: one point question with "units": "normalized", so the spot comes back as fractions of the frame, whatever the camera's resolution. The answer feeds the drone's own flight controller.
{
"images": [
{
"id": "down",
"url": "https://files.example.com/drone-12/down/latest.jpg"
}
],
"questions": {
"marker": {
"type": "point",
"instructions": "Point to the landing marker.",
"units": "normalized"
}
}
}Run the landing marker in the playground: the answer is drawn on the frame.
m = answers["marker"]
if m["present"] > 0.8:
controller.set_landing_target(m["x"], m["y"]) # the flight controller does the flying
else:
controller.hold_position() # unsure: hold, and ask again on the next frameWarehouse machines and drones#
- Warehouse machines. Command-level decisions for robots and forklifts, such as go, stop or which aisle: a session streams the machine's state and hands its own controller a typed decision for every frame.
- Drones. Frames from a drone's camera are images like any other, so you can count vehicles or spot smoke from above, and a drone's footage goes in as video. A session hands the drone's own controller a typed decision for every frame: which mode, hold, return or land.
Support inbox that routes itself#
Problem: new tickets land in one pile and wait hours to be sorted. Build: one request per ticket picks the queue, ranks urgency and decides whether to refund on the spot.
{
"model": "decisionnode",
"state": "Customer: I was charged twice and nobody has replied for 3 days.",
"questions": {
"route": {
"type": "choice",
"instructions": "Where should this go?",
"criteria": { "billing": "money", "bug": "broken", "account": "login" }
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": ["routine", "today", "urgent", "critical"]
},
"refund": {
"type": "truth",
"instructions": "Refund this automatically?"
}
}
}a = answers
if a["refund"]["truth"] >= 0.8:
issue_refund(ticket)
elif a["route"]["confidence"] < 0.7:
reply(ticket, template="ask_for_order_id") # the safe path, still automatic
else:
queues[a["route"]["choice"]].put(ticket, priority=round(a["urgency"]["score"]))Moderation pipeline#
Problem: comments need a decision in the time it takes to post them. Build: DecisionNode Flash answers three questions per comment; clear cases are published or removed on the spot, and the uncertain middle is shown with limited reach while the full model re-checks it. Here the model is sure the comment pushes buyers off the platform (0.96) even though the action itself is less certain.
{
"model": "decisionnode-flash",
"state": {
"surface": "listing comments",
"comment": "DM me on telegram for half price, this seller is a fraud"
},
"questions": {
"action": {
"type": "choice",
"instructions": "What should happen to this comment?",
"criteria": {
"allow": "fine to show as is",
"limit": "show it with limited reach for now",
"remove": "breaks the community rules"
}
},
"off_platform": {
"type": "truth",
"instructions": "Is the comment trying to move a buyer off the platform?"
},
"toxicity": {
"type": "score",
"instructions": "How hostile is the language?",
"criteria": ["none", "mild", "strong", "severe"]
}
}
}const { action, off_platform, toxicity } = answers;
if (off_platform.truth >= 0.9 || (action.choice === "remove" && action.confidence >= 0.8)) {
await removeComment(comment, { reason: off_platform.truth >= 0.9 ? "off_platform" : "rules" });
} else if (action.choice === "allow" && action.confidence >= 0.8 && toxicity.score < 1) {
await publish(comment);
} else {
await limitReach(comment); // unsure: the safe action first
const recheck = await decide({ ...request, model: "decisionnode" });
if (recheck.action.choice === "remove") await removeComment(comment, { reason: "rules" });
}Receipt and invoice checker#
Problem: expense claims arrive with a photo of the receipt and sit unpaid until they are checked. Build: send the claim as JSON and the receipt as an image; the model reads the printed total, currency and date and answers against the claim.
{
"model": "decisionnode",
"state": {
"expense_claim": {
"amount": 48.2,
"currency": "EUR",
"date": "2026-09-28",
"merchant": "Northside Cafe"
}
},
"images": [
{ "id": "receipt", "media_type": "image/jpeg", "data": "<base64>" }
],
"questions": {
"matches": {
"type": "truth",
"instructions": "Does the receipt image show the same total, currency and date as the claim?"
},
"currency": {
"type": "choice",
"instructions": "Which currency is printed on the receipt?",
"criteria": {
"EUR": "euro",
"GBP": "pound sterling",
"USD": "US dollar"
}
},
"legible": {
"type": "truth",
"instructions": "Is the total on the receipt clearly legible?"
}
}
}a = answers
if a["legible"]["truth"] < 0.8:
ask_for_new_photo(claim)
elif a["matches"]["truth"] >= 0.9 and a["currency"]["choice"] == claim["currency"]:
approve(claim)
else:
reject(claim, reason="receipt does not match the claim") # and request a corrected receiptClassify a document from its pages#
Problem: uploads arrive as PDFs of every kind, and each type goes to its own workflow. Build: send the first page or the first few pages as images, one image per page in order, and ask one choice question whose criteria lists every type you handle as a code and a description: here 85 types, unknown among them for anything else. The answer names one code, with a probability for every type and a confidence you can act on.
{
"model": "decisionnode",
"state": "Page 1 of a 2-page PDF from the accounts payable inbox.",
"images": [
{
"id": "page_1",
"media_type": "image/jpeg",
"data": "<base64 of page 1>"
}
],
"questions": {
"doc_type": {
"type": "choice",
"instructions": "What type of document is this? Read the page images in order and pick the one type that fits the whole document; answer unknown when none does.",
"criteria": {
"passport": "Using your general knowledge about how Passport are structured in different countries or regions.",
"id_card": "Using your general knowledge about how National ID Cards (issued by a government) are structured in different countries or regions.",
"drivers_license": "Using your general knowledge about how Driver's License are structured in different countries or regions.",
"birth_certificate": "A vital record documenting birth details including name, date, place, and parentage.",
"marriage_certificate": "An official document verifying the legal union between individuals.",
"death_certificate": "An official document recording the date, location, and cause of death.",
"divorce_decree": "A legal document issued by a court that formally dissolves a marriage.",
"diploma": "An official document awarded by an educational institution certifying completion of a course of study.",
"graduation_certificate": "An official document certifying the completion of an academic degree or educational program.",
"receipt": "A receipt (A commercial document issued by a seller to a buyer).",
"transcript": "An official record of a student's academic achievements and courses completed.",
"medical_records": "Documents containing a patient's medical history, diagnoses, treatments, and test results.",
"prescription": "A written direction from a healthcare provider authorizing the dispensing of medication.",
"visa": "An endorsement on a passport allowing the holder to enter, leave, or stay in a country for a specified period.",
"court_order": "An official directive issued by a court or judicial officer.",
"will": "A legal document expressing a person's wishes regarding the distribution of their property after death.",
"trust_document": "A legal arrangement where property is managed by one party for the benefit of another.",
"affidavit": "A written statement confirmed by oath or affirmation for use as evidence in court.",
"deed": "A legal document transferring ownership of property from one party to another.",
"declaration_of_ubos": "A formal document declaring the Ultimate Beneficial Owners (UBOs) of a business.",
"business_registration": "An official certificate or document that registers the business with a government authority.",
"diagram_of_ownership_structure": "A visual diagram representing the ownership structure of a company.",
"company_bylaws": "A legal document that outlines the rules and regulations governing the operation of a company.",
"operating_agreements": "An agreement outlining the structure and governing of a business entity, particularly for LLCs.",
"financial_statements": "A document containing the financial data of a business, such as balance sheets, income statements, and cash flow statements.",
"tax_returns": "Official forms filed with tax authorities to report income, expenses, and other tax information.",
"bank_statements": "Monthly or quarterly reports from financial institutions outlining the activity in a bank account.",
"bank_check": "A written order to a bank to pay a sum from the drawer's account",
"certificate_of_incorporation": "A legal document related to the formation of a company or corporation.",
"shareholder_agreement": "A contract between a company and its shareholders outlining rights and obligations.",
"articles_of_association": "A legal document specifying the regulations for a company's operations.",
"letter_of_authorization": "A formal letter authorizing someone to act on behalf of an organization.",
"insurance_policy": "A contract between the insured and insurer outlining coverage and premiums.",
"lease_agreement": "A contract between a property owner and tenant outlining rental terms.",
"power_of_attorney": "A legal document authorizing one person to act on another's behalf in private, business, or legal matters.",
"employment_contract": "A formal agreement between an employer and employee outlining job terms.",
"real_estate_license": "Certification to operate as a real estate agent or broker.",
"insurance_license": "Certification to sell or advise on insurance policies.",
"financial_services_license": "Certification to provide financial advisory services.",
"legal_practice_license": "Certification to practice law.",
"medical_license": "Certification to practice medicine.",
"drug_license": "Certification to handle, prescribe, or distribute controlled substances and medications.",
"firearms_license": "Certification to own, carry, or deal in firearms and weapons.",
"other_license": "License not elsewhere classified (document says License of some sort).",
"other_certificate": "Certificate not elsewhere classified (document says Certificate of some sort).",
"invoice": "A commercial document issued by a seller to a buyer that specifies the products, quantities, and prices of products or services provided.",
"purchase_order": "A commercial document issued by a buyer to a seller indicating types, quantities, and agreed prices for products or services.",
"contract": "A legally binding document outlining terms and conditions agreed upon by involved parties.",
"non_disclosure_agreement": "A legal contract between parties that outlines confidential material or knowledge to be shared but restricted from wider use.",
"service_level_agreement": "A contract between a service provider and client that documents the services to be provided and the standards to be met.",
"loan_agreement": "A written agreement that documents the borrowing of money, specifying repayment terms and interest rates.",
"mortgage_document": "A legal document that pledges property to a lender as security for a loan.",
"investment_statement": "A document providing details of investments including performance, allocation, and transaction history.",
"credit_report": "A detailed record of an individual's credit history prepared by a credit bureau.",
"social_security_card": "An identification card issued to U.S. citizens, permanent residents, and temporary working residents.",
"voter_registration": "An official document that confirms eligibility to vote in governmental elections.",
"tax_exemption_certificate": "A document issued by tax authorities that grants exemption from certain taxes.",
"business_license": "An official document that authorizes a person or company to operate a business within a particular jurisdiction.",
"patent_certificate": "A document granting an inventor exclusive rights to an invention for a specified period.",
"trademark_registration": "An official document that grants exclusive rights to a word, phrase, symbol, or design that identifies goods or services.",
"copyright_notice": "A statement placed on copies of works to inform the public of copyright ownership.",
"insurance_claim_form": "A document submitted to an insurance company requesting payment for a covered loss or policy event.",
"policy_schedule": "A document that outlines the specific details of an insurance policy, including coverages and limits.",
"certificate_of_insurance": "A document that verifies the existence of insurance coverage.",
"property_title": "A legal document that indicates ownership of real property.",
"survey_plan": "A document showing the boundaries, measurements, and features of a piece of land.",
"appraisal_report": "A document prepared by a qualified appraiser providing an opinion of value for an asset.",
"waybill": "A document issued by a carrier giving details of a shipment of goods and the route for their delivery.",
"packing_list": "A shipping document that itemizes the contents of a shipment.",
"customs_declaration": "A form declaring goods being imported or exported to customs authorities.",
"certificate_of_authenticity": "A document attesting to the authenticity and origin of an item, often used for art or collectibles.",
"provenance_document": "A record detailing the ownership history of an item, typically art or valuable objects.",
"marketing_material": "A document such as a presentation, brochure, or flyer designed to promote products, services, or organizations.",
"photo": "A visual image or picture, not a legal document, that captures a moment, person, place, or thing.",
"schoolwork": "An academic document such as an essay, thesis, research paper, or assignment related to educational activities.",
"residence_permit": "A residence permit issued by a country or state.",
"letter": "A letter from authority or law firm etc, demanding payment or recovery of crypto wallet etc.",
"payslip": "A document showing the wages paid to an employee, including salary, tax deductions, and other withholdings.",
"tax_registration_document": "A document that confirms registration with tax authorities, including VAT registration certificates, tax identification number documents, or similar tax authority registrations.",
"tax_confirmation_document": "A document issued by tax authorities confirming tax status, tax clearance certificates, or tax compliance confirmations.",
"debit_note": "A commercial document issued by a buyer to a seller indicating an amount owed by the seller to the buyer, often used to correct an invoice error or return goods.",
"credit_note": "A commercial document issued by a seller to a buyer indicating a reduction in amount owed, often used for returns, discounts, or invoice corrections.",
"account_confirmation": "A document confirming account details, account status, or account ownership from a financial institution or service provider.",
"airline_ticket": "A document or electronic record issued by an airline or travel agency confirming a passenger's reservation for a flight, including passenger name, flight number, departure/arrival airports, dates, times, seat assignment, booking reference (PNR), and ticket number. Includes boarding passes, e-tickets, and itinerary receipts.",
"unknown": "The document cannot be classified as any of the other types"
}
}
}
}probabilities holds one entry for each of the 85 types, zeros included; the five largest are shown above. confidence is 0.94: the choice confidence, (K * p_max - 1) / (K - 1) with K = 85. A choice takes up to 255 options.
For more pages, add one image per page in order, up to 16 a request, and say so in the state: "images": [{"id": "page_1", ...}, {"id": "page_2", ...}] with "state": "Pages 1 and 2 of a 6-page PDF." The playground runs a two-page lease agreement through the same question.
a = result["answers"]["doc_type"]
if a["choice"] != "unknown" and a["confidence"] >= 0.8:
route(document, workflow=a["choice"]) # invoices to payables, leases to the lease desk
else:
classify_again(document, pages="all") # unsure: ask again with every pageListing photo verifier#
Problem: a marketplace wants listing photos to show the actual item in the stated condition. Build: compare the listing record with its first photo. The score answer gives an expected condition of 2.15 (between good and like new), with the probabilities to back it.
{
"model": "decisionnode",
"state": {
"listing": {
"title": "Oak dining table, seats 6",
"condition": "like new",
"finish": "natural oak"
}
},
"images": [
{ "id": "photo_1", "media_type": "image/webp", "data": "<base64>" }
],
"questions": {
"shows_item": {
"type": "truth",
"instructions": "Does photo_1 show the item described in the listing?"
},
"condition": {
"type": "score",
"instructions": "What condition is the item in, judging by the photo?",
"criteria": ["damaged", "worn", "good", "like new"]
},
"photo_kind": {
"type": "choice",
"instructions": "What kind of photo is this?",
"criteria": {
"own": "a real photo of this item",
"stock": "a catalogue or stock image",
"unclear": "cannot tell"
}
}
}
}Lead scoring#
Problem: sales wants the signups worth a reply today at the top. Build: score fit on your own rubric, classify intent, and filter out personal projects, all from the text of the form.
{
"model": "decisionnode-flash",
"state": "Signup form. Company: 40-person logistics startup. Role: head of engineering. Message: We classify about 200k shipping exceptions a day with an LLM and it is too slow and too expensive. Want to test this next week.",
"questions": {
"fit": {
"type": "score",
"instructions": "How well does this lead fit a high-volume API product?",
"criteria": ["poor", "possible", "good", "excellent"]
},
"intent": {
"type": "choice",
"instructions": "What does this person want right now?",
"criteria": {
"buying": "ready to buy or start a trial",
"researching": "comparing options",
"support": "an existing customer with a problem",
"other": "none of these"
}
},
"personal": {
"type": "truth",
"instructions": "Is this a personal or student project?"
}
}
}const { fit, intent, personal } = answers;
const priority = personal.truth > 0.5 ? 0 : fit.score * (intent.choice === "buying" ? 2 : 1);
await crm.update(lead.id, { priority, intent: intent.choice });Statement reader that chases late invoices#
Problem: finance reads customer statements by hand to decide who gets a reminder. Build: two Number questions count the overdue invoices (4, probability 0.84) and read how late the oldest one is (78 days), and a Choice picks the reminder. The reminder goes out on its own.
{
"model": "decisionnode",
"state": "Customer statement\nAccount: Norrvik Supply AB (30-4471)\nStatement date: 2026-10-01\nTerms: net 30, amounts in EUR\n\nInvoice Issued Due Amount Status\nINV-2041 2026-06-15 2026-07-15 1,240.00 open\nINV-2058 2026-07-03 2026-08-02 410.00 paid 2026-08-01\nINV-2063 2026-07-21 2026-08-20 860.00 open\nINV-2069 2026-07-29 2026-08-28 395.00 paid 2026-09-02\nINV-2077 2026-08-06 2026-09-05 1,120.00 part paid, 300.00 open\nINV-2081 2026-08-13 2026-09-12 640.00 open\nINV-2090 2026-08-31 2026-09-30 780.00 paid 2026-09-29\nINV-2094 2026-09-10 2026-10-10 520.00 open\nINV-2102 2026-09-24 2026-10-24 915.00 open",
"questions": {
"overdue": {
"type": "number",
"instructions": "How many invoices on this statement are overdue on the statement date?",
"min": 0,
"max": 30
},
"oldest_days": {
"type": "number",
"instructions": "How many days past its due date is the oldest unpaid invoice?",
"min": 0,
"max": 180
},
"reminder": {
"type": "choice",
"instructions": "Which reminder should go out today?",
"criteria": {
"none": "nothing is overdue, send nothing",
"friendly": "a friendly reminder for one recent invoice",
"firm": "a firm reminder listing every overdue invoice",
"final": "a final notice before the account is passed to collections"
}
}
}
}overdue, oldest, reminder = a["overdue"], a["oldest_days"], a["reminder"]
if overdue["confidence"] >= 0.7 and reminder["confidence"] >= 0.6:
send_reminder(account, template=reminder["choice"],
overdue=overdue["number"], oldest_days=oldest["number"])
else:
# unsure: the gentlest reminder is the safe path, still sent automatically
send_reminder(account, template="friendly")Agent that asks before it acts#
Problem: an agent with tools can do real damage on one bad call. Build: pass each proposed tool call to DecisionNode and run it only when the answer clears your bar. The full recipe is in Guardrails.