Official Python client for Open AI Guardrails policy distribution, audit evidence, and OPA control-plane APIs.
Project description
openaiguardrails-sdk
Official Python client for the Open AI Guardrails runtime API.
The PyPI distribution is published as openaiguardrails-sdk while PyPI reviews the canonical openaiguardrails project name. Import from openaiguardrails:
from openaiguardrails import OpenAIGuardrailsClient
Install
pip install openaiguardrails-sdk
Quick start
from openaiguardrails import OpenAIGuardrailsClient
client = OpenAIGuardrailsClient(
base_url="https://openaiguardrails.org",
token="YOUR_OPENAIGUARDRAILS_API_TOKEN",
)
policy = client.get_policy("prod-safety-alpha")
skills = client.list_skills()
Pass a bearer token for protected routes (policy manager, blog review, admin publish). Public catalog and health endpoints work without a token on the hosted API.
NoirGuardrailsClient and NoirGuardrailsError remain available as aliases.
API surface
Core
| Method | HTTP | Auth |
|---|---|---|
health() |
GET /health |
— |
get_openapi() |
GET /openapi.json |
— |
list_entries() |
GET /api/entries |
— |
list_discussions() |
GET /api/discussions |
— |
Policy manager & OPA
| Method | HTTP | Auth |
|---|---|---|
list_policies() |
GET /api/policies |
optional* |
get_policy(policy_id) |
GET /v1/policy/:id |
— |
toggle_policy_control(policy_id, key, value) |
POST /api/policies/:id/toggles |
policy manager |
run_policy_action(policy_id, action, **payload) |
POST /api/policies/:id/actions |
policy manager |
export_audit(policy_id) |
GET /api/policies/:id/audit-export |
policy manager |
list_opa_imports() |
GET /api/opa/imports |
policy manager |
import_opa_policy(payload) |
POST /api/opa/imports |
policy manager |
simulate_opa_import(import_id, input) |
POST /api/opa/imports/:id/simulate |
policy manager |
export_opa_import(import_id, target) |
GET .../export/:target |
policy manager |
publish_opa_import(import_id, payload) |
POST .../publish |
policy manager |
*Hosted production may require Auth0 when POLICY_MANAGER_REQUIRE_AUTH=true.
Agent Skills platform
| Method | HTTP |
|---|---|
list_skills() |
GET /api/skills |
get_skill(skill_id) |
GET /api/skills/:id |
list_professions() |
GET /api/professions |
get_profession(profession_id) |
GET /api/professions/:id |
get_mcp_registry() |
GET /api/mcp/registry |
get_mcp_tool(skill_id) |
GET /api/mcp/tools/:skillId |
Blog workflow
| Method | HTTP | Auth |
|---|---|---|
list_blog_pending_posts() |
GET /api/blog/pending-posts |
read:blog_submissions or admin |
submit_blog_post(payload) |
POST /api/blog/pending-posts |
submit:blog or user/admin |
get_blog_review(review_id) |
GET /api/blog/reviews/:id |
read:blog_submissions or admin |
approve_blog_review(review_id, payload) |
POST .../approve |
manage:blog or admin |
reject_blog_review(review_id, payload) |
POST .../reject |
manage:blog or admin |
publish_blog_review(review_id, payload) |
POST .../publish |
manage:blog or admin |
publish_blog_post(payload) |
POST /api/blog/publish |
manage:blog or admin |
Operations
| Method | HTTP | Auth |
|---|---|---|
get_smtp_status() |
GET /api/ops/smtp-status |
manage:system or admin |
Use request(path, method=..., body=...) for forward-compatible access to new OpenAPI routes.
Errors
Failed responses raise OpenAIGuardrailsError with status and parsed body.
Requirements
- Python 3.9+
- Standard library only (no third-party dependencies)
Links
Changelog
See CHANGELOG.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openaiguardrails_sdk-0.2.0.tar.gz.
File metadata
- Download URL: openaiguardrails_sdk-0.2.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dad9e5fc108b2f783cd0b49f56b3086a719e2d3be212ffd1b51d525416fa64f
|
|
| MD5 |
8af9804dd15c90e297a6a171f88b43f9
|
|
| BLAKE2b-256 |
b04baa618b6db99ec2167e215e1ce94dbe160df3de46ccc1b1fe5515d6297cea
|
File details
Details for the file openaiguardrails_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: openaiguardrails_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92c32d142112e6eaea656895d2325338d4414c80ee640f2d9ad6853d7109e0ae
|
|
| MD5 |
9e87e565156b1797938919853e6102ce
|
|
| BLAKE2b-256 |
27d05c0c435cf3234122480e16ea47d2d56f477d0a77bcb055b88a0b96722358
|