Bound approvals and execution
Use this reference with the complete developer tour and Python types. The example at the end runs after the tour setup.
redeem
Section titled “redeem”Redeem an optional bound approval for the exact declared action.
redeem(self, request_id: str, action: dict[str, Any])| Parameter | Type and default | Usage |
|---|---|---|
request_id |
str (required) |
Canonical durable request ID. This is not a worker delivery ID. |
action |
dict[str, Any] (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 Python example. Input/output fields are in the types reference.
report_execution
Section titled “report_execution”Report what the executor actually observed for an authorized operation.
report_execution(self, execution_id: str, state: str, result: Any=None)| Parameter | Type and default | Usage |
|---|---|---|
execution_id |
str (required) |
Execution.id returned by redeem. |
state |
str (required) |
Lifecycle state. Read the resource-specific enum; request and execution states differ. |
result |
Any (default None) |
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 Python example. Input/output fields are in the types reference.
Example
Section titled “Example”Run this region after the shared setup. Assertions check the returned data; the full tour is a runnable program.
# Optional advanced contract. This example reports a fixture, not a real deletion.action = {'name': 'reconcile-orders', 'executor_id': builder_id, 'resource': 'orders', 'resource_version': 'v2', 'arguments': {'ids': [241, 242]}, 'operation_key': run_id + '/business'}approval = owner.ask(target={'kind': 'person', 'id': person_id}, body='Apply this reconciliation?', kind='approval', action=action)owner.respond(approval['id'], 'approved', version=approval['version'])execution = builder.redeem(approval['id'], action)assert builder.report_execution(execution['id'], 'succeeded', {'fixture': True})['state'] == 'succeeded'