Vibeleaderboard
Index / tool
Visit guardrails.openai.com
Category
AI Tools
Rank
No. 1003Tools index
Pricing
Open Source
Type
TOOL
Builder
openai
GitHub
94 stars
Latest release
v0.2.1
Date

About

TypeScript and JavaScript SDK for OpenAI Guardrails — runtime safety controls for LLM applications.

What it does

It wraps OpenAI and Azure OpenAI clients so configured checks can inspect requests and responses at preflight, input, and output stages. Built-in checks cover moderation, URLs, personal data, hallucinations, jailbreaks, topic boundaries, and custom prompts. A separate evaluation workflow measures guardrail behavior against labeled JSONL datasets.

Why it's ranked here

This is a strong fit for teams already using OpenAI clients or the Agents SDK. Client-compatible integration keeps adoption focused, while staged checks, streaming support, configurable tripwires, and dataset evaluation address both deployment and testing. The preview label and default handling of execution failures warrant care in sensitive systems.

What's good

Guardrails run concurrently within a bundle, and configuration passes through schema validation before execution. Responses retain results grouped by pipeline stage, including triggered checks and aggregated token usage. The package also supports conversation-aware checks, periodic validation during streaming, Azure OpenAI, custom registered checks, and evaluation metrics including precision, recall, and F1.

Tradeoffs

The project identifies itself as a preview. Its current guardrail input model is text-focused, with other media described as future work. Execution failures do not trigger a tripwire by default, so teams must deliberately choose stricter error handling. Some checks may use third-party services, and paid OpenAI API calls can add cost.

How to use it well

Use it when a TypeScript application already calls OpenAI, Azure OpenAI, or the Agents SDK and needs policy checks around model traffic. Start with staged configuration, validate labeled datasets, inspect false positives and false negatives, then monitor tripwire and execution-failure results in production. It does not replace data-retention controls, legal compliance work, or broader application security.

Technical notes+

package.json publishes @openai/guardrails as compiled JavaScript plus declarations from dist, exposes the guardrails CLI, requires Node.js 18 or newer, and depends on openai, @openai/agents, and zod. src/client.ts subclasses OpenAI and AzureOpenAI, replacing chat and responses resources while retaining other client behavior. src/runtime.ts loads JSON configurations, validates check configuration with Zod, instantiates registry entries, and executes bundle checks through Promise.all; execution exceptions become failed results unless raiseGuardrailErrors is enabled. src/streaming.ts checks accumulated output every 100 text chunks by default and performs a final output check. src/cli.ts provides configuration validation, JSONL dataset validation, evaluation, and benchmarking. src/types.ts defines result and token-usage shapes, while src/registry.ts supplies the extensible in-memory specification registry.

Observed

License
MIT
Primary language
TypeScript, compiled to JavaScript with declaration files
Package
Public npm package named @openai/guardrails
Interfaces
Node.js library and guardrails command-line interface
Platform support
Node.js 18 or newer
Client integrations
OpenAI, Azure OpenAI, and OpenAI Agents SDK
Evaluation data
JSONL datasets with expected trigger labels

Read from README.md, Makefile, package.json, pyproject.toml, src/cli.ts, src/index.ts, src/spec.ts, src/types.ts, src/agents.ts, src/client.ts, src/runtime.ts, src/registry.ts, src/streaming.ts, src/exceptions.ts, src/base-client.ts.

What it can do

  • Validate LLM outputs against predefined schemas

    LLM response and validation schemaValidated and structured data or validation errors

  • Filter harmful or inappropriate LLM content

    LLM-generated textFiltered safe content or content rejection notice

  • Enforce data type constraints on LLM responses

    Raw LLM output and type specificationsType-validated data or constraint violations

  • Retry LLM requests when validation fails

    Failed validation results and retry configurationNew LLM request or final failure notification

  • Log safety violations and guardrail events

    Guardrail execution data and logging configurationStructured log entries and audit trails

  • Transform LLM outputs to required formats

    Raw LLM response and target format specificationFormatted data matching required structure

Tags

openaiguardrailssafetytypescriptllm

Tech Stack

Node.jsPythonTypeScript

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.