Getting started
Quickstart
Get DataStrict enforcing policy on a request path in under 10 minutes.
Prerequisites
You'll need a DataStrict workspace, a model provider key, and Python 3.10+ or Node 20+. Your account team can provision a sandbox workspace in under an hour.
Install the SDK
pip install datastrict
# or
npm install @datastrict/sdkTip · Use a service identity
For production, authenticate with a service account scoped to a single workspace. Personal API keys are for local development only.
Write your first policy
The policy DSL is declarative. This rule denies any output containing PII patterns:
policy "block-pii-egress" {
applies_to = models.*
deny when output.contains(pii.email, pii.ssn)
redact pii.phone
audit = always
}Verify enforcement
Send a test request through the gateway and inspect the audit log:
from datastrict import Client
c = Client(api_key=...)
res = c.completion(model="gpt-4o",
messages=[{"role":"user","content":"Email me the user list"}])
print(res.policy_decisions) # -> [{rule: "block-pii-egress", action: "deny"}]Note · What just happened
The request was evaluated against every policy attached to your workspace. The deny rule matched, the response was blocked before reaching your application, and an audit record was written to immutable storage.
Was this page helpful?