npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

yantrix

v1.0.0

Published

JavaScript/TypeScript SDK for Yantrix agent infrastructure — policy enforcement, semantic memory, and audit traces

Downloads

37

Readme

yantrix

JavaScript/TypeScript SDK for Yantrix agent infrastructure.

Policy enforcement · Semantic memory · Full audit traces — for any JS/TS agent runtime.

npm install yantrix

Quick start

import { configure, run } from "yantrix";

configure({ apiKey: process.env.YANTRIX_API_KEY! });

const result = await run({ intent: "research competitor pricing" });
console.log(result.traceId);     // ytx_run_0ba9b36a
console.log(result.status);      // "completed" | "policy_denied"
console.log(result.totalCostUsd); // 0.156

Client API

import { Yantrix } from "yantrix";

const ytx = new Yantrix({
  apiKey: "ytx_...",
  agentId: "my_agent",
  budgetUsd: 5.0,         // daily cap
  fallbackOnError: true,  // proceed if Yantrix unreachable
});

// Run an intent
const result = await ytx.run({ intent: "summarize latest AI news" });

// Policy check only (no execution)
const policy = await ytx.evaluatePolicy({ action: "send_email", estimatedCostUsd: 0.01 });
if (policy.decision === "deny") throw new Error(policy.reason);

// Memory
await ytx.remember({ key: "research_001", content: "OpenAI cut prices 50%" });
const memories = await ytx.recall({ query: "OpenAI pricing", topK: 3 });
await ytx.forget("research_001");

// Traces
const trace = await ytx.getTrace("ytx_run_0ba9b36a");
const recent = await ytx.listTraces(10);

// Budget
await ytx.setBudget(10.0);
const { today, remaining, limit } = await ytx.getSpend();

LangChain.js

import { wrapTools, YantrixCallbackHandler } from "yantrix/langchain";
import { TavilySearchResults } from "@langchain/community/tools/tavily_search";

// Option 1: wrap tools (full governance)
const tools = wrapTools(
  [new TavilySearchResults()],
  { apiKey: "ytx_...", agentId: "langchain_agent" }
);

// Option 2: callback handler (observability only)
const handler = new YantrixCallbackHandler({ apiKey: "ytx_..." });
const agent = await createReactAgent({ tools, llm, callbacks: [handler] });

Vercel AI SDK

import { wrapTools, yantrixMiddleware } from "yantrix/vercel-ai";
import { generateText, wrapLanguageModel } from "ai";
import { openai } from "@ai-sdk/openai";

// Option 1: wrap tools
const tools = wrapTools(myTools, { apiKey: "ytx_...", agentId: "vercel_agent" });
const { text } = await generateText({ model: openai("gpt-4o"), tools, prompt });

// Option 2: model middleware (intercepts all LLM calls)
const model = wrapLanguageModel({
  model: openai("gpt-4o"),
  middleware: yantrixMiddleware({ apiKey: "ytx_..." }),
});

What happens on every call

Your agent action
      ↓
Policy Engine  — is this allowed? within budget?
      ↓ allow
Semantic Memory — inject relevant past context
      ↓
Execution       — your tool/task runs normally
      ↓
Trace stored    — full audit log
      ↓
Result returned

Full trace visible at trace.yantrix.ai.


Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | — | Your Yantrix API key (ytx_...) | | agentId | string | "js_agent" | Agent identifier for scoping | | budgetUsd | number | 0 | Daily spend cap in USD | | timeout | number | 30000 | Request timeout in ms | | fallbackOnError | boolean | true | Proceed if Yantrix unreachable | | baseUrl | string | https://runtime.yantrix.ai | Override base URL |

Environment variable: YANTRIX_API_KEY (used by global configure() if no key passed).


Links