Skerry/ Guides

How far an agent may pay

Rules with four levels, limits and conditions; every decision explained in plain words and kept.

The autonomy a person is comfortable with, for bills. A rule (POST /agent-rules) sets a level and its limits; an agent asks Skerry to decide a bill (POST /bills/{id}/agent-decision); the decision, with its reasons in plain words, is kept and sent as policy.decided.

Migration: db/051_agent_limits.sql. Decision logic is pure code, lib/pure/agent-level.ts; routes in lib/agent-rules.ts.

Levels

LevelThe agent
tellonly tells the person a bill is here
prepareprepares the payment and asks (the default fallback)
pay_tellpays within the limits and tells
pay_quietpays within the limits without a message

The level is a ceiling. Conditions can only lower what happens, never raise it.

Limits and conditions

Limits (in the rule's currency): per_bill_max_minor, per_supplier_month_max_minor, period_max (a week or month total), hard_ceiling_minor. Conditions: verified_only (default true), tolerance_pct of the usual bill (the average of the last three paid), due_within_days, discount_within_days (either one being close enough is enough), quiet_window ({ from, to } as "HH:MM", in the rule's utc_offset_minutes), suppliers.

  • A limit or condition not met drops the bill to prepare: ask the person.
  • Never paid by an agent, whatever the level: a supplier that is new to the customer or whose payment details changed, one not verified (with verified_only), a bill above the hard ceiling.
  • Inside a quiet window a payment defers; nothing is paid until the window ends.
  • A rule that lets the agent pay must carry a limit (per_bill_max_minor or hard_ceiling_minor) and pay_from.
  • With discount_within_days, a bill whose discount deadline is that close is paid less the discount.

Beside spend policies

A rule never widens a spend policy. A paying decision goes through POST /bills/{id}/pay, so policies, the new-payee hold, cooling-off and approvals apply; when they refuse or hold the payout the decision becomes prepare with the refusal as its reason, and the bill stays to_pay. Rules are written by a person; an agent cannot create, change or remove one.

Undo

A bill scheduled for a later day (POST /bills/{id}/schedule, a scheduled payout at 09:00 UTC) can be returned with POST /bills/{id}/release until it runs; that cancels the scheduled payout. A bill whose scheduled payout has run becomes paid (the worker settles it; reading the bill does too).

Scopes: policies:read, policies:write (rules), payouts:write (deciding and paying). Event: policy.decided.

Written and kept by Skerry. Read from https://api.skerry.xyz/guides/agent-limits.md.

This page as Markdown