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

@spendguard/openai-agents

v0.1.1

Published

OpenAI Agents SDK (TypeScript) adapter for SpendGuard budget guardrails — drop-in via `withSpendGuard(model, opts)` on any `@openai/agents` Model.

Readme

@spendguard/openai-agents

OpenAI Agents SDK (TypeScript) adapter for Agentic SpendGuard budget guardrails. Drop-in via withSpendGuard(model, opts) on any @openai/agents Model — pre-call budget reservation before the upstream provider HTTP call fires, post-call commit reconciles real token usage, signed audit trail.

Status

0.1.0-pre — SLICE 1 + SLICE 2 of D08 (OpenAI Agents TS adapter). Tracks docs/specs/coverage/D08_openai_agents_ts/. The first publishable release ships at SLICE 6 once the cross-language fixture (SLICE 3) and the end-to-end real-@openai/agents demo (SLICE 4-5) land.

Quickstart (preview)

import { Agent, Runner } from "@openai/agents";
import { OpenAIChatCompletionsModel } from "@openai/agents/openai";
import { withSpendGuard, runContext } from "@spendguard/openai-agents";
import { SpendGuardClient, newUuid7 } from "@spendguard/sdk";

const client = new SpendGuardClient({ socketPath: "/run/spendguard.sock", tenantId: "tenant-prod" });
await client.connect();
await client.handshake();

const inner = new OpenAIChatCompletionsModel({ model: "gpt-4o-mini" });
const guarded = withSpendGuard(inner, { client, tenantId: "tenant-prod" });

const agent = new Agent({ name: "demo", instructions: "Reply concisely.", model: guarded });

const runId = newUuid7();
await runContext({ runId }, () => Runner.run(agent, "Say hello in three words."));

What it does

For every getResponse(request) call the Agents Runner makes:

  1. PRE: client.reserve({ trigger: "LLM_CALL_PRE", ... }) with a deterministic (decisionId, llmCallId) derived from (input, systemInstructions). A non-CONTINUE substrate outcome — DENY, STOP, SKIP, APPROVAL — throws the typed @spendguard/sdk error AND the inner model is NEVER invoked.
  2. INNER: inner.getResponse(request) runs only on CONTINUE / DEGRADE. Request passed verbatim — DEGRADE mutation application is v0.2 scope.
  3. POST: client.commitEstimated({ outcome: "SUCCESS", ... }) with totalTokens from the inner response usage. Provider error → commit with outcome: "PROVIDER_ERROR" first, then re-throw.

Stream calls (getStreamedResponse) pass through unchanged at v0.1.x — per-chunk gating is tracked as POST_D08.

Type collision note

This package exports RunContext ({ readonly runId: string }) — the per-call SpendGuard context. @openai/agents also exports a class called RunContext (the per-run state the OpenAI Runner threads through tools). The two are DIFFERENT concepts. Consumers who import both should alias one of them:

import type { RunContext as SpendGuardRunContext } from "@spendguard/openai-agents";
import { RunContext } from "@openai/agents";

Anti-scope

Per docs/specs/coverage/D08_openai_agents_ts/design.md §3 (non-goals)

  • §10 (locked decisions):
  • Per-chunk stream gating — v0.2 follow-on.
  • DEGRADE mutation patch application — v0.2 follow-on.
  • Bundling @openai/agents — peer dep is intentional.
  • Browser support — UDS only.
  • OpenAIResponsesModel-specific features (mid-call adapters land in v0.2).

License

Apache-2.0. See LICENSE_NOTICES.md once SLICE 6 ships the third-party attribution list.