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

@runtime-judgement/openai-agents

v0.1.0

Published

OpenAI Agents SDK → Runtime Judgement bridge — register a trace processor that auto-captures every agent run and sends it for failure attribution.

Downloads

86

Readme

@runtime-judgement/openai-agents

OpenAI Agents SDK bridge for Runtime Judgement — register one trace processor and every agent run is automatically captured for failure attribution.

Installation

npm install @runtime-judgement/openai-agents
# or
pnpm add @runtime-judgement/openai-agents

Requires OpenAI SDK v4+ (openai >= 4.0.0).

Quick start

npm install @runtime-judgement/openai-agents
import { rjInit } from "@runtime-judgement/openai-agents"

// At app startup — one line to enable automatic trace attribution
rjInit({ apiKey: process.env.RJ_API_KEY })

Set RJ_API_KEY=rj_live_... (get your key from https://runtime-judgement.app/app/settings/api-keys).

Every agent run is now automatically ingested. Failures surface in your failure clusters within ~30 seconds.


Pattern 1 — Trace processor (recommended)

Register once at app startup. Every agent run is captured automatically.

import { RJTraceProcessor } from "@runtime-judgement/openai-agents"
import { registerTraceProcessor } from "openai/agents"   // or @openai/agents

registerTraceProcessor(new RJTraceProcessor({
  apiKey: process.env.RJ_API_KEY,   // Required: your RJ API key
  suiteId: "production-suite",      // Optional: tag all traces to a snapshot suite
}))

Your agent code is unchanged — the processor hooks into the OpenAI Agents SDK tracing pipeline automatically.

Pattern 2 — Manual span (fallback)

For any OpenAI call that doesn't go through the Agents SDK pipeline:

import { rjSpan } from "@runtime-judgement/openai-agents"

const response = await rjSpan("product-search", async () => {
  return await openai.chat.completions.create({
    model: "gpt-4o",
    messages: [{ role: "user", content: "Find blue running shoes under $100" }],
  })
}, { apiKey: process.env.RJ_API_KEY })

The return value is passed through unchanged. If the function throws, the error is recorded in the span and re-thrown.

Configuration

| Option | Type | Default | Description | |---|---|---|---| | apiKey | string | process.env.RJ_API_KEY | Your Runtime Judgement API key. Generate one at /app/settings/api-keys. | | suiteId | string | — | Optional snapshot suite ID to tag all traces with. | | endpoint | string | https://runtime-judgement.app/api/ingest/otlp/v1/traces | OTLP ingest endpoint. Override for self-hosted deployments. | | disabled | boolean | false | When true, no spans are sent. Useful in test environments. | | capturePrompts | boolean | false | When true, include prompt/input content in spans. Off by default — see Privacy note below. |

What data is captured

For each agent span, the processor captures:

  • gen_ai.system — always "openai"
  • gen_ai.request.model — the model name (e.g. "gpt-4o")
  • gen_ai.usage.prompt_tokens — input token count
  • gen_ai.usage.completion_tokens — output token count
  • gen_ai.response.finish_reasons"stop", "tool_calls", or "error"
  • gen_ai.output.value — first 2,000 characters of the agent's output
  • rj.span_kind"agent_run", "tool_call", or "llm_call"
  • error.message — error text when the span failed

What is NOT captured by default

  • Full prompt content — prompts may contain PII, secrets, or confidential user data. Prompts are never sent unless you explicitly set capturePrompts: true.
  • Raw HTTP request/response bodies — only the structured span attributes above are forwarded.
  • API keys or credentials — the bridge never reads or logs your OpenAI key.

Privacy note

All data is sent over HTTPS to your Runtime Judgement account. Only you and your team can access it. The 2,000-character output truncation limit is a hard cap — long completions are always truncated before transmission.

If capturePrompts: false (the default), the span contains no user-supplied text beyond the output truncated to 2,000 chars. This is the safe default for production deployments handling user data.

TypeScript support

Full TypeScript support. All public types are exported from the package root:

import type {
  RJConfig,
  AgentTrace,
  AgentSpan,
  RjSpanKind,
} from "@runtime-judgement/openai-agents"

Compatibility

  • OpenAI SDK v4+
  • Node.js 18+
  • Works with both the openai/agents sub-path and the @openai/agents standalone package

Self-hosted / custom endpoint

Point the processor at your own RJ instance:

new RJTraceProcessor({
  apiKey: process.env.RJ_API_KEY,
  endpoint: "https://your-rj-instance.example.com/api/ingest/otlp/v1/traces",
})

License

MIT