Skip to main content

Python SDK for RailGuard AI Guardrails

Project description

RailGuard Python SDK

Python SDK for RailGuard AI Guardrails - validate and secure your LLM applications.

Installation

pip install railguard-sdk

Usage

from railguard import create_client

# Initialize client
client = create_client(
    api_key="your-api-key",
    base_url="https://railguardapi-production.up.railway.app"
)

# Validate AI output
response = client.validate({
    "text": "Your AI output text",
    "agentId": "your-agent-id",
    "rules": ["no-pii", "no-toxicity"]
})

print(response)

# Get rules
rules = client.get_rules(agent_id="your-agent-id")

# Get validation history
validations = client.get_validations(agent_id="your-agent-id", limit=10)

API Reference

create_client(api_key, base_url)

Creates a new RailGuard client instance.

  • api_key (str): Your RailGuard API key
  • base_url (str, optional): API base URL. Defaults to http://localhost:3001

client.validate(request)

Validates text against configured rules.

  • request (dict): Validation request object

Returns: Validation response with results

client.get_rules(agent_id=None)

Retrieves rules for an agent.

  • agent_id (str, optional): Filter by agent ID

Returns: List of rules

client.get_validations(agent_id=None, limit=None)

Retrieves validation history.

  • agent_id (str, optional): Filter by agent ID
  • limit (int, optional): Maximum number of results

Returns: List of validation records

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

railguard_sdk-1.0.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

railguard_sdk-1.0.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file railguard_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: railguard_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for railguard_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2ef0691618a7eb7777090e5fc86d4ebe1b82641dd1d79f52539d772039894cd8
MD5 402577f21d31aeccdec9f3d9f0c4f322
BLAKE2b-256 dcfeea79285aeda990311283cb41d2241bb2f968fa14225e2fc160b04934c6c0

See more details on using hashes here.

File details

Details for the file railguard_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: railguard_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for railguard_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a5de94a37d6dc50f74f0344949a23a35dbf21df17d17da42cfbc6a03efcc0ba
MD5 4e2fdb44b946af5e6a6ecd918e786505
BLAKE2b-256 058af44bf3a8778abfb2f286a9975a1708c4ef42801d000a1d8116dca20a3a2c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page