Skip to main content
Five minutes from zero to a typed workflow result inside your own app: install the package, save one file, run it, read the outputs. Requires Node.js 22+ on macOS or Linux (arm64/x64). No server, no global CLI, no provider key — this example runs on the package’s bundled engine and the mock provider.

1. Install in your application

Pin the published package. Keep optional dependencies enabled: they provide the native payload for your supported platform (macOS and Linux, arm64 and x64 — there is no Windows payload). An explicit bin or NIKA_BIN overrides that payload; omit both for this first run. The local client explains binary resolution and compatibility errors.

2. Save a workflow

Create hello.nika in the application directory:
mock/echo is a local simulation: the engine echoes the prompt back (prefixed mock(echo) ·) and calls no network LLM. It is a rehearsal for the mechanics, not intelligence. Choosing a mock model for an arbitrary workflow does not disable that workflow’s tools or permissions. A project nika.yaml is optional for this example; the executable source is hello.nika.

3. Run it

Save demo.mjs next to the workflow:
Expected output — the mock prefixes its rehearsal answer:
That is the whole first loop: one file, one call, one typed result. Challenge: change the prompt in hello.nika and rerun — the echo follows the file, no other change needed.

Then: audit, watch, verify

The same lifecycle opens three deeper doors when you need them. Events need a live run — the first one already settled, so start a fresh one:
On the published package the event stream reads run.started → task.scheduled → task.started → task.completed → engine.event (the engine’s own workflow_completed frame) → run.settled (succeeded) — six events for this one-task workflow. run.events() yields SDK lifecycle kinds such as task.started; the engine protocol frame lives on event.raw. Passing inputs from code is literal: nika.run('greet.nika', { inputs: { name: 'Ada', limit: 2 } }) binds typed values. A string '2' for an integer input is refused with NikaOperationError (input_type_mismatch), an unknown key with unknown_input, and a missing required input with NIKA-1708 — the type contract is enforced at the door.

4. Read the proof’s scope

Pass an engine-issued receipt to traceVerify(receipt) unchanged. Verification reads the journal the run already wrote — it does not re-execute the workflow, and it does not re-infer a model answer. Two outcomes are separate: One inspected case to know: this mock fixture on a keyless machine (a fresh HOME with no run-signing key) produced an intact but unsealed journal, where traceVerify returned verified: false with reason receipt_mismatch while the run itself succeeded — a missing signature, not a failed workflow and not corruption. Do not generalize one fixture’s outcome to every install: read the returned reason and details. A trace does not prove that an external recipient read a message or that a business goal was achieved — verification is tamper-evidence, not a correctness guarantee.

Next

Project setup

Add project policy and organize workflows when your application needs them.

Local client

Understand payload selection and the local transport.

Run lifecycle

Separate observation, terminal settlement and cancellation.

Remote client

Select authenticated HTTP with the same facade.