Embeddable TypeScript engine

Multi-model workflows. Inside your product.

Rulvar runs multi-agent LLM workflows inside your Node.js application. Write the work in TypeScript, route each invocation across Anthropic, OpenAI, local, gateway, or AI SDK models, and keep the run durable, budget-bounded, observable, and testable.

pnpm add @rulvar/rulvar @rulvar/openai
workflow / migrate-payments
one durable run

01 Plain TypeScript, with no graph DSL or required control plane.

02 Route models by role, profile, workflow, or individual call.

03 Resume without repeating completed model calls.

One run, frame by frame

Scroll through an execution.

The picture is the run. Scroll forward to execute it, or scroll back to inspect any earlier state.

  1. 01
    Admit the goal.

    Open one run with a fixed budget and runtime policy.

  2. 02
    Let a capable model coordinate.

    Fable sees the goal, plan, profiles, and budget.

  3. 03
    Route each role independently.

    Qwen 3.8, Luna, and GLM 5.3 do the assigned work.

  4. 04
    Journal every completed effect.

    Budget, policy, and durable state advance together.

  5. 05
    Return one explicit outcome.

    Typed result, usage, cost, and replay evidence included.

One runtime around every model call

Your code defines the work.
Rulvar keeps it bounded.

Write ordinary async TypeScript over the workflow context. Rulvar resolves a model for each invocation, applies runtime policy, journals decisions and effects, and returns one typed outcome with usage and cost.

01

Plain TypeScript.

Compose agents, parallel work, pipelines, phases, nested workflows, and external input without a graph DSL.

02

Runtime policy.

Check model floors and capabilities before dispatch, then apply tool permissions, approvals, isolation, retries, and failover as work progresses.

03

Durable evidence.

Persist completed effects, decisions, and transcripts. Emit typed events and return explicit outcomes, usage, and cost.

Per-invocation model routing

Use the right model
for each role.

Routing resolves again for every loop, extraction, finalization, summary, plan, orchestration, or synthesis call. One workflow can cross Anthropic, OpenAI, local endpoints, gateways, AI SDK models, and custom adapters.

ORCHESTRATE / HIGH EFFORT

Control model

anthropic:claude-fable-5 sees the goal, profiles, results, budget, and plan
IMPLEMENT openai:gpt-5.6-terra hosted · implementation
EXTRACT openai:gpt-5.6-luna hosted · low effort
REVIEW ollama:qwen3.8:27b local · verification
MIXED PROVIDERS

Fable coordinates the run. Terra implements, Luna extracts structured output, and Qwen 3.8 performs a local verification pass.

Self-hosted open-weight models

Connect your own inference endpoints.

Register Ollama, vLLM, SGLang, or any OpenAI-compatible endpoint. Rulvar can then route each workflow role to a workstation, private node, or GPU cluster alongside hosted models. These are examples, not a fixed catalog.

ONE ROUTING SURFACE
Workstation
Ollama
Private node
vLLM
GPU cluster
vLLM / SGLang

Rulvar orchestrates these endpoints; it does not host the checkpoints. Add pricing rows if self-hosted calls should count toward budget accounting.

01 · QWEN Qwen 3.8 27B ollama:qwen3.8:27b or vllm:Qwen/Qwen3.8-27B

A workstation-scale local worker for implementation, tool use, and multimodal review.

02 · Z.AI GLM-5.3-Flash vllm:zai-org/GLM-5.3-Flash 320B total · 18B active

Multimodal coding and agentic worker with controllable reasoning effort.

03 · MOONSHOT AI Kimi K3 vllm:moonshotai/Kimi-K3 2.8T total · 1M context

Frontier-scale control model for long engineering runs, knowledge work, and multimodal orchestration.

04 · DEEPSEEK DeepSeek V4 Flash vllm:deepseek-ai/DeepSeek-V4-Flash-0731 304B · official 0731 release

Large coding and tool-use worker for repository-scale execution and verification.

05 · MINIMAX MiniMax M3 vllm:MiniMaxAI/MiniMax-M3 427B · native multimodal

Long-context worker for coding, visual inputs, and multi-step agent tasks.

06 · MISTRAL AI Mistral Large 3 vllm:mistralai/Mistral-Large-3-675B-Instruct-2512 675B total · 41B active

General-purpose multimodal worker for multilingual review, tools, and enterprise knowledge work.

01

Four override layers.

A call overrides its profile, which overrides workflow and engine defaults.

02

Seven invocation roles.

Loop, extract, finalize, summarize, plan, orchestrate, and synthesize resolve independently.

03

Native providers, broad reach.

Use first-class Anthropic and OpenAI adapters, compatible endpoints, the AI SDK bridge, or a custom adapter.

Budget-bounded execution

Set the ceiling before work starts.

budgetUsd is immutable within a run segment. Rulvar admits work against projected cost, guards every agent turn, stops live streams at the ceiling, and attributes cost by model, role, phase, and agent profile. A resumed segment may use an explicit, validated, journaled override.

Read the budget guide
Budget path priced calls cross one enforcement path
Runtime policy quality and delivery remain explicit

Models without a price row, local or hosted, are reported as unpriced rather than free.

Three orchestration modes

Choose how the workflow is authored.

Human-written TypeScript is the simplest default. A planner can write and freeze a checked script, or an orchestrator can decide at runtime. All three share the same journal, budget path, event stream, and model routing.

