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

@relayplane/policy-engine

v0.1.0

Published

Policy Engine - governance controls and budget management for agent operations

Readme

@relayplane/policy-engine

Policy Engine for RelayPlane Agent Ops - governance controls and budget management.

Features

  • Policy Evaluation — Evaluate policies with deterministic priority ordering
  • Budget Tracking — Spend aggregation (per-run, per-day, per-agent, per-workspace)
  • Model/Provider Restrictions — Allowlist/denylist matching with scope cascade
  • Policy Composition — Workspace → Team → Project → Agent hierarchy
  • Ledger Integration — All policy decisions recorded with full rationale

Installation

pnpm add @relayplane/policy-engine

Quick Start

import { createPolicyEngine, MemoryPolicyStorage } from '@relayplane/policy-engine';
import { createLedger } from '@relayplane/ledger';

// Create storage and ledger
const storage = new MemoryPolicyStorage();
const ledger = createLedger();

// Create policy engine
const engine = createPolicyEngine({ storage, ledger });

// Create a budget policy
await engine.createPolicy({
  workspace_id: 'ws_123',
  name: 'Daily budget limit',
  description: 'Limit daily spending to $10',
  type: 'budget.per_day',
  enabled: true,
  priority: 100,
  scope: { applies_to: 'workspace' },
  conditions: [],
  action: {
    type: 'cap',
    parameters: { limit_usd: 10, enforce: false }
  }
});

// Evaluate request against policies
const decision = await engine.evaluate({
  workspace_id: 'ws_123',
  agent_id: 'agent_123',
  request: {
    model: 'claude-3-5-sonnet',
    provider: 'anthropic',
    estimated_cost_usd: 0.05
  }
});

if (decision.allow) {
  console.log('Request allowed');
} else {
  console.log('Request denied:', decision.reason);
}

Policy Types

| Type | Description | |------|-------------| | budget.per_run | Limit cost per individual run | | budget.per_day | Limit daily spending | | budget.per_agent | Limit spending per agent | | budget.per_workspace | Limit workspace-wide spending | | model.allowlist | Only allow specific models | | model.denylist | Block specific models | | provider.allowlist | Only allow specific providers | | provider.denylist | Block specific providers | | tool.allowlist | Only allow specific tools | | tool.denylist | Block specific tools | | context.cap | Limit context window size | | retry.limit | Limit retry attempts | | rate.limit | Limit requests per time period | | approval.gate | Require human approval |

Policy Actions

| Action | Description | |--------|-------------| | allow | Explicitly allow the request | | deny | Block the request | | warn | Allow with warning | | cap | Modify request to fit limits | | downgrade | Switch to cheaper model | | require_approval | Pause for human approval |

Condition Operators

| Operator | Description | |----------|-------------| | eq | Equal to | | neq | Not equal to | | gt | Greater than | | gte | Greater than or equal | | lt | Less than | | lte | Less than or equal | | in | Value in list | | not_in | Value not in list | | matches | Regex match |

Budget Tracking

The Policy Engine tracks spending at multiple granularities:

// Get current budget state
const state = await engine.getBudgetState('ws_123', 'day');
console.log(`Spent: $${state.spent_usd} / $${state.limit_usd}`);
console.log(`Remaining: $${state.remaining_usd}`);

// Get spend by agent
const agentSpend = await engine.getAgentSpend('ws_123', 'agent_123', {
  from: '2026-02-01',
  to: '2026-02-06'
});

API Reference

See the TypeScript declarations for full API documentation.

License

MIT