Function
A Function is how a Verb executes, as code, a generative model, an Agent, or a Human, invisible to the caller.
Properties
| Property | Type | Required | Description |
|---|---|---|---|
kind | string | required | One of code, generative, agentic, or human. |
version | string | The Version an Action runs, kept with the Action. | |
cascade | string[] | Kinds tried in order when one declines, such as code, then a Human. | |
instructions | text | For a generative or agentic Function, what it does and how. | |
model | string | For a generative or agentic Function, the model it runs on. | |
tools | list of Verb | For an agentic Function, the Verbs it may call; Permissions and Limits apply to each. | |
maxSteps | integer | For an agentic Function, the most steps one Action may take. | |
budget | money | The most one Action may spend; the Mandate’s Limits apply as well. | |
role | Role | For a human Function, the Role its Tasks go to. | |
form | json | For a human Function, the form; generated from the Verb’s inputs and outputs when absent. | |
sla | string | For a human Function, how long a Task may wait, as an ISO 8601 duration. | |
escalateTo | Role | For a human Function, the Role a Task moves to when the service level passes. |
Object
{
"$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, inverseimplementedBy. - A Function uses many Secrets: a Function declares the Secrets it reads; deploying to
livefails when one is missing there.uses, inverseusedBy.
Verbs
createCreates a Function.POST /{namespace}/functionsgetReturns one Function by id.GET /{namespace}/functions/{id}listReturns Functions, newest first, one page at a time.GET /{namespace}/functionsupdateChanges the given properties of a Function.PATCH /{namespace}/functions/{id}deleteDeletes a Function; its history is kept.DELETE /{namespace}/functions/{id}
Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.
| Operation | owner | admin | member | viewer |
|---|---|---|---|---|
Function.create | Yes | Yes | Yes | No |
Function.get | Yes | Yes | Yes | Yes |
Function.list | Yes | Yes | Yes | Yes |
Function.update | Yes | Yes | Yes | No |
Function.delete | Yes | Yes | Yes | No |
Call it
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.