Examples
Six runnable projects, from hello world to an offline replay test.
Every example lives in examples/
and runs against a real model. Clone the repo, add one API key, and go:
git clone https://github.com/rohhitrz/jonaki.git
cd jonaki
pnpm install
cp .env.example .env # add one key
pnpm build01 · Hello
One agent, one tool. The shape of every Jonaki program.
pnpm exampleThe weather in Guwahati is currently 22°C with clear skies.
[2 turns · 1334 in / 79 out · $0.0052]02 · Memory
A CLI chat that remembers across process restarts, backed by SQLite.
pnpm example:memory
pnpm example:memory -- --session work # separate conversations
pnpm example:memory -- --history # print the transcriptQuit with /exit, start it again, and ask what your name is — it still knows,
because the session outlived the run that created it.
jonaki chat — session "default"
Resuming with 2 remembered messages.
you What's my name?
bot Your name is Rohit.03 · Handoff
A triage agent that routes to a billing or technical specialist, with a context filter on one of them.
pnpm example:handoffuser I was charged twice for invoice INV-1190. What happened?
↪ handoff triage → billing (Customer reports a duplicate charge)
🔧 tool lookup_invoice [ok]
agent(billing) Invoice INV-1190 for $420.00 is marked as a duplicate of
INV-1189. This needs to be refunded.
[3 turns · depth 1 · $0.0112]04 · Guardrails
PII redaction plus a refund that needs a human.
pnpm example:guardrailsuser (raw) Hi, I'm rohit@example.com, card 4111 1111 1111 1111...
model saw Hi, I'm [REDACTED_EMAIL], card [REDACTED_CREDITCARD]...
PII in state? none — the raw values never entered the transcript
status awaiting_approval
waiting on issue_refund({"amountUSD":850,"reason":"Service was down"})The second run pauses and returns. The process could exit there.
05 · Structured
Typed extraction from a deliberately messy email — including a self-correction the writer made mid-sentence.
pnpm example:structuredorder A-7741
customer Priya Raghunathan <priya.r@northwind.co>
total $184.97
sentiment angry
escalate yes
items 3
2 × WL-220 walnut desk lamp
1 × CT-09 cable tidy kit
3 × CS-114 felt coasters06 · Replay
The differentiator. A recorded booking run, replayed offline as a vitest suite.
pnpm example:replayNo API key required. The recording is committed to the repo:
✓ replays a recorded run without touching the network
✓ really executes the tools — they are not replayed
✓ searches the route the user asked for
✓ books the cheaper of the two flights
✓ surfaces a tool that now throws
✓ throws REPLAY_DIVERGED when a tool is deletedTo record your own:
pnpm --filter @jonaki/example-06-replay record # needs a key
pnpm --filter @jonaki/example-06-replay test # needs nothingOr from the CLI:
npx jonaki test runs/runs --agent ./agent.tsStarting your own
mkdir my-agent && cd my-agent
npm init -y
npm install @rohhitrz/jonaki zod tsx
npx @rohhitrz/jonaki initThat scaffolds agent.ts, .env.example, jonaki.test.ts, and AGENTS.md —
a machine-readable API spec that helps Claude Code or Cursor write correct
Jonaki code on the first try.