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.task exposes task-level operations a runbook can call from inside a running workflow — previous(...) for prior-task lookup, find_committed_document(...) for retrieving committed documents.
Renamed from
ntro.workflow.history in Phase 1 of N-74. The narrower history name was a poor fit once this module became the home for any task-level operation a workflow might want (task.current() and task.get(task_id) will land in Phase 2+). The instance method self.load_previous_task(...) on NtroWorkflow is unchanged and still works for terser runbook code.Install
task.previous
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:
load_previous_task_activity, find_committed_document_activity) kept their original names — these are network identities consumed by deployed workflows and must stay stable. Only the import path changed (ntro.workflow.history → ntro.workflow.task).
Same re-export pattern as Quality checks. Activities live in the SDK; the runbook bundle’s __all__ is what gets registered with the worker.
Reference
| Symbol | Where |
|---|---|
previous(workflow_slug, entity_id, before_period=None) | ntro.workflow.task |
find_committed_document(workflow_slug, entity_id, source, before_period=None) | ntro.workflow.task |
load_previous_task_activity (re-export in runbook __all__) | ntro.workflow.task |
find_committed_document_activity (re-export in runbook __all__) | ntro.workflow.task |
PreviousTaskHandle (.task_id, .period, .output, .extract(fields)) | ntro.workflow.task |
NtroWorkflow.load_previous_task(...) | ntro.workflow.runbook (terser instance-method convenience; unchanged) |
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.