Skip to content

Work

Work gets a product's jobs done by agents and people, each step on the cheapest worker that meets its grade. Every step is checked, supervised where the law asks, then delivered and accepted under an Outcome contract.

Capability families

A Service API sells an outcome, an Agent API a worker, and a Marketplace the supply of many sellers. Each needs the same layer: someone does a step, someone else checks it, and the buyer accepts the result. People are a Function kind, so human work, review and licensed sign-off are designed in.

FamilyWhat it gives every product
CasesA work Thing as a graph of steps with declared ends: intake, a conflict check, a quote, the steps, delivery and acceptance
Tasks and queuesA human step raises a task in its Role's queue, routed by skill and credential. A task is claimed under a lease, handed off with its context, and escalated when its clock runs out
Staffing and escalationEach step names a Function kind and a fallback. A step moves from agent to person behind the same Verb and price, and back when the agent earns it
ReviewAdversarial ("harden it"), affirmative ("yes, and"), recursive, sampled and four-eyes review, each a step kind; moderation of what members post is the same step. The doer is never the checker
Assurance gradesSeven grades, weakest first: declared, estimated, sampled, graded, attested, measured, confirmed. Each check earns a grade, and an Offer sells one
Licensed supervisionCredentialed Roles, sign-off as an act reserved to them, supervision ratios and an oversight record; privilege classes, ethical walls, retention and legal hold
Delivery and acceptanceA delivery carries its evidence. An acceptor accepts within a window, a rejection gets its remedy, and a dispute runs on one path
Agents inside the productAn agent per Customer, with tools drawn from the Verbs, its own memory and skills, and spend brakes. Leases hold its work, and its record shows what it did
SupplyWorkers and suppliers join, are verified and matched, and hold capacity and a track record; a firm brings its own members. A Marketplace's suppliers use the same family
Booking and ordersCalendars, availability, holds, waitlists and no-show fees; orders with inventory holds, shipment and returns

A grade caps how the Offer may price. An output price needs at least graded. An outcome price needs the outcome measured or confirmed, by the acceptor, an evaluator or an outside oracle.

Lifecycles and states

ThingStatesWhat moves it
A caseopened, screened, quoted, then its own seen states, delivered, accepted, closed; or declined, rejected, remedied, disputedThe buyer's Verbs, the conflict check, the steps, and the acceptance clock
A taskopen, claimed, done; or released, escalated, expiredA worker's claim and completion, a lease that lapses, a clock that runs out
A reviewrequested, passed; or changes_asked, revised, then requested againThe checker's verdict; recursive review loops until it passes or escalates
A sign-offawaiting, then signed or refusedA holder of the credentialed Role; a refusal sends the step back
An agent's runworking, braked, then working again on approval; or lease_lapsed, reassignedA brake it hits, the person its mandate names, a lease that runs out
A bookingheld, confirmed, then attended, no_show or cancelledThe buyer's Verbs, the calendar's clock, and the rule that charges a no-show fee
An orderplaced, claimed, filled, then accepted, contested or returnedThe supplier's claim and fill, the rematch clock, and the buyer's acceptance
A deliverysent, in_window, then accepted, rejected or lapsedThe acceptor, or the window's clock; the Outcome contract says what a lapse does
A disputeopened, answered, resolvedEither party, with the receipt and the delivery's evidence

Seen is a state and unseen is a step. The Filing's ordered, drafting, drafted, signed, filing, filed and accepted are what the buyer watches; the review and the paralegal's check inside drafting stay private.

What you declare, what the platform does

You declareThe platform does
The work Noun and its seen statesServes each state as the buyer's view, and each move as a Verb on every Interface
Steps, each with a Function kind, a Role and a fallbackRaises tasks, routes them by Role, skill and credential, and escalates on a failed check
A review pattern on a stepAssigns a checker who is not the doer, runs rounds until a pass or an escalation, and keeps each verdict
The grade an Offer sellsComputes the grade the path earns, and refuses a deploy whose price or remedy needs more
A floor: none, a signature, or a licensed practiceReserves the act to a credentialed Role, holds the supervision ratio, and writes the oversight record
An Outcome contract: done, acceptor, window, remedyCharges on acceptance, runs the window, applies the remedy, and opens the dispute path
A brake on an agentStops the agent at it, asks the person its mandate names, and resumes on approval
A calendar, a hold window and a no-show feeOffers the free times, holds a slot, confirms it, and charges the fee under the published rule
Nothing elseLeases, handoff packets, queues, clocks, evidence, and the check that every step can be staffed

