Hybrid Execution
Hybrid execution is the recommended way to run a Netherframe app. Netherframe calls Terraform provider binaries over gRPC, plans resource changes and manages state. For a complete local example, see your first hybrid app.
What the engine does
- Builds a plan from Python constructs, provider observations and recorded state.
- Orchestrates provider calls and resolves runtime values as dependencies become available.
- Records results in a Netherframe-managed backend and handles recovery after partial failure.
Architecture Diagram
flowchart LR
A[App / Stack / Resource model] --> B[Hybrid execution engine]
B --> C[Planner and apply orchestration]
B --> D[State engine]
C --> E[tfplugin6 / gRPC provider protocol]
E --> F[Provider binaries]
F --> G[Cloud and service APIs]
D --> H[Local or remote backend]
C --> D
Basic Example
from nf.core import App, Provider, Resource, Stack
def build_app() -> App:
app = App()
stack = Stack(nf_scope=app, nf_id="demo")
Provider(
nf_scope=stack,
nf_id="aws",
nf_type="aws",
region="us-east-1",
)
Resource(
nf_scope=stack,
nf_id="bucket",
nf_type="aws_s3_bucket",
bucket="replace-with-a-globally-unique-name",
)
return app
def deploy() -> None:
"""Plan and apply the app (needs credentials: not called here)."""
app = build_app()
hybrid = app.enable_hybrid_execution()
plan = hybrid.plan()
result = hybrid.apply(auto_approve=True)
app = build_app()
State Backends
You can enable hybrid execution with helper methods on App:
app.enable_hybrid_execution()app.enable_hybrid_execution_local(...)app.enable_hybrid_execution_s3(...)
Current Performance Baseline
The current end-to-end FakeCloud comparison uses the same six-resource AWS stack through both execution paths:
- hybrid: direct-provider
plan/apply/destroy - legacy: Terraform
init/plan/apply/destroy
Measured on 2026-04-13 from
test_terraform_vs_hybrid_simple_resources,
the current averages across three runs are:
- hybrid total:
11.2s - Terraform total:
30.6s - speedup:
2.7xfaster end-to-end for this scenario
This is the current documented parity-era performance baseline, not a universal claim for every provider or workload shape.
Where To Look Next
- Hybrid Semantics: current default guarantees, gaps, and parity status
- Generated Values: secrets generated once and kept in state, without hashicorp/random
- Provider Protocol: protocol details and terminology
- Examples: runnable hybrid apps, six without a cloud account
Legacy compatibility
Use nf synth with an app registered in [tool.nf].legacy_apps to export Terraform
JSON for an existing Terraform/OpenTofu pipeline. The external CLI handles the basic
lifecycle and its own backend. See the feature comparison
and command routing.