decision control
Integrate

Embedded runtime

Run a decision in-process — in a backend, a batch, a serverless function or the browser.

@decision-control/runtime runs a decision in-process from a runtime bundle, which is one JSON document with a published version, the table and sub-decision versions it pinned and the constants it froze.

It is the same engine, so it gives the same answers; an integration test asserts exactly that against /execute.

Where it shines

  • A backend that wants a decision without a network round trip.
  • A batch job that has to answer thousands of records in one process.
  • A serverless function with no time for a database-backed execution to settle.
  • The browser, where the public playground runs the same engine.

Where to get a bundle

GET /api/v1/decisions/:key/runtime-bundle   ?version=N or ?environment=staging

The console's Export → Runtime bundle does the same. A bundle is the version you pinned plus everything it needs — tables, sub-decisions, constants — in one document.

Outbound calls, secrets, actions

  • Outbound calls use fetch by default. You can pass a custom handler or stay silent — a runtime that never calls out is the one used by the playground.
  • Secrets are supplied at runtime and never travel in a bundle. The bundle references a credential; the host resolves it when the flow runs.
  • Actions are returned, not performed. Side effects described by the decision are listed in the response for the host to do what it likes with.

Build and types

The runtime is published as one self-contained ESM file with standalone type declarations. See the package README for the exact import.

On this page