Reasoning is
probabilistic.
Execution is
deterministic.

Invariant is a deterministic execution runtime for AI systems.

Most AI systems use models as application servers.

Invariant uses models as decision engines.

Models reason. Infrastructure executes.

Lower Token Cost

Only send the model what the current decision needs.

Hallucination Protection

Models propose. Infrastructure decides.

Reliable Execution

Execution continues exactly where it stopped.

Read the architecture
The market doesn't need smarter agents. It needs predictable ones.

Stop Paying to Rebuild Context

Most agent frameworks rebuild context by stuffing more history into every prompt.

Invariant stores durable runtime state once, then projects the right runtime view for each decision.

That smaller prompt is not magic. It is projected.

  • Lower token cost
  • Fewer hallucinations
  • No duplicated actions
  • No lost context
  • Predictable execution
  • Minimal prompt growth
Traditional Agent

Context-Heavy Loop

Active context~100,000 tokens
[system] You are an agent...
[user] Help me book a flight...
[tool_call] search_flights(2026)...
[tool_result] flights: [{...}]...
[user] Actually email the customer...
[tool_call] send_email(to: "jose")...
[system] Memory history log updated...
The same context for every decision.
Invariant Runtime
Workflow State
policy · fact · trace · episode · execution
Projection Engine
resolveStrategy( nodeType × executionType )
MODEL
Focused

Reasoning View

Facts, preferences, policies, trimmed chat history, current task

TOOL
Small

Execution View

Current action, previous actions, retries, idempotency keys

SYSTEM
Minimal

Rules View

Policies, constraints, validation state, deterministic checks

HUMAN
Concise

Intervention View

Summary, pending decision, available actions, relevant context

Focused context

Every interaction becomes an event. Every event advances a workflow run.

AI systems don't fail because they lack intelligence, they fail because reasoning and execution are mixed together. Context gets lost, actions get duplicated, workflows race across channels, and human intervention breaks state. Invariant separates reasoning from execution, providing a deterministic runtime built around workflow runs, events, and durable execution.

Traditional Agent

Context grows forever. Costs grow forever.

Unstructured Inputs
User Request
Prompt Templates
History Logs (42 msgs)
25 API Tools
Active Context

0 Tokens

OVERHEADLOW
COSTLOW
efficiency+100%

Context Projection

Store state once. Don't pay for it twice.

Durable Sources
Durable State
Event Log
Active Context
State Projections

0 Tokens

state_slicev42_init
OVERHEADMINIMIZED
token_saving0%

Hallucination Protection

Models propose. Infrastructure decides.

Validation Pipeline
Model proposes action
Runtime validates schema
VALIDATION
04. Outbox Worker
Execution Contract

Active State Guard

STATUS● PROPOSED
invalid_opsPENDING
INTEGRITYPENDING

Durable Runtime State

One source of truth.

Event Stream Log
ev_1: init_run
ev_2: state_set
ev_3: outbox_log
Durable State

wr_8f29c0

STATUS● INACTIVE
state_seq#0
writer_lockFREE

Multi Channel

One Runtime State. Many Channels.

Incoming events
WhatsApp
Email
Voice Call
Chat Widget
Human Dashboard
CONCURRENCY

Safe Concurrency

run_idwr_8f29c0
QUEUE0
concurrencyIDLE

Built for real-world execution.

Invariant implements key patterns from distributed systems, making AI runs reliable, transactional, and transparent.

Models
Invariant
Business Systems

Event Sourcing

Every state transition is reproducible.

Understand exactly what happened and why. Instead of saving mutable state, Invariant records every single runtime event (inputs, tool results, API projections) to an append-only log. Project the log to rebuild state at any point.

Immutable Event Log
[USER_MESSAGE]
[TOOL_RESULT]
[APPROVAL]
[EMAIL_SENT]
State Projection

State Version #0

statusINITIAL
replay_speed-
integrityPENDING

Transactional Outbox

Execution is decoupled from reasoning.