A

Human script

Write the workflow in ordinary TypeScript.

Compose agents, parallel work, pipelines, and nested workflows directly. For most multi-stage work, use phases and replan between compact artifacts.

engine.run(workflow) Explore workflows ↗
C

Dynamic orchestrator

Decide the next operation at runtime.

A control model can spawn, wait, cancel, and finish under admission control. Add PlanRunner when wide fan-out needs a typed live plan, revisions, and reuse.

orchestrate(engine, goal) See adaptive mode ↗

Content-addressed journal

Resume the run, not the completed work.

On resume, the workflow body runs again from the top. Unchanged completed effects replay from durable storage, while new or changed work runs live. Transcript checkpoints preserve completed turns across processes and machines.

RUN / feature-128 RESUME PREVIEW

000planokreplayed

001agent / researchokreplayed

002agent / implementokreplayed

003agent / verifymisslive

004finalizewaitingqueued

3replay hits
1live call
0repeated calls
Scoped replayAdding one call does not invalidate unrelated completed effects.
Turn checkpointsAn interrupted agent continues from its last completed turn.
Replay-strict testsCI fails on the first call that would unexpectedly go live.
Your storageUse JSONL, SQLite, PostgreSQL, or a conforming custom store.

Production controls

The model call is one part of the run.

Rulvar keeps tools, permissions, durable approvals, telemetry, cost, and tests on the same execution path as model calls, so production behavior stays visible in code.

01

Tools and permissions.

Attach typed tools or MCP sources, enforce layered permissions, suspend for approval, and isolate execution.

02

Observability and cost.

Consume typed events, attribute usage by provider, model, role, phase, and profile, then export OpenTelemetry traces.

03

Testing and evals.

Use fake adapters, redacted VCR cassettes, replay-strict runs, graders, and model sweeps without live keys in CI.

Where Rulvar fits

Agent modes complete a task.
Rulvar runs a capability.

Claude Code, ChatGPT, and Codex are useful for supervised work inside their applications. Rulvar is for repeatable execution inside your service, where model routes, permissions, stores, budgets, tests, and operations belong to your code.

Capability Claude Code ultracode ChatGPT Ultra / Codex subagents Rulvar
Where it runs Claude Code session and workflow runtime ChatGPT Work mode or Codex client Your Node.js application and infrastructure
Workflow ownership A generated JavaScript workflow you can save and rerun The main agent coordinating subagent threads Human TypeScript, a frozen planner script, or a dynamic orchestrator
Model control The session model, with a smaller model available by stage Custom Codex agents can use different model configurations Per-invocation routing across Anthropic, OpenAI, local endpoints, gateways, AI SDK models, and custom adapters
Spend control Token visibility, agent caps, and advisory size guidance Usage limits; parallel agents consume additional tokens Immutable segment ceiling, bounded in-flight overshoot, sub-accounts, and typed cost reports
Recovery Completed agents are cached when resuming in the same session Agent threads and results remain visible in the product workflow Journaled effects resume across processes or machines from durable storage
Verification Inspect and rerun the generated workflow script Inspect subagent threads and configure specialist agents Fake adapters, VCR cassettes, replay-strict runs, matchers, and eval matrices

Comparison based on the public documentation for Claude Code dynamic workflows, OpenAI subagents, and Rulvar orchestration modes.

Explicit configuration

Register providers and route roles in code.

Register only the adapters you use, choose models by role or profile, attach durable stores, and start the run with a dollar ceiling.

workflow.mts
import {
  anthropic,
  createEngine,
  defineWorkflow,
  FileTranscriptStore,
  JsonlFileStore,
  openai,
} from '@rulvar/rulvar';
import { openaiCompatible } from '@rulvar/openai';

const engine = createEngine({
  adapters: [
    anthropic(),
    openai(),
    openaiCompatible({
      id: 'ollama',
      baseURL: 'http://127.0.0.1:11434/v1',
    }),
  ],
  defaults: {
    routing: {
      loop: 'openai:gpt-5.6-terra',
      extract: 'openai:gpt-5.6-luna',
      summarize: 'ollama:qwen3.8:27b',
      plan: 'openai:gpt-5.6-sol',
      orchestrate: 'anthropic:claude-fable-5',
    },
    profiles: {
      planner: { model: 'anthropic:claude-fable-5' },
      implementer: { model: 'openai:gpt-5.6-terra' },
      reviewer: { model: 'ollama:qwen3.8:27b' },
    },
  },
  stores: {
    journal: new JsonlFileStore({ dir: '.rulvar/journal' }),
    transcripts: new FileTranscriptStore({ dir: '.rulvar/transcripts' }),
  },
});

const shipFeature = defineWorkflow(
  { name: 'ship-feature' },
  async (ctx, goal: string) => {
    const plan = String(await ctx.agent(goal, { agentType: 'planner' }));
    const patch = String(await ctx.agent(plan, { agentType: 'implementer' }));
    return ctx.agent(patch, { agentType: 'reviewer' });
  },
);

const objective = 'Implement and review the requested feature';
const run = engine.run(shipFeature, objective, {
  budgetUsd: 5,
});

const outcome = await run.result;
console.log(outcome.status, outcome.cost.totalUsd);

Open source · Apache-2.0

Run agent workflows
as part of your application.

Rulvar is open-source TypeScript infrastructure for repeatable multi-model execution, with no required control plane and no provider lock-in.