Skip to main content

guardrails-client

A thin REST client for the guardrails-api.

Quickstart

pip install guardrails-ai-sdk
from guardrails_ai.sdk import GuardrailsAI, Guard, ValidationOutcome

# Init the GuardrailsAI client
client = GuardrailsAI(api_key="xxx")

# Fetch a Guard from the server
guard: Guard = await client.guards.retrieve(name="my-guard")

print(guard)

# Run a Guard to validate content
validation_outcome: ValidationOutcome = await client.guards.validate(name="my-guard", llm_output="Hello, world.")

if not validation_outcome.validation_passed:
    print(validation_outcome.validation_summaries)

# Create Guarded Chat Completions
chat_completion = await client.guards.chat.completions.create(guard_name="my-guard", model="gpt-5-nano", messages=[{ "role": "user", "content": "Hello, world." }])

print(chat_completion.choices[0].message.content)
print(chat_completion.guardrails)

# Stream Guarded Chat Completions
completion_stream = await client.guards.chat.completions.create(
    guard_name="my-first-guard",
    model="gpt-5-nano",
    messages=[
        {"role": "user", "content": "Give yourself a realistic name and introduce yourself."}
    ],
    stream=True
)

full_text = ""
validation_summaries = []
async for chunk in completion_stream:
    full_text += chunk.choices[0].delta.content
    validation_summaries.extend(chunk.guardrails.get("validation_summaries", []))


print("\n ==> Validation Summaries: ", validation_summaries)
print("\n ==> Final Content: ", full_text)

Metadata

Release files for guardrails-ai-types 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for guardrails-ai-types 0.5.0
File Size Uploaded Provenance
guardrails_ai_types-0.5.0.tar.gz 17.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for guardrails-ai-types 0.5.0
File Interpreter ABI Platform
guardrails_ai_types-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.2 kB

Release files / guardrails_ai_types-0.5.0.tar.gz

Download URL guardrails_ai_types-0.5.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
de872718c09c7560ee4b79190f6b10f994983c1c90df1b774c8a4df422fe835f
BLAKE2b-256 checksum
How to use checksums
f8b5aa41b36e4859424c3bc98a9e81e22bb7e0f159ff19bbd5bed91aa9b36a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Release files / guardrails_ai_types-0.5.0-py3-none-any.whl

Download URL guardrails_ai_types-0.5.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc7db51bbe5b5ee0bdb4c50be98522940774f16f3b979c53bf849f004e2c8574
BLAKE2b-256 checksum
How to use checksums
666e57318a696733245914392b04677fbac429fa0f8b95f159223abcbe6b909e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Security for guardrails-ai-types 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for guardrails_ai_types-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page