> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run an external compute launcher

The launcher runs beside your compute: Bijection sends it each run as one
request and never runs your workload. `@bijectionhq/pack-compute/launcher` is
the customer-run endpoint (`POST /runs`, `POST /runs/<run>/cancel`). It
authenticates the installation's bearer, deduplicates launches by their key,
refuses launches for runs it was told to cancel, and hands the run, with its
secret in `BIJECTION_CONTEXT`, to a provider:

| Provider | Module | A run is |
| - | - | - |
| Ray | `./providers/ray` | a Ray Job whose `submission_id` is the attempt id |
| Kubernetes | `./providers/kubernetes` | a `batch/v1` Job, its context in a Secret |
| Databricks | `./providers/databricks` | a `run-now` of an installed job, keyed by the original request digest |
| Models | `./providers/models` | an inline call to an OpenAI-compatible model server inside your boundary |
| Inline | `./launcher` | the launcher's own function, answered inline |

Spark runs as a Databricks job, a Kubernetes job or on Ray, through the
matching provider. Configure the worker entrypoint and runtime on the cluster,
and register the function name and contract digest on both the launcher and the
worker.

## Keep a launch journal

Pass `sqliteLaunchStore("/state/launches.db")` from
`@bijectionhq/pack-compute/launcher-sqlite` on Node.js, on a persistent volume
with SQLite locking and durable commits, one journal per launcher identity.
Configure the same acknowledgement horizon on the receiver (`retention`) and the
launcher. The journal keeps 1,024 records and 24 hours of resolved replay by
default; exact retries reuse the stored answer, and saturation answers a
transient refusal. `memoryStore()` is for development.

Ray, Kubernetes and Databricks recover a lost response by reading back a
matching existing job, as long as the provider retains the original submission
and protects its identity and metadata. An absent job keeps the launch
unresolved.

## Serve the worker side

A worker answers the run through the callback route with its attempt ID and
secret, posting `progress`, `reply` or `fail`. Use `serveRun(handler, {
contractDigest })` from `@bijectionhq/pack-compute/worker` in TypeScript, or the
[Python worker](https://docs.bijection.com/transforms/python.md); an inline provider is
`inline(handler, { contractDigest })` from `@bijectionhq/pack-compute/launcher`.
Each compares its installed digest with the launch before calling the handler.

## Provision it

Provision the launcher, the worker and their credentials in your own
infrastructure, and keep the worker's authority scoped to the task it accepts.
Seal the launcher's bearer on the installation under the secret path the
pool's binding names as its `credential` (`bijection secret set <path>`).

A compute mount's worker pools are [slots](https://docs.bijection.com/operate/placement.md),
`<compute>.pools.<name>`, of the `worker@1` protocol. No host offers
`worker@1` today, so bind each pool to your own launcher with `workerPool.aws`
or `workerPool.gcp` from `@bijectionhq/pack-compute` in the installation's bindings file: the launcher's HTTPS `url`, the `credential` that
holds its bearer, and the account, region or project its workers run in. An unbound pool is
refused at deploy with `PlacementUnavailable` (`NotOffered`). When a host
offers managed workers, unbound pools become managed with no code change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.