Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

TypeScript SDK

The TypeScript SDK is an HTTP client that wraps the Akshi HTTP API. Use it for external tooling, dashboards, and orchestration scripts.

Installation

npm install @akshi/sdk

Quick start

import { AkshiClient } from "@akshi/sdk";

const client = new AkshiClient({
  baseUrl: "http://127.0.0.1:3210",
  token: "my-token",
});

const health = await client.health();
console.log(health.ok ? "Healthy" : "Unhealthy");

Client methods

MethodHTTPReturnsDescription
health()GET /api/v1/healthHealthResponseRuntime health check
status()GET /api/v1/agentsAgentStatus[]All agent statuses
logs(since?)GET /api/v1/logsLogEntry[]Log entries, optionally filtered by ISO timestamp
findings(since?)GET /api/v1/findingsFindingRecord[]Findings, optionally filtered by ISO timestamp
postFindings(records)POST /api/v1/findingsvoidSubmit a batch of findings

FindingRecord

interface FindingRecord {
  agent: string;            // Agent name that produced the finding
  severity: "info" | "low" | "medium" | "high" | "critical";
  title: string;            // Short summary
  detail: string;           // Full description
  source?: string;          // Origin (e.g., file path or URL)
  timestamp?: string;       // ISO 8601; auto-set if omitted
}

Error handling

All methods throw AkshiApiError on non-2xx responses. The error exposes statusCode, error, and detail properties matching the API error format.

import { AkshiApiError } from "@akshi/sdk";

try {
  await client.postFindings(records);
} catch (e) {
  if (e instanceof AkshiApiError) {
    console.error(`${e.statusCode}: ${e.detail}`);
  }
}