Action methods: cancel, evaluate, pause, redirect
The Action Verbs cancel, evaluate, pause, redirect as typed SDK methods, with inputs, result, refusals and an example.
Reference for Action, one group of Action methods.
Action.cancel
Cancel stops a pending Action, sets its status to canceled, and runs its compensation. Verb page.
interface ActionVerbs {
cancel(input: ActionCancelInput, options?: SB.CallOptions): SB.Call<Action>
}Emits Action.canceled.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
action | Action | required | The pending Action. |
reason | text | Why it stops. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
action | Action | required | The canceled Action. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const action = await $.Action.cancel({ action: 'act_br07HsG8MG' })Action.evaluate
Evaluate grades an Action’s output against a rubric and records the verdict as an Event. Verb page.
interface ActionVerbs {
evaluate(input: ActionEvaluateInput, options?: SB.CallOptions): SB.Call<ActionEvaluateOutput>
}Emits Action.evaluated.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
action | Action | required | The Action whose output is graded. |
evaluator | string | required | The Evaluator to run. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
verdict | json | required | The score and the reasons for it. |
action | Action | required | The Action graded, with the verdict attached. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The input does not match the schema of the operation. | invalid-input | Read the schema of the operation, then send every required field with the right type. | None. |
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
import { $ } from 'startup-builder'
const { verdict, action } = await $.Action.evaluate({ action: 'act_br07HsG8MG', evaluator: 'Example evaluator' })Action.pause
Pause holds a pending Action past the close of its delay window until a watcher resumes, redirects, or cancels it. Verb page.
interface ActionVerbs {
pause(input: ActionPauseInput, options?: SB.CallOptions): SB.Call<Action>
}Emits Action.paused.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
action | Action | required | The pending Action. |
reason | text | required | Why it must wait. |
until | datetime | When the pause escalates to the Role above if nobody resolves it; defaults to one business day. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
action | Action | required | The paused Action, still pending. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
Example
import { $ } from 'startup-builder'
const action = await $.Action.pause({ action: 'act_br07HsG8MG', reason: 'Example reason' })Action.redirect
Redirect changes a pending Action’s inputs or target inside its delay window, before it runs. Verb page.
interface ActionVerbs {
redirect(input: ActionRedirectInput, options?: SB.CallOptions): SB.Call<Action>
}Emits Action.redirected.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
action | Action | required | The pending Action. |
changes | json | required | The inputs to replace. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
action | Action | required | The redirected Action. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The input does not match the schema of the operation. | invalid-input | Read the schema of the operation, then send every required field with the right type. | None. |
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const action = await $.Action.redirect({ action: 'act_br07HsG8MG', changes: {} })