Docs

Agent Installation

The CartNerve Agent is a zero-latency telemetry bridge that allows HealBot to observe and repair your runtime environment safely.

01. Installation

Our agent is distributed via npm (Node/Bun/Deno) and cargo (Rust). Use your preferred package manager to get started.

npm install @cartnerve/agent

02. Initialization

Initialize the agent as early as possible in your application lifecycle. This ensures all downstream requests are correctly instrumented.

import { CartNerve } from '@cartnerve/agent';

const cn = new CartNerve({
  projectId: process.env.CARTNERVE_PROJECT_ID,
  apiKey: process.env.CARTNERVE_API_KEY,
  // Optional: strictly scope what HealBot can do
  permissions: ['service:restart', 'cache:flush']
});

cn.init();

Security: The Permission Whitelist

By default, the agent is in **read-only** mode. To enable HealBot autonomous remediation, you must explicitly pass a permissions array. HealBot will never attempt an action not present in this list.

03. Observability Hooks

While our express middleware handles most things automatically, you can manually track pulses for background jobs, worker threads, or custom business logic.

// Automatic Express/Koa middleware
app.use(cn.middleware());

// Manual pulse tracking
cn.pulse('payment-processing', { 
  latency: 120, 
  status: 'success' 
});