> Canonical guide: https://developers.foxlight.ai/build/sdk/reference/jobs/
> Contract snapshots: Skulk 2.0.0 (b0af39c79b6b7102b2478062904f1d7cc8619975); SDK 1.0.1 (fe6e0f8737ae343769b8cfc0a67ab112b9efac52). Check the installed runtime when versions differ.

# jobs API

SDK 1.0.1. This reference describes the supported authoring interface.

## `JobDefinition`

Two native descriptors: job observation and durable inference submission.

### `JobDefinition.create`

Build compiled portable/2 declarations, without admitting any caller.

The read endpoint accepts status/list/log only. The inference endpoint
accepts start/cancel/plan. Adapters must perform inference, not governed
provisioning or unrelated write effects. Include both descriptors and
explicit operation bounds in the signed managed/2 manifest.

```python
def create(cls, *, id: str, version: str, title: str, description: str, input_schema: dict[str, JsonValue], result_schema: dict[str, JsonValue], processing_domain: Literal['local', 'private_site', 'external']='local') -> JobDefinition:
    ...
```

### `JobDefinition.descriptors`

Return independent native read/work declarations for signing.

```python
def descriptors(self) -> list[dict[str, JsonValue]]:
    ...
```

### `JobDefinition.result_schema`

Return a copy of the compiled portable result-schema declaration.

```python
def result_schema(self) -> dict[str, JsonValue]:
    ...
```

## `DurableJobs`

Register a native inference job service with private original-caller state.

Use serve() in the application's setup context. Native scheduling and replay
fences are shared with other language bindings. Cancellation of a start RPC
does not retract a durable acceptance: inspect the same operation ID instead
of creating another. Accepted work has its own declared runtime bound; it
holds no live caller context and cannot use one to delegate after the RPC.

### `DurableJobs.__init__`

Bind provider-owned adapter behavior and explicit native timing policy.

```python
def __init__(self, definition: JobDefinition, adapter: JobAdapter, *, plan: Callable[[dict[str, JsonValue]], Awaitable[OperationPlan]], poll_seconds: float=1.0, adapter_seconds: float=30.0) -> None:
    ...
```

### `DurableJobs.register`

Register exact read/work handlers before application startup.

```python
def register(self, app: CapabilityApp) -> None:
    ...
```

### `DurableJobs.serve`

Own private durable state and all adapter cleanup until context exit.

The caller chooses stable application storage, e.g. beneath the normal
host-selected process working directory. No request can select a path.
The directory is bound to the installed node and exact descriptors;
changed or missing initialized state requires explicit recovery.

```python
async def serve(self, startup: ApplicationStartup, *, directory: Path) -> AsyncGenerator[None]:
    ...
```
