Skip to main content
examples/ is meant as a learning path — run npm run <script> from the examples/ directory for any of the ten, per examples/package.json and examples/README.md. Each example has its own README.md with a Goal, Learn, and Run section.
Only three of the ten examples have implemented run.ts bodies. examples/04-trust-record, 05-verification, 06-replay, 07-human-approval, 08-vendor-payment, 09-expense-approval, and 10-purchase-order currently contain nothing but a single console.log("Parmana Example NN - <Title>") line — no execution, no API calls, no output beyond that string. Their sibling fixture files (e.g. 08-vendor-payment/policy.json, 08-vendor-payment/transaction.json) are also empty. Only 01-hello-world, 02-policy-evaluation, and 03-runtime-execution run real code. Treat the “Learn” sections in the still-stubbed examples’ READMEs as stated intent, not as a description of what running them today shows you.

Walkthroughs

01 — Hello World

Goal (per its README): create the smallest valid BusinessTransaction. run.ts builds a plain object inline and prints it — it never calls a policy engine, the runtime, or the API:
const transaction = {
  businessTransactionId: "txn-001",
  metadata: { executionMode: "SYNC" },
  authority: { authorityId: "authority-1" },
  authorization: { authorizationId: "authz-1" },
  intent: { intentId: "intent-1", action: "vendor-payment" },
  policy: { name: "vendor-payment", version: "1.0.0" },
  signals: { amount: 2500, riskScore: 15 },
  status: BusinessTransactionStatus.RECEIVED,
  createdAt: new Date(),
};
Run with npm run hello. See examples/01-hello-world/README.md and run.ts. As Guides → Basic Execution notes, this object is missing several fields the canonical BusinessTransaction type requires (authority.authorityType, intent.target, etc.) — it’s illustrative, not a template.

02 — Policy Evaluation

Constructs a PolicyEngine and calls evaluate() directly against an inline policy and signals object. Run with npm run policy. See examples/02-policy-evaluation/README.md and run.ts.
This example’s policy rules use string conditions ("riskScore <= 50") and string actions ("approve"). The real PolicyCondition type (Packages → policy) is a structured object ({ signal, greater_than, equals, all, any }), and PolicyEngine.evaluateCondition() only reads condition.signal — a plain string condition never matches. Running this example produces REJECT / "no_rule_matched" for both rules regardless of the riskScore value, not the approve/reject split the example’s own naming implies. This looks like a bug in the example, not a demonstration of intended behavior — see Packages → policy for the condition shape that actually works.

03 — Runtime Execution

Constructs a RuntimeEngine directly with an empty RuntimePipeline([]) and calls runtime.execute(transaction as any), printing the result. Run with npm run runtime. See examples/03-runtime-execution/README.md and run.ts. This exercises the lower-level RuntimeEngine API from runtime with zero pipeline stages configured — not the ExecutionTrustApplication/RuntimeFactory path that POST /execute actually uses.

08 — Vendor Payment

Per its README, the intended goal is “Complete vendor payment workflow,” covering BusinessTransaction, Runtime, Verification, and Replay together — the closest thing in this directory to an end-to-end scenario. In this snapshot, though, run.ts is one of the unimplemented stubs (console.log("Parmana Example 08 - Vendor Payment")), and its policy.json/transaction.json fixture files are empty. There’s a real vendor-payment policy shipped at the monorepo root (policies/vendor-payment/1.0.0/policy.json and 2.0.0/), used throughout REST API and Guides examples in this documentation — but the 08-vendor-payment example directory itself doesn’t yet wire it into a runnable script. See examples/08-vendor-payment/README.md.

The rest

04 — Execution Trust Record

Goal: generate an ExecutionTrustRecord. Learn: Trust Record, Evidence, Receipt. Run: npm run trust-record. Stub — see warning above.

05 — Verification

Goal: verify an ExecutionTrustRecord. Learn: VerificationService, Verification. Run: npm run verification. Stub.

06 — Replay

Goal: replay a recorded decision deterministically. Learn: ReplayEngine, Determinism, Policy Replay. Run: npm run replay. Stub.

07 — Human Approval

Goal: demonstrate human-in-the-loop approval. Learn: Override, Human Approval. Run: npm run human-approval. Stub — see Guides → Human Override for why there’s no reachable code path for this yet regardless.

09 — Expense Approval

Goal: an approval workflow example (no Learn section in its README). Run: npm run expense-approval. Stub.

10 — Purchase Order

Goal: a purchase order execution workflow (no Learn section in its README). Run: npm run purchase-order. Stub.

Basic Execution

The real path examples 01 and 03 partially illustrate.

policy package

The condition schema example 02 gets wrong.

Human Override

Why example 07 can’t demonstrate its stated goal today even if implemented.

Getting Started

A working path independent of these examples.