New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

runtime-monitor-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runtime-monitor-sdk

TypeScript/JavaScript SDK for the AI Agent Runtime Monitor — cost guardrails, hallucination detection & audit trail

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
5
-50%
Maintainers
1
Weekly downloads
 
Created
Source

runtime-monitor-sdk

JavaScript / TypeScript SDK for Runtime Monitor — real-time cost guardrails, kill-switches, and hallucination detection for AI agents.

npm License: MIT

Install

npm install runtime-monitor-sdk

Quick start

import { AgentMonitor } from "runtime-monitor-sdk";

const monitor = new AgentMonitor({
  apiKey: "am_...",
  agentName: "my-agent",
  budgetLimitUsd: 1.00,
});

await monitor.start();

// Track individual LLM calls manually
monitor.track({
  model: "gpt-4o",
  inputTokens: 1200,
  outputTokens: 400,
});

await monitor.stop();

Auto-wrap OpenAI client

import OpenAI from "openai";
import { AgentMonitor } from "runtime-monitor-sdk";

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

const monitor = new AgentMonitor({
  apiKey: "am_...",
  agentName: "my-agent",
  budgetLimitUsd: 2.00,
});

await monitor.start();

// All calls through wrappedOpenAI are tracked automatically
const wrappedOpenAI = monitor.wrapOpenAI(openai);
const response = await wrappedOpenAI.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello" }],
});

await monitor.stop();

Kill-switch

monitor.onKillSwitch((reason) => {
  console.error("Budget exceeded:", reason);
  process.exit(1);
});

Run a function with automatic session lifecycle

const result = await monitor.run(async () => {
  // your agent logic here
  return "done";
});

API

new AgentMonitor(options)

OptionTypeRequiredDescription
apiKeystring✅Your Runtime Monitor API key (am_...)
agentNamestring✅Name displayed in the dashboard
budgetLimitUsdnumber—Hard budget cap; triggers kill-switch when exceeded
baseUrlstring—Override API URL (default: https://monitor.global-soft.ro)
metadataobject—Arbitrary key/value pairs attached to the session

Methods

MethodDescription
start()Create a new session on the server
stop()End the session and flush pending data
track(options)Record a single LLM call
run(fn)Start session → run fn → stop session, returns fn result
wrapOpenAI(client)Returns a proxy that auto-tracks every completion call
onKillSwitch(cb)Register callback invoked when the budget is exceeded

Python SDK

pip install agent-monitor

See the main repo README for full documentation.

License

MIT

Keywords

ai

FAQs

Package last updated on 05 May 2026

Related posts