Skip to main content
Predictive loading changes when a read happens, not who may perform it. PredictionResourceRegistry maps opaque names to host-owned validation and resolution, preventing the client from inventing URLs, queries, or functions.

Resource names

A name identifies a reusable representation, not its storage. Names start with a lowercase letter, may use lowercase letters, digits, and single ., _, or - separators, and are limited to 128 characters. Registration requires a resolve function and rejects duplicate names:
Register only reads the foreground path can reuse. Mutations and external side effects do not belong in the registry because predictions can be wrong.

Validate parameters

validate runs before prediction.accepted, so invalid work is never recorded as admitted.
CogniResourceRejection carries a protocol reason. Other validation errors become invalid_parameters. Keep tenant identity in authenticated context, never client parameters.

Authorize reads

Registration declares a read; it does not authorize one. Authenticate the route first, then apply the same domain authorization as the foreground read.
Cogni passes context through unchanged and grants nothing from a name, cache key, or probability. Keep authorization ahead of reads and cache writes.

Return metadata

A resolver returns a payload plus reuse and cost metadata: The wire response uses snake_case. Set materialWork: false for a backend cache hit so warm reads do not distort material reuse.

Classify failures

Throw CogniResourceFailure when the host can classify a resolver failure:
The public event exposes only code and retryable. Unclassified errors become non-retryable backend_error; cancellation and expiry become cancelled and deadline_exceeded. Failures remain isolated per candidate.

Propagate cancellation

Pass the resolver’s AbortSignal into downstream calls. Cogni can stop awaiting ignored work, but it cannot recover the host capacity that work continues to consume.

Continue