# Bound approvals and execution

Python inputs, results, permissions and executable examples for bound approvals and execution.

Use this reference with the [complete developer tour](https://beepgrid.com/docs/sdks/python/tour.md) and [Python types](https://beepgrid.com/docs/sdks/python/types.md). The example at the end runs after the tour setup.

## redeem

Redeem an optional bound approval for the exact declared action.

```text
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](https://beepgrid.com/docs/sdks/python/execution/#example). Input/output fields are in the [types reference](https://beepgrid.com/docs/sdks/python/types.md).

## report_execution

Report what the executor actually observed for an authorized operation.

```text
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](https://beepgrid.com/docs/sdks/python/execution/#example). Input/output fields are in the [types reference](https://beepgrid.com/docs/sdks/python/types.md).

## Example

Run this region after [the shared setup](https://beepgrid.com/docs/sdks/python/tour.md). Assertions check the returned data; the full tour is a runnable program.



```python
# 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'
```
