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.
Workflow Run #42
Deliver messages. Request input. Collect approvals.
Execute effects on any external service or API.
Each node receives only the view designed for the work it is about to perform.
Infrastructure executes.
Models reason.
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
Context-Heavy Loop
Reasoning View
Facts, preferences, policies, trimmed chat history, current task
Execution View
Current action, previous actions, retries, idempotency keys
Rules View
Policies, constraints, validation state, deterministic checks
Intervention View
Summary, pending decision, available actions, relevant 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.
Context Projection
Store state once. Don't pay for it twice.
Hallucination Protection
Models propose. Infrastructure decides.
Durable Runtime State
One source of truth.
Multi Channel
One Runtime State. Many Channels.
Context grows forever. Costs grow forever.
0 Tokens
Built for real-world execution.
Invariant implements key patterns from distributed systems, making AI runs reliable, transactional, and transparent.
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.
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.
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.
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.
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.
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.
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.
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.
State Version #0
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.
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.
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(...)// Reason7 8 await ctx.transition(decision)// Validate9 10 await ctx.outbox.dispatch(...)// Execute11})The Invariant Stack
A deterministic execution runtime. Event-sourced, transactional, and resilient to failure.
Channels
Voice, WhatsApp, emails, widgets, or standard APIs dispatch events.
Router
Routes events deterministically whenever possible. Invokes AI reasoning only when required.
Workflow Runs
Isolated, single-writer state machines executing logic sequentially.
Event Log
Append-only historical event log. Derives exact state projections.
Outbox
Transactional queue guaranteeing actions execute exactly once.
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
Hallucinated Actions
Token Explosion
Unnecessary Model Calls
Race Conditions
Human Intervention
Ready to scale your AI systems?
Reasoning is only half the problem. Execution is where reliability begins.
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.
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.