Skip to content

Function

A Function is how a Verb executes, as code, a generative model, an Agent, or a Human, invisible to the caller.

Properties

PropertyTypeRequiredDescription
kindstringrequiredOne of code, generative, agentic, or human.
versionstringThe Version an Action runs, kept with the Action.
cascadestring[]Kinds tried in order when one declines, such as code, then a Human.
instructionstextFor a generative or agentic Function, what it does and how.
modelstringFor a generative or agentic Function, the model it runs on.
toolslist of VerbFor an agentic Function, the Verbs it may call; Permissions and Limits apply to each.
maxStepsintegerFor an agentic Function, the most steps one Action may take.
budgetmoneyThe most one Action may spend; the Mandate’s Limits apply as well.
roleRoleFor a human Function, the Role its Tasks go to.
formjsonFor a human Function, the form; generated from the Verb’s inputs and outputs when absent.
slastringFor a human Function, how long a Task may wait, as an ISO 8601 duration.
escalateToRoleFor a human Function, the Role a Task moves to when the service level passes.

Object

JSON
{
  "$id": "https://api.sb/kilnbakery.com/functions/function_1",
  "$type": "Function",
  "kind": "code",
  "version": "Example version",
  "cascade": [
    "Example cascade"
  ],
  "instructions": "Example instructions",
  "model": "Example model",
  "tools": [
    "verb_1"
  ],
  "maxSteps": 1,
  "budget": {
    "amount": 9,
    "currency": "USD"
  },
  "role": "role_1",
  "form": {},
  "sla": "PT4H",
  "escalateTo": "role_1"
}

Relationships

  • A Function implements one Verb: a Function is how a Verb runs: code, a generative model, an Agent or a Human, and the caller never sees which. implements, inverse implementedBy.
  • A Function uses many Secrets: a Function declares the Secrets it reads; deploying to live fails when one is missing there. uses, inverse usedBy.

Verbs

  1. createCreates a Function.
    POST /{namespace}/functionsdoFunction.created
  2. getReturns one Function by id.
    GET /{namespace}/functions/{id}readNo Event
  3. listReturns Functions, newest first, one page at a time.
    GET /{namespace}/functionsreadNo Event
  4. updateChanges the given properties of a Function.
    PATCH /{namespace}/functions/{id}doFunction.updated
  5. deleteDeletes a Function; its history is kept.
    DELETE /{namespace}/functions/{id}doFunction.deleted

Permissions

Which Access level may call each Verb. One-way Verbs wait their delay window.

Operationowneradminmemberviewer
Function.createYesYesYesNo
Function.getYesYesYesYes
Function.listYesYesYesYes
Function.updateYesYesYesNo
Function.deleteYesYesYesNo

Call it

Text
Add a function to PetPantry.

Example

At a tax-preparation service, Return.draft runs as an Agent, Return.check runs as code, and Return.sign runs as a credentialed Human. The caller invokes all three the same way.