---
title: '@0xintuition/pipeline-runtime'
description: Bound Promise work, share cache contracts, handle cancellation, and observe provider requests.
url: https://docs.intuition.systems/docs/reference/packages/pipeline-runtime
markdown_url: https://docs.intuition.systems/docs/reference/packages/pipeline-runtime.md
version: V2
llms_index: https://docs.intuition.systems/llms.txt
kind: reference
reader:
  - app
  - plugin
packages:
  - '@0xintuition/pipeline-runtime@0.1.1'
---

## What it's for

Promise utilities for bounded concurrency, cancellation, circuit breaking, caching, and provider observation. It supplies shared execution contracts; it does not store a graph or start a processing service.

## When to use it

Use it when a host needs ordered concurrent work or a consistent outcome vocabulary across providers. Use [atom runtime](https://docs.intuition.systems/docs/reference/packages/atom-runtime) to compose classification and enrichment engines. Effect services and retry layers belong to your application; these functions accept Promise callbacks.

## Install

```sh
npm install @0xintuition/pipeline-runtime@0.1.1
```

Use ESM `import` or CommonJS `require()` on Node 20 or newer. On Node 20.19+ / 22.12+, both resolve to the same module instance, preserving shared error-class identity. Earlier supported runtimes load separate copies when formats are mixed. The documentation examples use Node 22.21.0. See [module-format compatibility](https://docs.intuition.systems/docs/reference/compatibility#runtime-requirements).

## Entry points

All public modules

| Subpath | Purpose |
| --- | --- |
| `.` | Shared errors, provider contracts, test helpers, and TMDB endpoint builder |
| `./bounded-text` | Read streaming response text within a byte limit |
| `./cache` | Cancellable cache contract and memory TTL adapter |
| `./errors` | Shared pipeline error vocabulary |
| `./provider-observer` | Provider observation events and contracts |
| `./provider-metrics-contract` | Metric labels, normalization, and series contract |
| `./retry-after` | Parse and bound retry delays |
| `./letterboxd` | Letterboxd host policy and circuit state |
| `./letterboxd-page` | Parse Letterboxd page identity |
| `./tmdb` | TMDB endpoint policy |
| `./testing/prometheus-exposition` | Validate Prometheus exposition; optional Node tool invocation |
| `./outcome` | Outcome union, cancellation, and timeout helpers |
| `./circuit-breaker` | Circuit breaker, snapshots, and admission errors |
| `./concurrency` | Ordered bounded Promise execution |
| `./provider-metrics-contract.expected` | Expected provider metric series counts |
| `./provider-registry` | Provider definitions and operation contracts |
| `./provider-request-observation` | Observe and record provider requests |
| `./request-slot` | Provider request admission contracts |
| `./testing/provider-golden` | Provider golden-fixture helpers |
| `./testing/held-request-slot` | Controlled request-slot test helpers |
| `./testing/virtual-clock` | Deterministic clock for tests |
| `./provider-metrics` | Alias of the provider metrics contract |

## Depends on and works with

Runtime package dependencies: none. Peer dependencies: none.

Classification, enrichment, and atom runtime consume these contracts. A memory cache is process-local; an adapter is not a provisioned database. Provider-specific host policies do not replace your application's complete egress policy.

## @0xintuition/pipeline-runtime - Example

This fixed input needs no network or credentials. The result keeps input order even when callbacks finish in a different order.

```ts
import { forEachBounded } from '@0xintuition/pipeline-runtime/concurrency';

const controller = new AbortController();
export const outcomes = await forEachBounded(
  ['recording', 'artist', 'release'],
  async (label, signal) => {
    signal.throwIfAborted();
    return label.toUpperCase();
  },
  { concurrency: 2, signal: controller.signal },
);

for (const outcome of outcomes) {
  if (outcome.kind === 'success') console.log(outcome.value);
  else console.log(outcome.kind);
}
```

Successful outcomes carry `value`. The full outcome union also includes `failure`, `defect`, `timeout`, and `interrupted`. In `forEachBounded`, a synchronous callback throw is a defect and a returned Promise rejection is a failure. Parent cancellation rejects the batch with its abort reason, prevents queued work, and signals active callbacks; callbacks must honor that signal to stop I/O.

`CircuitBreaker.execute` admits one probe after its reset window. Its failure filter determines whether an admitted failure or cancellation counts toward opening the circuit; cancellation before admission starts no work. Inspect `snapshot()` without changing state.

## Related concepts

- [Atom runtime and pipelines](https://docs.intuition.systems/docs/concepts/atom-runtime)

See also [How the pieces fit](https://docs.intuition.systems/docs/get-started/how-it-fits), [Classify and enrich atoms](https://docs.intuition.systems/docs/build/classify-enrich).

## Source

[Package README](https://github.com/0xIntuition/packages/blob/ccae0f0d0277cddd8490b72c49d3771866e7ffea/packages/pipeline-runtime/README.md), [public exports](https://github.com/0xIntuition/packages/blob/ccae0f0d0277cddd8490b72c49d3771866e7ffea/packages/pipeline-runtime/package.json), and [concurrency implementation](https://github.com/0xIntuition/packages/blob/ccae0f0d0277cddd8490b72c49d3771866e7ffea/packages/pipeline-runtime/src/concurrency.ts).

Applies to V2 · `@0xintuition/pipeline-runtime` 0.1.1
