API reference

Get started with Jevia

View .md

Route tasks, inspect run records, and report verified outcomes from Node.js while keeping Jevia's local policy, storage, and learning behavior in one place.

01

Install

Add the package after installing the Jevia CLI.

Install the Node.js API
npm install jevia
CLI prerequisite

The package uses the local jevia executable and never runs an installer during npm install. Use the landing-page guide to install and configure it.

02

Create a client and route

The client resolves the project config from the working directory.

Quickstart
import { JeviaClient } from "jevia";
const jevia = new JeviaClient({ cwd: process.cwd() });const route = await jevia.route("fix the flaky integration test");
console.log(route.tier, route.confidence, route.run_id);

A route returns the selected tier, confidence, probabilities, cache source, and a traceable run ID. Routing chooses capability; it does not claim the task succeeded.

03

Client methods

A small API over Jevia's machine-readable CLI contract.

version(options?)

Return the installed Jevia CLI version after validating its output.

route(task, options?)

Choose a capability tier and return the complete typed route record.

feedback(runId, outcome, options?)

Record an explicit success, failure, or unknown outcome for a run.

runs(options?)

List recent route records with a configurable positive result limit.

show(runId, options?)

Read one complete route record, including lifecycle and outcome evidence.

04

Open any harness

Map Jevia's tier to the model names your chosen harness accepts.

Harness adapter
const models: Record<string, string> = {  fast: "provider/small",  balanced: "provider/standard",  strong: "provider/frontier",};
const result = await runYourHarness({  task,  model: models[route.tier],  runId: route.run_id,});
const verified = await verifyResult(result);await jevia.feedback(  route.run_id,  verified ? "success" : "failure",);

Your adapter can call Codex, Claude Code, OpenCode, Gemini CLI, Cursor Agent, Copilot CLI, Aider, Goose, Amp, or a custom runner. Submit feedback only after your verifier determines the actual outcome.

05

Cancellation and errors

Bound each CLI call and keep process failures inspectable.

Error handling
import { JeviaClient, JeviaCommandError } from "jevia";
try {  await jevia.route(task, { signal: controller.signal });} catch (error) {  if (error instanceof JeviaCommandError) {    console.error(error.exitCode, error.stderr);  }}
Structured failures

JeviaCommandError includes the exit code, signal, stdout, and stderr. Invalid JSON or records raise JeviaProtocolError.