## OperationContext


Per-operation identity, deadline, and cancellation state.


Usage

``` python
OperationContext()
```


The host supplies one context per operation. Adapters correlate request and result envelopes by `operation_id` and treat `deadline_monotonic` as the expiry point on the host's monotonic clock ([HostServices.monotonic](HostServices.md#benchweave_sdk.HostServices.monotonic)).


## Attributes


`operation_id: str`  
Identity of the running operation; request and result envelopes carry the same value.

`dataset_id: str | None`  
Optional dataset correlation id, or `None` when the operation is not part of a dataset.

`deadline_monotonic: float`  
Deadline on the host's monotonic clock in seconds. Once [HostServices.monotonic()](HostServices.md#benchweave_sdk.HostServices.monotonic) reaches it, the operation must fail rather than transmit.


## See Also

[Adapter](Adapter.md#benchweave_sdk.Adapter)  
lifecycle that consumes a context per operation.

[HostServices](HostServices.md#benchweave_sdk.HostServices)  
scoped services that own the monotonic clock.


## Methods

| Name | Description |
|----|----|
| [is_cancelled()](#is_cancelled) | Report whether the host has cancelled the operation. |
| [mark_dispatch_started()](#mark_dispatch_started) | Mark dispatch immediately before the adapter's first transmit. |

------------------------------------------------------------------------


#### is_cancelled()


Report whether the host has cancelled the operation.


Usage

``` python
is_cancelled()
```


------------------------------------------------------------------------


#### mark_dispatch_started()


Mark dispatch immediately before the adapter's first transmit.


Usage

``` python
mark_dispatch_started()
```


The host uses this marker to tell failures that never reached the device (`dispatch_state: "not_dispatched"`) from uncertain outcomes after a transmit (`dispatch_state: "unknown"`).