Use OpenAI, Anthropic, Gemini, local models, or future providers. As models evolve, your core state machines, security validation rules, and transactional workflows remain unchanged.

Reasoning Models
OpenAI GPT-4o
Anthropic Claude 3.5
Google Gemini 1.5
Meta Llama 3.1
Invariant Runtime

Same Runtime State

routing_logicpending
runtime_stateready
model_swapidle

Human-in-the-Loop

Most events never require a model call.

Invariant uses deterministic routing whenever possible and falls back to AI only when reasoning is actually required. The fastest and cheapest model call is the one you never make.

Incoming Stream
100% Incoming Events
90% Deterministic
0 TOKENS

Rules & State Contracts

Processed instantly in runtime without LLM calls.

10% Reasoning
LLM CALL

Probabilistic Fallback

Routed to LLM only when reasoning is required.

Single Writer Per Run

Concurrent across the system. Sequential within the run.

Incoming events from WhatsApp, email, voice streams, or human dashboards are queued and processed sequentially. No race conditions, no duplicate API side-effects, and no corrupted state.

Concurrent Events
Webhook Event
Voice Stream
Human Action
Incoming Email
Sequential Queue

Single Writer

run_idwr_8f29c0
state_version#40
writer_statusIDLE

One Runtime State.
Many Channels.

Customers switch channels. Your state shouldn't.

Route events from voice, email, WhatsApp, widgets, APIs, and human operators into the same runtime state without duplicating state, losing context, or racing state mutations.

No duplicate actionsSeamless channel handoversZero context loss
Incoming Event Sources
WhatsApp
Email
Voice Call
Chat Widget
Human Dashboard
Runtime State

Same Runtime State

run_idwr_8f29c0
queue_len0
concurrencyIDLE

Used by:

Voice & Call Centers

Keep call state durable across calls, SMS, email, and human handoffs.

Customer Support Workflows

Suspend workflows for approval without losing context or duplicating actions.

Human Approval Systems

Run long-lived workflows with validated actions and transactional side effects.

Developer Experience

Write business logic.
Invariant handles the rest.

Deploy complex AI agents without managing state databases, race conditions, or unreliable side effects. You write simple TypeScript; get a production-ready, event-driven runtime distributed for free.

  • Durable State
  • Event Sourcing
  • Transactional Outbox
  • Recovery
  • Multi Channel

Distributed systems patterns included by default.

1const workflow = new Invariant({
2 id: 'customer-support'
3})
4 
5workflow.on('message', async (ctx) => {
6 const decision = await ctx.llm.chat(...)// Reason
7 
8 await ctx.transition(decision)// Validate
9 
10 await ctx.outbox.dispatch(...)// Execute
11})

The Invariant Stack

A deterministic execution runtime. Event-sourced, transactional, and resilient to failure.

Step 01

Channels

Voice, WhatsApp, emails, widgets, or standard APIs dispatch events.

Step 02

Router

Routes events deterministically whenever possible. Invokes AI reasoning only when required.

Step 03

Workflow Runs

Isolated, single-writer state machines executing logic sequentially.

Step 04

Event Log

Append-only historical event log. Derives exact state projections.

Event Sourcing makes runs replayable and lets you audit state transitions.
Step 05

Outbox

Transactional queue guaranteeing actions execute exactly once.

Step 06

External Systems

CRMs, calendars, databases, or third-party webhooks receive effects.

Why the Event Log drives determinism

Instead of saving variable values in a traditional mutable database, Invariant writes every single runtime event (inputs, tool results, API projections) to an append-only Event Log. The current state is built on demand by projecting these events. If a process restarts or an LLM call fails, the engine replays the Event Log deterministically to restore state without repeating side effects.

Common Failure Modes Invariant Prevents

Current agent frameworks optimize for short demos. Invariant is built to stop execution bugs before they impact production.

Lost Context

Pain PointServer restarts, crashed runs, or network disruptions drop execution state.
Invariant persists checkpoints on every single step. Server restarts. Execution state survives.

