Skip to main content

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.

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.

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

JobDefinition.result_schema​

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

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.

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.

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.

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