Skip to content

Introduction

Invariant is a TypeScript framework for building AI applications in which models can reason without owning business authority or execution state.

Models propose. Workflows constrain. The Runtime validates and commits.

Use Invariant when an AI-assisted process must combine semantic judgment with deterministic rules, external effects, human input, and inspectable execution history.

The Core Boundary

An Agent may interpret a request, and a .reason() node may answer a bounded semantic question. Neither directly becomes application truth. The Runtime accepts only actions allowed by the current workflow and commits valid transitions through the configured store.

text
User or application


Model proposes an action ── optional


Workflow constrains allowed paths


Runtime validates and commits


Application performs explicit effects

Your application remains authoritative for identity, permissions, business data, and provider-side idempotency.

The Building Blocks

Building blockResponsibilityRead next
WorkflowDeclares the permitted execution graphWorkflows & Graph Nodes
StepRuns deterministic in-process logicExecution Semantics
CapabilityMarks an external side-effect boundaryRuntime Execution
WaitCommits a suspension boundary for external inputWorkflows: Wait
ReasonDelegates a bounded semantic decision with structured outputWorkflows: Reason
SessionCarries application context and coordinates live workflow interactionSessions & Hydration
ProjectionSelects the read-only facts visible to a consumer or modelProjections
RuntimeStorePersists committed execution and Session factsStorage & Deployment

Agents are optional. Applications, API handlers, queues, and schedulers can start workflows directly.

What the Current Beta Guarantees

With a configured durable store, Invariant persists validated workflow transitions, ordered events, materialized state, Session context, and command intent. The initiating Session synchronously drains runnable commands while its handlers remain attached in the current process.

The current public Beta does not include automatic retry scheduling, timer workers, child workflow execution, or portable cross-process work continuation. A new process can restore an owned Session and reattach a registered run paused at .wait(), but it cannot publicly claim and redispatch an interrupted capability command. See the Recovery Contract Matrix for the exact boundary.

Invariant does not make external effects exactly once. Applications must provide stable provider request identifiers, and the external provider must enforce its own idempotency semantics.

Choose Your Path

For a first implementation, continue to the Quick Start.

Invariant Durable Execution Engine.