A monthly NAV run doesn’t start from scratch. It needs last period’s totals so a quality check can flag “rent dropped 12% MoM” or “journal line count is 2× the trailing average”.Documentation Index
Fetch the complete documentation index at: https://docs.ntropii.com/llms.txt
Use this file to discover all available pages before exploring further.
ntro.workflow.history exposes a single helper for that: load_previous_task.
Install
load_previous_task
PreviousTaskHandle.extract(fields) returns a flat {field: value} dict, dropping any fields the prior run didn’t emit — the caller decides how to handle gaps. Pass the projected dict straight into run_quality_check as checks_baseline; checks marked requires_baseline=True are reported as status="skipped" when baseline is None.
Soft-degrade is the contract.
None means “no prior task found” and is the normal first-run state. Callers should skip baseline-dependent checks rather than raise. The SDK never throws on a missing prior run.Signature
Wiring into a runbook
self.load_previous_task(...) schedules a Temporal activity under the hood. Your runbook bundle’s activities.py must re-export the activity defn so the worker registers it:
__all__ is what gets registered with the worker.
Reference
| Symbol | Where |
|---|---|
load_previous_task(workflow_slug, entity_id, before_period=None) | ntro.workflow.history |
load_previous_task_activity (re-export in runbook __all__) | ntro.workflow.history |
PreviousTaskHandle (.task_id, .period, .output, .extract(fields)) | ntro.workflow.history |
NtroWorkflow.load_previous_task(...) | ntro.workflow.base (terser convenience) |
Related
Quality checks
Pair the baseline dict with
run_quality_check for MoM delta checks.Workflows overview
NtroWorkflow and @ui_step — the surface this helper extends.