jonaki

Installation

Install Jonaki, set one API key, and confirm it runs.

Requirements

  • Node.js 20 or newer
  • zod v4 — a required peer dependency
  • One API key: Anthropic, OpenAI, or Google

Install

npm install @rohhitrz/jonaki zod
pnpm add @rohhitrz/jonaki zod
yarn add @rohhitrz/jonaki zod

Set an API key

Jonaki picks a provider from whichever key it finds. You only need one.

export ANTHROPIC_API_KEY=sk-ant-...
# or
export OPENAI_API_KEY=sk-proj-...
# or
export GOOGLE_API_KEY=AIza...

Or put them in a .env file and let Node load it:

node --env-file=.env agent.js

Scaffold a project

The fastest path. This writes a working agent, an .env.example, a replay test stub, and AGENTS.md:

npx @rohhitrz/jonaki init

It prompts for an agent name, a provider, and whether to include the test setup, then prints the exact commands to run next. To skip the prompts:

npx @rohhitrz/jonaki init --name Assistant --provider anthropic --tests --yes

ESM only

Jonaki is an ES module. jonaki init sets "type": "module" in your package.json for you, because npm init -y omits it and the scaffold would otherwise fail on its first run.

Verify

Create hello.ts:

hello.ts
import { Agent, run } from "@rohhitrz/jonaki";

const result = await run(new Agent({ name: "Assistant" }), "Say hello.");
console.log(result.output);

Run it:

npx tsx --env-file=.env hello.ts

Optional: SQLite persistence

SQLiteStore needs a native module, kept as an optional peer dependency so the base install stays free of native builds:

npm install better-sqlite3

Skip it if you use MemoryStore or FileStore. If you call createSQLiteStore() without it, Jonaki throws a STORE_ERROR naming the install command.

TypeScript

Jonaki ships its own types — no @types package needed. It works with both ESM and CJS consumers, though the examples throughout these docs assume ESM.

tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true
  }
}

On this page