Skip to content

Guardrails SDK

Installation

Vermillio Guardrails SDK is published as a Python package and can be installed ideally within a virtual environment. Vermillio Guardrails SDK requires Python 3.9+.

pip install vermillio-sdk[guardrails]
uv add vermillio-sdk[guardrails]

Configuration

The client loads credentials from environment variables by default:

  • VERMILLIO_SDK_CLIENT_ID : Client id provided by Vermillio
  • VERMILLIO_SDK_CLIENT_SECRET : Client secret provided by Vermillio

For full documentation, see Authentication for a more detailed description.

Initialization

All of the classes for Guardrails SDK live under vermillio.sdk.guardrails. Here is an example usage:

from vermillio.sdk.guardrails import VermillioGuardrails, GuardrailsExternalSource

guardrails = VermillioGuardrails() # The default behavior is to pull from env
# alternatively a VermillioConfig class can be provided
# guardrails = VermillioGuardrails(VermillioConfig.credentials(client_id, client_secret))

result = next(iter(guardrails.run_results([
    GuardrailsExternalSource(prompt="Write a song about a flying hero from Krypton.", lyrics="Hit me baby one more time.")
] or []), None)

if result and result.status == 'Succeeded':
    print(f"Recommended action: {result.action}")
    print(f"Identified profiles: {result.summary.profiles}")