This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: Deprecado
Governance AI SDK for Python
SDK oficial de Python para integrar runtimes con Governance AI Guardrails.
Publicacion objetivo en PyPI:
pip install governanceai
El paquete mantiene compatibilidad con el import legado governance_guardrails_sdk, pero el nombre canonico nuevo es governanceai.
API cubierta
POST /guardrails/installPOST /guardrails/evaluatePOST /guardrails/heartbeatPOST /guardrails/events
Autenticacion
El SDK usa:
app_numberen el bodyAuthorization: Bearer <APP_API_KEY>en cada request
Quick start
from governanceai import GovernanceAIClient, GovernanceAIError
client = GovernanceAIClient(
base_url="https://api.governanceai.example",
app_number=123456,
app_api_key="ga_live_replace_me",
timeout_seconds=10,
max_retries=2,
)
try:
client.install(mode="monitor", metadata={"environment": "production"})
client.heartbeat()
decision = client.apply("Summarize this support ticket", stage="input")
print(decision.allowed, decision.findings, decision.selected_validators)
except GovernanceAIError as exc:
print(exc.status_code, exc)
Ejemplo real de flujo runtime
from governanceai import GovernanceAIClient
client = GovernanceAIClient(
base_url="https://api.governanceai.example",
app_number=123456,
app_api_key="ga_live_replace_me",
default_policy_id="default-runtime-policy",
)
decision_in = client.apply(user_prompt, stage="input")
if not decision_in.allowed:
raise RuntimeError(decision_in.findings)
model_reply = llm.invoke(user_prompt)
decision_out = client.apply(model_reply, stage="output")
if not decision_out.allowed:
raise RuntimeError(decision_out.findings)
Manejo de errores, timeout y retry
GovernanceAIClient expone:
timeout_secondsmax_retriesretry_backoff_secondsretry_status_codes
Los errores del SDK levantan GovernanceAIError con:
status_coderesponse_body
Los retries se aplican a errores de red y a respuestas transientes como 408, 429, 500, 502, 503 y 504.
Capabilities
install()
Registra el runtime y devuelve el estado efectivo de guardrails.
heartbeat()
Mantiene la señal de vida del runtime y puede enviar telemetría agregada del SDK.
apply()
Evalua texto runtime con soporte para:
policy_idmodestagetool_callsmetadatainclude_telemetry
Respuesta:
allowedoutput_textfindingsselected_validatorseffective_scopemode
record_event()
Emite eventos custom al backend.
report_redteam_probe()
Atajo para registrar event_type=redteam_probe.
Ejemplo con tool calls
decision = client.apply(
"Open the customer export",
stage="tool",
tool_calls=[
{
"tool_name": "browser.fetch",
"url": "https://example.com/private-report",
}
],
)
print(decision.allowed)
Si el dominio no esta permitido por la configuracion de la aplicacion, el backend puede responder bloqueando la operacion.
Tests y release
Instalacion editable:
pip install -e ./sdk/python
Ejecutar tests:
python -m pytest ./sdk/python/tests
Build:
python -m build ./sdk/python
Publicacion:
python -m twine upload dist/*
Semver y changelog
- Version actual:
0.1.0 - Historial:
CHANGELOG.md - Licencia:
LICENSE
Referencias
Metadata
Release files for governanceai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| governanceai-0.1.0.tar.gz | 7.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| governanceai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.6 kB
Release files / governanceai-0.1.0.tar.gz
| Download URL | governanceai-0.1.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c98e47784ca1db6c0c4a9b1e1c186730fbcf6722982ab27d1b86cc8460e69fe1
|
|
BLAKE2b-256 checksum How to use checksums |
198b020865f4528de3b8ab6ccde38989081a33ae8e2e2b0e47bbe118326296d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 22, 2026.
Transparency logRelease files / governanceai-0.1.0-py3-none-any.whl
| Download URL | governanceai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e1eb4d930f7e9f90cf24554833d937ca76f9fcab00b2761dbe57bf9b3dd2fb0
|
|
BLAKE2b-256 checksum How to use checksums |
4af440b5f27575839dfa31480826d4e97a88303a36145fde7a3b211951aac57b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 22, 2026.
Transparency logSecurity for governanceai 0.1.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.
Attestation for governanceai-0.1.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 Mar 22, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.