The governed AI workflow runtime

AI workflows
that follow your rules.

Author in TypeScript or Python, declare decisions with expression IR, and run it on the Rust runtime for production-scale execution, policy enforcement, and trace evidence.

Code-first SDK trackPolicy controlsExpression systemHuman approval gatesTraceable runsBuilt in Rust
import { expr, workflow } from "rustyflows";
import { pricing } from "./pricing-rules";

const ctx = expr.context();
const approvedPct = ctx.approval.approvedPct.or(ctx.quote_decision.proposedPct);
const finalTotal = ctx.price.listTotalCents.discount(approvedPct);
const emailPayload = expr.object({
  to: ctx.input.customerEmail,
  cc: ctx.input.salesRep.or(ctx.approval.approver),
  subject: ctx.crm.quoteId.format("Quote % is ready"),
  body: ctx.reply.message,
  quoteId: ctx.crm.quoteId,
  quote: ctx.final_quote,
});

export const quoteAndBuy = workflow("quote-and-buy")
  .input({
    customerMessage: "string",
    customerEmail: "string",
    salesRep: "string",
  })
  .policy({
    maxRunCostUsd: 2,
    allowedModelProviders: ["anthropic"],
  })

  // Model extracts intent — schema-checked, nothing else gets through
  .generate("request", {
    agent: "product-advisor",
    prompt: "What does the customer need? {{input.customerMessage}}",
    output: { productNeed: "string", units: "number", requestedPct: "number" },
  })

  // Tool params are expression objects, not TypeScript callbacks
  .tool("catalog", {
    toolId: "catalog.search",
    params: expr.object({ query: ctx.request.productNeed }),
    output: { sku: "string", title: "string", unitPriceCents: "number" },
  })
  .tool("price", {
    toolId: "catalog.price",
    params: expr.object({
      sku: ctx.catalog.sku,
      units: ctx.request.units,
    }),
    output: { listTotalCents: "number", currency: "string" },
  })

  // Pricing writes ctx.quote_decision through the same expression IR
  .ruleset("quote_decision", pricing)

  // Gate condition and display fields are Rust-evaluated expressions
  .gate("approval", {
    type: "approval",
    when: ctx.quote_decision.decision.eq("needs_sales_approval"),
    show: expr.object({
      sku: ctx.catalog.sku,
      title: ctx.catalog.title,
      requestedPct: ctx.request.requestedPct,
      proposedPct: ctx.quote_decision.proposedPct,
      proposedTotalCents: ctx.price.listTotalCents.discount(ctx.quote_decision.proposedPct),
      reasons: ctx.quote_decision.reasons,
    }),
    output: { approved: "boolean", approvedPct: "number", approver: "string", note: "string" },
  })

  .map("final_quote", expr.object({
    sku: ctx.catalog.sku,
    title: ctx.catalog.title,
    finalDiscountPct: approvedPct,
    finalTotalCents: finalTotal,
    reasons: ctx.quote_decision.reasons,
  }))
  .tool("crm", {
    toolId: "crm.create-quote",
    params: ctx.final_quote,
    output: { quoteId: "string" },
  })
  .generate("reply", {
    agent: "sales-assistant",
    prompt: "Present quote {{crm.quoteId}}: {{final_quote}}. Why: {{quote_decision.reasons}}",
    output: { message: "string" },
  })
  .tool("send_email", {
    toolId: "email.send-quote",
    params: emailPayload,
    output: { status: '"sent" | "queued"' },
  });
run trace system Retail Productiondatabase Customer Supabase (BYO)auth Platformprovider Anthropicpolicy run budget $2.00

run 7a2e44 · quote-and-buy@v3.0.1 · production

input.customerMessage = "Need 60 PRO-450 units — can you do 22% off?"
request.units = 60 · requestedPct = 22 model output · schema-checked
catalog.sku = "PRO-450" · "Pro Support Pack" catalog.search
price.listTotalCents = 1_840_020 authoritative list price
quote_decision.decision = "needs_sales_approval" expression rules · over authority
approval.approvedPct = 18 approved by mia@sales · note captured
final_quote.finalTotalCents = 1_508_816 expression math · approval wins
crm.quoteId = "Q-10482" crm.create-quote · decision context included
reply.message → customer schema-checked LLM output
send_email.payload = to buyer@acme.example · cc mia@sales tool contract checked
send_email.status = "sent" handoff recorded in trace
expression IR captured · TS and Python authoring, Rust validation and runtime evaluation

Works with

OpenAIAnthropicGoogle GeminiFireworksAzure OpenAIVertex AI

Who it helps

Enterprise-level maturity, without enterprise-only adoption

RustyFlows is for teams that need to build serious AI and automation solutions quickly without owning every piece of the governance stack themselves.

mature from day one

Startups and product teams

Build production-ready AI workflows without spending the first months stitching together orchestration, policy, gates, traces, and deployment plumbing.

govern at scale

Scale-ups and enterprises

Bring governance, audit evidence, rollback, cost visibility, and BYO controls to automation that is moving from experiments into production.

deliver reusable IP

Consultancies and partners

Package repeatable AI and automation solutions for clients, then hand over governed workflows they can inspect, operate, and extend.

move faster safely

Operations teams

Prototype quote, approval, invoice, support, onboarding, and internal workflows quickly while keeping human gates where judgment matters.

From code to proof

One lifecycle for every workflow, from first draft to audited production run.

01

Author

Build with TypeScript or Python SDKs while targeting the same governed runtime package.

02

Validate

The validation layer is being built for cargo-style diagnostics before workflows reach runtime.

03

Govern

Attach policy controls and expression-based rules for conditions, math, routing, and approvals.

