SDKs & Libraries
GovernLayer provides a Python SDK and comprehensive REST API. The API follows standard REST conventions, so any HTTP client works out of the box.
Official libraries
PHP
A popular general-purpose scripting language that is especially suited to web development.
Ruby
A dynamic, open source programming language with a focus on simplicity and productivity.
Python
Python is a programming language that lets you work quickly and integrate systems more effectively.
The GovernLayer API is a standard REST API. While we provide a Python SDK, you can use any HTTP client in any language. All examples in these docs show cURL, Python, and JavaScript.
Python SDK
Install
pip install governlayer
Usage
from governlayer import GovernLayerClient
client = GovernLayerClient(api_key="gl_your_api_key_here")
# Run full governance pipeline
result = client.govern(
system_name="my-agent",
behavior="Denied access to authorized user",
expected_behavior="Grant access to authorized users",
framework="SOC2",
)
print(result.drift_score) # 0.82
print(result.decision) # "ESCALATE"
print(result.ledger_hash) # "sha256:..."
Direct REST API
The REST API is available at https://api.governlayer.ai. All endpoints accept and return JSON.
cURL example
curl -X POST https://api.governlayer.ai/v1/govern \
-H "X-API-Key: gl_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"system_name": "my-agent", "behavior": "...", "framework": "SOC2"}'