Skip to content

How to run the hybrid execution workflow

This guide covers the repeatable day-to-day commands for planning, reviewing, applying, following, and destroying a Netherframe app in hybrid execution mode.

Prerequisites: An installed nf CLI, an app registered under [tool.nf].apps in pyproject.toml, and credentials for your target providers. (New to Netherframe? Start with Tutorial 1.)


1. Register the app and verify selectors

Ensure pyproject.toml lists your app module and object or factory:

[tool.nf]
apps = ["infra:app"]

Confirm what nf sees—including the app selector, its typed inputs, and its resolved state backend:

nf list apps
nf vars --app app
nf backend show

2. Save and inspect a whole-app plan

Always save a plan artifact when reviewing changes before applying:

nf plan --app app --diff --out reviewed-plan.json

Pass typed inputs with ++name=value (or ++@file.toml) if your app is a factory:

nf plan --app web ++env=staging --diff --out staging-plan.json

Inspect a saved plan later without re-running providers:

nf show --plan-file reviewed-plan.json

In CI drift checks, add --expect-no-changes (exits 3 when changes exist) and --json for structured parsing.


3. Apply the reviewed plan

nf apply --app app --plan-file reviewed-plan.json
  • At the interactive prompt, type details to expand attribute diffs, then yes to apply.
  • For an interactive plan-and-apply in one step during local iteration, use nf deploy --app app.
  • For unattended automation (CI/CD), pass --auto-approve (and --json if consuming structured output). Remember that --auto-approve refuses unapproved imports unless --approve-imports is passed, and refuses undeclared stack deletions unless applying a saved plan.
flowchart TD
    A["Edit Python app"] --> B["nf plan --app app --out plan.json"]
    B --> C{"Review diff & checks"}
    C -->|Revise| A
    C -->|Approve| D["nf apply --app app --plan-file plan.json"]
    D --> E["nf plan --app app (verify no changes)"]

4. Watch a run or explore interactively

  • Follow an active apply from another terminal or CI: nf follow --app app
  • Browse resources, plans, diffs, runs, and dependency graphs interactively: nf tui --app app (use --readonly to inspect safely without allowing mutations).

5. Interrupt safely or recover from failure

  • Press Ctrl-C once after mutations begin to stop cleanly: in-flight resources finish and record state, unstarted resources do not begin, and your recovery_strategy (checkpoint or rollback) runs.
  • If a run fails partially, follow Rollback and recovery before retrying.

6. Destroy managed infrastructure

nf destroy --app app

nf destroy automatically rebuilds the app with the deployment inputs recorded by the last apply (and honors LifecycleRules(retain=...) and Teardown[T] flags).