Hallucinated Actions

Pain PointModels output invalid payloads or propose executing unauthorized APIs.
Edge conditions and schemas are validated by the runtime. Invalid transitions never execute.

Token Explosion

Pain PointConcatenating the entire chat history into every single model call causes token usage to grow exponentially.
Invariant stores state in the runtime. Only projects what the current node needs to decide.

Unnecessary Model Calls

Pain PointEvery request goes through an LLM, increasing costs, latency, and failure rates.
Most events are resolved deterministically. Models are only invoked when reasoning is required.

Race Conditions

Pain PointConcurrently triggered webhooks or human actions overwrite model state and trigger duplicate side effects.
Sequential event loops guarantee deterministic mutations. Single writer per runtime state.

Human Intervention

Pain PointExecutions break when a user needs to review, approve, or provide structured inputs.
Runs suspend natively. A workflow can wait hours, days, or weeks. The state remains durable, and execution continues exactly where it stopped.

Ready to scale your AI systems?

Reasoning is only half the problem. Execution is where reliability begins.

“AI must be infrastructure, not a religion.”

Next Steps

Schedule an architecture review or a deep dive with our core engineering team.

Talk to Engineering

Discuss your architecture, identify reliability bottlenecks, and explore whether Invariant is the right fit for your engineering team.

Architecture Review

Already building AI systems? We’ll review your current architecture, identify token inefficiencies, state management problems, hallucination risks, and reliability bottlenecks.

Architecture Deep Dive

Explore how we implement append-only event sourcing, strict transition validations, outbox patterns, and single-writer concurrency controls.

Read the Stack

Frequently asked questions

If you can’t find the answer you’re looking for, reach out to our engineering team on Discord or email.

  • What is a Workflow Run?

    A Workflow Run is an isolated execution instance with its own state, event history, outputs, and side effects. Multiple channels, users, tools, and humans can interact with the same execution while Invariant guarantees deterministic execution.

  • How does Invariant guarantee deterministic execution?

    Execution paths are defined as strict state transition graphs in immutable JSON. The local runtime evaluates edge routing deterministically, preventing the LLM from executing arbitrary or unintended code paths.

  • Can I run Invariant on my own infrastructure?

    Yes. The Control Plane runs as a lightweight in-process orchestrator in Node.js/TypeScript. It can be deployed in a Docker container in your own VPC or Kubernetes cluster, using any PostgreSQL instance.

  • Why does Invariant reduce token usage?

    Most frameworks continuously resend conversation history, runtime state, tool outputs, and execution logs back to the model. Invariant stores state in deterministic infrastructure and projects only the information required for the current step, reducing unnecessary context and model calls.

  • What is the outbox pattern and why do I need it?

    The Transactional Outbox pattern ensures side effects (like API calls, database updates, or emails) are committed in the same database transaction as the runtime state. If the execution fails or restarts, side effects are never duplicated or lost.

  • Is Invariant compatible with LangChain or AutoGen?

    Invariant operates at a higher infrastructure layer. You can use any framework or raw API inside the model execution nodes. Invariant provides the reliability, state durability, and routing, while you use whichever LLM libraries you prefer.

  • Why not just use LangGraph, AutoGen, or CrewAI?

    Those frameworks help orchestrate model calls. Invariant manages execution state, deterministic routing, event sourcing, transactional side effects, and recovery. You can use Invariant alongside any agent framework or model provider.

  • How does Human-in-the-Loop suspension work?

    When an execution hits an input node, it suspends and persists the state. A client application (like our Nuxt Tenant App or Chat Widget) can then fetch the required schema, collect user input, and resume execution with a simple API call.

  • Does Invariant support multiple LLM providers?

    Yes. Invariant is fully model-agnostic. You can switch between OpenAI, Anthropic, Gemini, local models (via Ollama or vLLM), or custom endpoints by simply changing the model configuration in your runtime JSON.