JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 202
  • Score
    100M100P100Q72888F
  • License MIT

Runtime policy layer for LLM applications — enforce cost, privacy, and runtime guardrails on every model call

Package Exports

  • @loret/sdk
  • @loret/sdk/providers/anthropic
  • @loret/sdk/providers/custom
  • @loret/sdk/providers/openai
  • @loret/sdk/testing

Readme

@loret/sdk

The runtime reliability layer for AI agents.

Stops repeated tool-call loops, prevents silent task failure, and runs in-process with near-zero latency.

See the full documentation and examples.

Quick Start

npm install @loret/sdk
import { loret } from "@loret/sdk";

const session = loret();
const safeCheck = session.guard(checkHealth);

const result = await safeCheck("payments-api");
session.reset(); // clear loop state at end of run

For LangChain or Vercel AI SDK, see @loret/langchain and @loret/vercel.

Advanced Configuration

const session = loret({
  classAConsecutive: 3,    // identical calls before block (default: 3)
  classBSuspicion: 4,      // failures before block (default: 4)
  classBToolWindow: 6,     // per-tool sliding window (default: 6)
  classBDistinctArgs: 2,   // min distinct args for Class B (default: 2)
  windowSize: 12,          // global sliding window (default: 12)
  verbose: true,           // console output (default: true)
  onBlocked: (toolName, reason) => {},
  onHardStop: (toolName, reason) => {},
});

Example: detecting a loop

import { loret } from "@loret/sdk";

const session = loret({ verbose: false });

const safeTool = session.guard("searchWeb", async (query: string) => {
  return []; // simulate empty results
});

const result = await safeTool("failing query");
session.reset();

License

MIT