Example

The Filing, with an adversarial review and a supervised check, sold at the measured grade: the Customer's acceptance measures each outcome.

definition.ts
29 lines
import { define, workflow, agentic } from 'apis.dev'

/** Each Customer's annual report, drafted, hardened, checked, signed and filed, charged once when accepted. */
export default define({
  name: 'filings', domain: 'filings.apis.dev',
  …
  Filing: {                                     // the case your buyer watches
    company: 'string', year: 'number',
    status: {
      order: [],
      draft: { in: 'ordered', run: workflow(async ($, filing) => {
        const { form } = await $.generative('Draft the annual report for {company}', filing,
          { returns: { form: 'string' } })
        await $.review(form, { pattern: 'adversarial' })   // an agent tries to break it
        await $.human('Check the draft', { form },
          { role: 'paralegal', supervisor: 'attorney' })   // attests the draft
        return { form }
      }) },
      sign: 'drafted',                          // seen: the Customer's turn
      file: { in: 'signed', run: agentic('File the signed report with the state') },
      accept: 'filed', reject: 'filed',         // the Customer accepts, or it is redone
    },
  },
  on: { 'Filing.ordered': 'Filing.draft', 'Filing.signed': 'Filing.file' },
  offer: {
    'Filing.order': { price: 25, when: 'accepted', accept: 'customer',
                      acceptWithin: '7d', remedy: 'redo', grade: 'measured' },
  },
})

Deploy refuses the file if no one holds paralegal, or if no attorney can supervise the paralegals it has. A rejected filing is redone at no charge.

Contracts with the other subsystems

Work proposes, and the Runtime's gate commits. Nothing a worker does reaches the record, the bill or the buyer except through a Verb.

SubsystemWhat Work takes from itWhat Work gives it
Definition and compileThe case graph, staffing, grades and floors, checked at deployThe roster and the grade each path earns, which the staffing and economic checks read
Identity, access and policyRoles, credentials, acts reserved to licensed people, mandates for agents, single-use links, shared-case grantsWho claimed, reviewed, supervised or signed each step
Model and recordsCase files, privilege classes, retention and legal hold on recordsComments, assignments and evidence attached to the case's records
Data and SourcesOutside submissions and their typed acknowledgements, such as a government office's receiptCorrections to Source data, reviewed before they apply
RuntimeSteps, clocks, waits and the gateTasks a $.human step raises; every verdict and sign-off as an Event
CommerceThe Outcome contract on the Offer; client funds held until acceptanceThe acceptance that charges; the remedy that refunds or credits; each worker's or supplier's share
Interfaces and distributionOne conversation per case; the client and delivery contracts that UIs renderThe case's state, its allowed moves and who holds the ball, for any principal
Trust and operationsBrakes, evals, and the outside check of each gradeThe supervision record, review evidence and traces of every agent's run

What Customers and their agents meet

  • The case, not the work. The buyer watches seen states move. The steps, reviews and checks inside them stay private.
  • Their turn is a Verb. Approve the quote, sign, accept or reject, through the API, MCP, the SDK or the CLI.
  • A grade before they order. The offer card prints the grade, and each delivery carries the evidence of the review that earned it.
  • One charge, once. The fee is charged on the move the Outcome contract names; a rejection gets its remedy at no charge.
  • An agent as client. An agent files the matter, approves the quote, accepts or contests, and pays. The one act the law reserves for a person goes to that person by a single-use link.
  • A worker's shift. A worker claims a task, completes it or hands it off through the API, so a delivery UI never invents state.
  • One dispute path. A dispute carries the receipt and the delivery's evidence, and its answer is an Event.

Every step names its worker, its checker and its grade, so a Service API is a promise the platform can keep.