04

Deploy

Move toward versioned workflow packages per environment, with snapshots and rollback.

05

Prove

Each run should leave an inspectable trace of step outputs, model calls, usage, and decisions.

Cargo-style validation. Release-minded deploys.

The CLI path is being designed around structured diagnostics, policy checks, and reversible workflow packages.

$ rustyflows validate ./workflows/quote-and-buy

error[RF0412]: step `final_quote` references unknown output `approval.approvedPtc`
  --> quote-and-buy.ts:51:36
   = help: did you mean `approval.approvedPct`?

warning[RF0207]: rule `cap-small-orders` is unreachable
  --> pricing-rules.ts:31
   = note: shadowed by `needs-sales-approval` (priority 10)

error: validation failed · 1 error, 1 warning · 312ms

Visual Prototyping

Prototype the package, run it with proof

Quote-and-Buy - buyer input, expression rules, approval, generated reply, and email handoff in one trace.

Usage telemetry

Every run carries a cost signal

Trace spans, provider usage, and configured meter rates produce a pricing preview. Provider spend stays visible as managed LLM pass-through; platform estimates come from execution, storage, and DB meters before customer billing is enabled.

7d preview / v6 usage model
Estimated charge

$16.17

$2.11 platform / $14.06 LLM pass-through

Runs

1,284

284 billable after allowance

p95 latency

842ms

end-to-end

CPU time

18.4s

observed local runtime

Peak memory

420KB

observed peak

Trace writes

4.8MB

retained run data

Cost trend

Daily charge estimate with p95 latency context

usage events + provider cost
Mon: $1.72, p95 790ms$1.72MonTue: $1.88, p95 811ms$1.88TueWed: $2.05, p95 828ms$2.05WedThu: $1.94, p95 806ms$1.94ThuFri: $2.67, p95 842ms$2.67FriSat: $2.81, p95 836ms$2.81SatSun: $3.10, p95 858ms$3.10Sun
p95 790ms
p95 811ms
p95 828ms
p95 806ms
p95 842ms
p95 836ms
p95 858ms

Cost breakdown

Preview rates applied to usage rollups

$16.17

Managed LLM pass-through

provider cost x 1.2

$14.06

Billable executions

284 overage execs at $0.005

$1.42

Storage + DB allocation

$3/project/mo prorated

$0.69

Provider usage

3.2M tokens $14.06 pass-through

Billable execs

284 $1.42

CPU time

18.4s observed

Peak memory

420KB observed

Trace writes

4.8MB storage meter

Success

99.2% tracked
Trace spans Provider usage Usage events Configured rates Spend controls pricing rules remain configurable

Pricing model

preview shape, not external billing

Hosted usage

Executions, storage, and DB allocation are metered with preview rates.

LLM pass-through

Managed provider spend is shown separately from platform revenue.

BYO controls

Customer keys and infrastructure avoid double-charging provider or storage spend.

Enterprise base

Governance, support, audit, and self-hosted licensing can sit above usage.

Pilot motion

Prototype in days, then harden before production

A good first RustyFlows pilot should prove the workflow, the governance model, and the operating economics before anyone commits to a larger rollout.

01

Bring one workflow

Pick a quote, approval, triage, invoice, or handoff flow where policy and traceability matter.

02

Prototype visually

Map the steps, inputs, tools, gates, and handoff points before committing to the package shape.

03

Harden with SDK/CLI

Move the prototype into TypeScript or Python authoring with expression rules and Rust validation.

04

Run with evidence

Inspect traces, approvals, usage, and cost previews so stakeholders can evaluate the workflow.

Pilot output

A rollout decision, not just a demo

The goal is to leave the pilot with enough proof to decide whether the workflow belongs on hosted RustyFlows, customer infrastructure, or a later self-hosted runtime path.

Versioned workflow package
Policy and rule checkpoints
Trace and approval evidence
Cost and usage preview
Hosted, BYO, or self-hosted path
Plan a Pilot

Built for production governance

The runtime and control plane underneath the lifecycle.

Policy Controls

Spend caps, approved models, data boundaries, and regional constraints designed to be checked before and during execution.

Expression System

Declare paths, predicates, math, coalescing, and rule effects as expression IR that Rust can validate, trace, and evaluate.

Versioned Deployments

The package model is being shaped for environment-specific versions, deployment snapshots, diffs, and rollback.

Traceable Runs

Run traces capture step outputs, model calls, usage, and policy decisions so teams can inspect what happened.

Code-First SDKs

TypeScript and Python authoring compile to the same governed package, so workflows can be reviewed like code without moving logic out of the runtime.

Visual Prototyping

The canvas renders any package for rapid prototyping, demos, and step-by-step debugging of governed runs.

Human-in-the-Loop

Approval gates, input collection, and decision points. Keep humans in control of critical steps.

MCP & Webhooks

Expose workflows as MCP tools, or trigger them from GitHub, Stripe, Slack, and the REST API.

Rust Core

Bring Rust performance, concurrency, and scaling to TypeScript and Python-authored workflows through one runtime.

For the workflows you have to get right

Candidate launch examples for the governed SDK and CLI path.

Quote-and-Buy

Price, review, and approve quotes with discount caps and spend policies enforced at runtime — not in a code review.

early-access example

Invoice Approval

Route invoices through rule-driven approval chains, with human gates above thresholds and a trace of every decision.

workflow package pattern

Support Triage

Classify, route, investigate, and respond — with policy-bound model usage and a full decision trail per ticket.

runtime trace pattern

Ship AI you can stand behind.

Request early access to the governed runtime, or bring one workflow and plan a focused pilot around it.

Browse the current docs and SDK notes