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

# Stream joint probabilistic futures

> Configure state-conditioned joint futures in a persistent Domain, stream resolved observations and multi-revision queries, evaluate decisions under uncertainty, and monitor retained state.

Use Probabilistic Futures to operate a persistent, state-conditioned probabilistic world model inside an Adapt-1 Domain. By retaining paired historical outcomes as joint probability atoms (`branches`), Adapt-1 preserves cross-channel tail dependence across simultaneous outcomes, holds prequential forecast receipts across multi-revision `future_id` updates as evidence arrives, and learns online from every scored outcome.

Use the returned joint distribution directly when your action does not alter the future outcome distribution, or connect the same persistent transition model to [Probabilistic planning](https://docs.reilabs.org/docs/neuroadapt/futures/planning.md) when actions change future states or outcomes.

> [!NOTE]
>
> **Handled automatically by default:** Adapt-1 automatically abstains below `required_support: 2` or outside `max_distance: 0.75` within the matching group and action, learns prequential prior-versus-kernel blending weights under default `conditioning: "adaptive"`, subsets conditioning to present keys when partial evidence is sent on `POST /query`, groups and scores multi-revision forecasts via default `future_id_path: "metadata.future_id"` before ingesting the closing outcome, and applies 75/25 chronological RMSE-skill gating with empirical fallback whenever `numeric_transport: "linear_residual"` is enabled.

Send `Authorization: Bearer <token>`, a descriptive non-default `User-Agent` (to avoid Cloudflare `403` error `1010`), `Accept: application/json`, and `Content-Type: application/json`, and serialize strict RFC-8259 JSON (no `NaN`, `Infinity`, or `-Infinity`). See [HTTP and contracts](https://docs.reilabs.org/docs/neuroadapt/request-contracts.md).

## Configure the Domain

For complete joint exports without truncation past event 16, create the Domain with this 8-key `learning.transition` setup:

```json theme={null}
{
  "domain_id": "site-joint-futures",
  "session_id": "ignored",
  "schema": {
    "signals": ["temperature_c", "wind_speed_mps", "demand", "generation"],
    "event_types": ["outcome"]
  },
  "learning": {
    "transition": {
      "enabled": true,
      "event_types": ["outcome"],
      "input_paths": ["values.temperature_c", "values.wind_speed_mps"],
      "targets": [
        {"path": "values.demand", "type": "number"},
        {"path": "values.generation", "type": "number"}
      ],
      "max_samples": 128,
      "futures": {
        "enabled": true,
        "max_support": 128,
        "max_branches": 128
      }
    }
  }
}
```

Declare the bare signal names (`"temperature_c"`, `"wind_speed_mps"`, `"demand"`, and `"generation"`) in `schema.signals` and `"outcome"` in `schema.event_types`. Aligning `max_samples`, `max_support`, and `max_branches` at `128` (or fewer) exports the complete retained joint atom cloud without striding or silent tail truncation (server defaults `max_branches: 16` and `max_support: 256` begin dropping continuous branch mass into `omitted_probability` on event 17).

If you only read 1D `marginals` rather than joint `branches`, you can omit all three `128` caps (a 5-key `learning.transition` setup, scaling `max_samples` and `max_support` up to `1,024`); for categorical or boolean targets, decode canonical JSON keys in `marginals.*.probabilities` with `json.loads`.

## Seed and stream

1. **Create the Domain and seed resolved observations:** Send completed historical rows to `POST /domains/{domain_id}/events` (or optionally pre-seed via `POST /domains/{domain_id}/batch` with at most `50` `"event"` or `"feedback"` operations per call; `/batch` does not accept `"query"`). Send complete finite `values` and a strictly increasing UTC ISO-8601 `timestamp` (`...Z`, incrementing ties by `+1 ms` so repeated discrete rows are not deduplicated), and confirm `learner_eligibility.accepted` on every response (incomplete or `null` event inputs still return `HTTP 201` with `learner_eligibility.accepted: false`, `rejection_reason: "missing_input_paths"`, and `sample_count_delta: 0`).
2. **Issue a forecast at decision time:** Call `POST /domains/{domain_id}/query` with currently observed inputs in `context.values`, a stable `context.metadata.future_id`, `update_memory_state: false`, and `return_fields: ["decision_id", "transition_prediction"]`. Futures queries still allocate `pending_forecasts` receipt slots even when `update_memory_state` is `false`. Omit unavailable query keys rather than sending `null` when missingness is non-informative (MCAR), or include explicit missingness indicator flags when missingness predicts the outcome (MNAR).
3. **Check forecast status and abstention reason:** Read `transition_prediction.futures.status` (`"predicted"` or `"abstained"`, never `"ready"`). On `"predicted"`, save `decision_id`, `future_id`, and the returned distribution; on `"abstained"`, read `transition_prediction.futures.abstention_reason` and apply your fallback.
4. **Verify complete joint support:** Confirm `omitted_probability` is `0` (at most `1e-6`) before evaluating joint events over `branches`, and never renormalize truncated branches to `1.0`. Live wire branch probabilities round to 4 decimal places, so `sum(b["probability"] for b in branches)` can differ from `1.0` by roughly `1e-4` even when `omitted_probability == 0`.
5. **Resolve once the outcome matures:** Submit one `POST /domains/{domain_id}/events` with complete finite issue-time features, measured targets, and a strictly increasing UTC ISO-8601 `timestamp`. Attach `decision_id` (from the latest `"predicted"` query) and `future_id` in `metadata` only when the forecast status was `"predicted"` (omit both for unissued or abstained queries to avoid leaking `pending_forecasts`), and verify both `learner_eligibility.accepted` and the nested path `learner_eligibility.futures_update.accepted`.
6. **Repeat strictly in outcome availability order:** Never seed or resolve an outcome before it becomes available to your application. To revise an open forecast as new signals arrive, query again with the same `future_id` and all currently known inputs; one closing event scores all pending revisions strictly before ingesting the resolved outcome once. Inspect `pending_forecasts` via `POST /explain` (`update_memory_state: false`) to verify that settled outcomes reconcile cleanly.

## Score action-independent decisions over joint branches

When your choice of action does not alter the future outcome distribution, issue one joint forecast with `action_path` omitted and evaluate each permitted action over the same weighted joint branches. For instance, evaluate reserve capacity against joint demand and wind generation:

```python theme={null}
from math import fsum


def choose_reserve(futures, capacities, unit_cost, shortage_cost):
    if futures["status"] != "predicted":
        raise ValueError("No forecast available")
    branches = futures["branches"]
    weights = [float(b["probability"]) for b in branches]
    # Live wire branch probabilities round to 4 decimal places, so sum(weights)
    # can differ from 1.0 by roughly 1e-4 even when omitted_probability == 0.
    if futures["omitted_probability"] > 1e-6 or abs(fsum(weights) - 1) > 0.01:
        raise ValueError("Incomplete joint support")

    def cost(capacity):
        return unit_cost * capacity + fsum(
            w * shortage_cost * max(
                0.0, b["path_values"]["values.demand"]
                - b["path_values"]["values.generation"] - capacity
            )
            for b, w in zip(branches, weights)
        )

    return min(capacities, key=cost)
```

Avoid conditioning transitions on actions that do not alter the outcome distribution, since doing so partitions retained transition evidence across actions unnecessarily. When actions change the resulting outcome distribution, alter future states, or require multi-step lookahead, use [Probabilistic planning](https://docs.reilabs.org/docs/neuroadapt/futures/planning.md).

> [accordion] Enable linear\_residual numeric transport for shifting levels
>
> Default `numeric_transport: "none"` produces valid empirical joint distributions immediately from row 2. Opt in to `"numeric_transport": "linear_residual"` under `learning.transition.futures` when context shifts numeric target levels while paired residuals preserve cross-channel tail co-movement.
>
> * **Automatic activation gate:** Transport activates per numeric target once matching support reaches at least `nh >= max(29, 2 * (d + 1))` complete finite rows for `d` numeric inputs and passes the 75/25 chronological RMSE-skill gate (`numeric_min_skill`, default `0.0`). While under-seeded or below threshold, `futures.numeric_transport.status` returns `"unavailable"` and the server automatically falls back to untransported empirical futures.
> * **Regularization and outlier protection:** Start with `"numeric_ridge": 1.0` under `learning.transition` (replacing the `1e-8` default) and keep inputs compact (`2` to `6` low-collinearity numeric features, or up to `8` mixed). Because leave-one-out residuals can amplify high-leverage outliers on heavy-tailed or shock-prone streams, apply causal rank or variance-stabilizing transforms and tune `numeric_ridge` (for example `10.0` to `40.0`) on an earlier calibration partition.
> * **Physical bounds:** `linear_residual` does not enforce physical limits on transported targets; validate or post-clip exported branch values client-side, or forecast on an appropriate transformed scale.

> [accordion] Tune conditioning, missing-feed masks, shock admission, and batch seeding
>
> * **`conditioning: "kernel"` versus `"adaptive"`:** Default `"adaptive"` shrinks toward the unconditioned prior until linked resolutions accumulate (`resolved_support > 0`), so queries after unlinked historical seeding can appear flat. Switch to `"conditioning": "kernel"` for immediate sensitivity on unlinked historical seeds, multi-action planning, or streams with more than `10` distinct missing-feed masks (and raise `max_calibration_groups` up to `1024` when tracking many mask, group, and action combinations). Changing `prior_strength` has no effect under `"kernel"`.
> * **Shock admission (`max_distance`):** `max_distance` controls query admission rather than zeroing individual branch weights. Raise it from default `0.75` to `1.0` on heavy-tailed or shock-prone streams if `0.75` abstains too aggressively.
> * **`POST /batch` pre-seeding does not resolve `future_id`:** Pre-seeding resolved observations via `POST /batch` (at most `50` operations per call) populates `transition_samples` cleanly with `pending_forecasts: 0`, but `/batch` `"event"` operations do not resolve open `future_id` receipts. Always submit closing resolutions for issued forecasts through `POST /events`.

> [accordion] Pair with automatic Transition Discovery
>
> To discover inputs automatically instead of authoring `input_paths`, set `"input_paths": []` with `"autonomous_projection": {"enabled": true, "maximum_input_paths": 8, "maximum_buffered_events": 128}` alongside `learning.transition.futures`. Transition Discovery pairs natively with joint numeric targets, state-conditioned error distributions, and mixed multi-revision streams.
>
> * **Streaming warmup vs. optional `/batch` pre-seeding:** Normal `POST /events` traffic activates Discovery automatically (early events return `learner_eligibility.accepted: false` with `rejection_reason: "projection_accumulating"` until `status: "ready"`, when buffered rows rebuild together). Optional `/batch` pre-seeding transitions directly to `status: "ready"` with `input_source: "discovered"` and `pending_forecasts: 0`.
> * **Pin essential structural keys:** Inspect active discovered `input_paths` via `POST /explain`. Because warmup screening can drop slow regime or cross-entity indicators that matter mainly during rare shifts, pin essential structural keys in `input_paths` while letting Discovery select covariates, and pin reviewed paths once production semantics must stay fixed. Use a separate Domain when evaluating an independent calibration partition. See [Discover transition inputs](https://docs.reilabs.org/docs/neuroadapt/discovery-transition-projection.md).

## Model state-conditioned error distributions around an existing forecaster

When you already operate an existing forecaster whose uncertainty intervals degrade under changing conditions, you can apply the same persistent futures surface to model the state-conditioned distribution of its realized errors. Use only forecasts recorded at issue time and outcomes already resolved at ingestion time.

* **Audit the raw forecaster on an earlier calibration partition first:** Evaluate the raw forecaster's tail coverage and calibration on a separate earlier calibration partition before wrapping it. Adopt state-conditioned error distributions when conditional residuals improve tail coverage, calibration, or proper scores over unconditioned residuals.
* **Additive residuals:** Record the observed target minus the issue-time median forecast, pair with `numeric_transport: "linear_residual"` and calibrated `numeric_ridge` regularization, and add each returned error branch to the current issue-time median.
* **CDF-transformed residuals:** If the existing forecaster supplies a predictive CDF, transform realized outcomes through that CDF and the standard-normal inverse CDF, clipped to a finite range such as `[-4.5, 4.5]`. Pair with `numeric_transport: "none"` or `"linear_residual"`, then map returned branches back through the standard-normal CDF and the current forecaster's inverse CDF.
* **Support and causal inputs:** Use a shared joint window of `128` (`max_samples = max_support = max_branches = 128`) for complete joint error clouds and compact causal inputs (domain signals plus issue-time forecast dispersion and level summaries). Seed with resolved errors computed strictly from forecasts saved at issue time.

Check calibration, tail exceedance rates, proper scores, and realized decision cost on a later untouched partition.

## Maintain state

* **Monitor persistent state with `POST /explain`:** Call `POST /domains/{domain_id}/explain` with `update_memory_state: false` to track `state_identity.counters.transition_samples`, `state_identity.counters.evidence_memories`, and `learning_state.subsystems.structured_transition.futures.pending_forecasts` alongside `resolved_count`, `mean_energy_score`, and `mean_prior_energy_score`. Keep production Domains persistent so retained evidence, calibration histories, and learned projections continue to compound over time.
* **Continuous bounded retention vs. hard resets:** Prefer continuous bounded retention on noisy streams so conditional similarity preserves tail coverage across changing conditions. Reserve hard resets for genuine structural discontinuities where prior transition dynamics no longer apply.
* **Preview `evidence_memories` limit:** In the current Preview deployment, `state_identity.counters.evidence_memories` continues growing with ingested events even when transition sample retention is bounded, which can gradually increase latency or approach storage quotas on long streams (for example after `1,000` to `3,000` events). Monitor `evidence_memories` via `POST /explain`, and follow [Preview operational limits](https://docs.reilabs.org/docs/neuroadapt/operational-behavior-and-retries.md#preview-operational-limits) and [Inspect learning and troubleshoot](https://docs.reilabs.org/docs/neuroadapt/futures/diagnostics.md) if you reach that ceiling or need an intentional reset.

See [Inspect learning and troubleshoot](https://docs.reilabs.org/docs/neuroadapt/futures/diagnostics.md), [Configuration reference](https://docs.reilabs.org/docs/neuroadapt/futures/configuration.md), [Operations and retries](https://docs.reilabs.org/docs/neuroadapt/operational-behavior-and-retries.md), and [Errors and reliability](https://docs.reilabs.org/docs/neuroadapt/errors-and-reliability.md).


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