Skip to content

Bound approvals and execution

Use this reference with the complete developer tour and Go types. The example at the end runs after the tour setup.

Redeem an optional bound approval for the exact declared action.

func (c *Client) Redeem(ctx context.Context, id string, action Action) (Execution, error)
Parameter Type and default Usage
ctx context.Context (required) Required Go context. Cancellation bounds this local call; it does not withdraw a durable request.
id string (required) Existing stable resource ID, returned by the corresponding create/read operation.
action Action (required) Optional exact bound-action descriptor for the advanced execution contract.

Returns: Execution with authorized state and stable operation_key.

Permissions, lifecycle and errors: Advanced opt-in contract, not necessary for a normal approval message. The resource owner must enforce operation-key and resource-version fences. Approval never proves execution.

Working Go example. Input/output fields are in the types reference.

Report what the executor actually observed for an authorized operation.

func (c *Client) ReportExecution(ctx context.Context, id, state string, result any) (Execution, error)
Parameter Type and default Usage
ctx context.Context (required) Required Go context. Cancellation bounds this local call; it does not withdraw a durable request.
id string (required) Existing stable resource ID, returned by the corresponding create/read operation.
state string (required) Lifecycle state. Read the resource-specific enum; request and execution states differ.
result any (required) Executor-reported JSON result. It is not independent proof of an external effect.

Returns: Updated Execution with state and result.

Permissions, lifecycle and errors: Allowed reports: running, succeeded, failed, unknown. Terminal reports cannot be overwritten. Use unknown when the external result cannot be established; never turn a timeout into success.

Working Go example. Input/output fields are in the types reference.

Run this region after the shared setup. Assertions check the returned data; the full tour is a runnable program.

action := beepgrid.Action{Name: "reconcile-orders", ExecutorID: builderID, Resource: "orders", ResourceVersion: "v2", Arguments: map[string]any{"ids": []int{241, 242}}, OperationKey: runID + "/business"}
approval := must(owner.Ask(ctx, beepgrid.AskInput{Target: beepgrid.Target{Kind: "person", ID: me.Person.ID}, Body: "Apply this reconciliation?", Kind: "approval", Action: &action}, beepgrid.Key()))
must(owner.Respond(ctx, approval.ID, beepgrid.Response{Outcome: "approved", Version: approval.Version}))
execution := must(builder.Redeem(ctx, approval.ID, action))
check(must(builder.ReportExecution(ctx, execution.ID, "succeeded", map[string]bool{"fixture": true})).State == "succeeded")

Read this page as Markdown