Calethia SDK
Python SDK for writing compliance policies as code.
Installation
pip install "calethia>=0.7.0"
For authenticated external API reads, see External API authentication.
Quick Start
from calethia import fail, pass_, policy, result, Severity
from calethia.bloomfire import list_posts
from calethia.frameworks import SOC2
@policy(
id="bloomfire.kb.published_content",
name="Bloomfire Content Is Published",
severity=Severity.HIGH,
frameworks=[SOC2("CC1.4")],
)
def check_published_content():
"""Ensure the applicable knowledge-base posts are published."""
for post in list_posts():
if not post.is_published:
fail(post.to_resource(), "Post is not published")
else:
pass_(post.to_resource(), "Post is published")
return result()
Pass-per-resource contract
Every resource a policy enumerates needs a verdict. Resources returned by a context
fetch method that are never passed, failed or skipped are auto-emitted as
not_evaluated findings when result() runs, so an enumeration hole is visible
instead of reading as a silent green. When evaluating only a subset is deliberate,
opt out explicitly with ctx.sampled("why only a subset is evaluated") — the reason
is recorded in the result metadata, never silent.
Features
- Decorator-based policy definition
- Type-safe framework control mappings
- Common control framework tagging (
calethia.ccf) — map a policy once onto a framework-neutral control and it counts toward every framework that control satisfies - AWS context with managed boto3 clients
- Narrative SOC 2 policy documents (
calethia.documents) — byte-deterministic templates that each declare the controls they cover, for the controls a written policy satisfies - Asset discovery via census policies — enumerate everything a connected provider exposes as a signed, timestamped inventory
- Author your own compliance framework (
calethia.frameworks.authoring): map a requirement list onto the CCF spine as typed Python, scaffolded and linted with thecalethia framework new | lint | importcommand group - Full IDE autocomplete support
Common Control Framework
calethia.ccf is a framework-neutral spine: engineer-legible controls (access-mfa,
crypto-at-rest, ...) plus a crosswalk onto the (framework, control_id) pairs each
control satisfies. Tag once with CCF("...") instead of enumerating frameworks by hand:
from calethia import pass_, policy, result, Severity
from calethia.bloomfire import list_posts
from calethia.ccf import CCF
@policy(
id="bloomfire.kb.published_content",
name="Bloomfire Content Is Published",
severity=Severity.HIGH,
frameworks=[CCF("access-mfa")],
)
def check_published_content():
"""Tag a facade-first policy with a CCF control."""
for post in list_posts():
pass_(post.to_resource(), "Post evaluated")
return result()
An unknown control id raises ValueError immediately, exactly like the framework
helpers. The public surface is CCF, get_ccf_controls, get_crosswalk,
get_ccf_decomposition, CCF_DOMAINS, and CONTENT_VERSION. CCF is a spine, not a
compliance framework: it is never selectable and never a reporting target on its own.
Framework policy packs
First-party policy packs map existing provider policies to compliance frameworks.
- NIST CSF AWS policy pack
- GDPR AWS policy pack
- GDPR GitHub policy pack
- HIPAA AWS policy pack
- ISO 27001 GitHub policy pack
- NIST CSF GitHub policy pack
- PCI-DSS AWS policy pack
Google Cloud policies
Install GCP dependencies with pip install 'calethia[gcp]'. Set
GOOGLE_APPLICATION_CREDENTIALS and provide the project ID when you run a policy:
calethia run examples/gcp_subnet_private_google_access.py --account-id your-project-id
GCP service facades collect typed project resources. The built-in policies cover IAM, Cloud Storage, Compute Engine, VPC, Logging, Monitoring, KMS, Cloud SQL, and GKE. Missing permissions produce errors. Project checks do not inspect organization policies. See GCP integration for permissions and policy IDs.
The subnet example, bucket example, and KMS example each declare one facade policy.
Snowflake default policies
The SDK includes 14 Snowflake default policies. See the policy rules and SOC 2 mappings.
PagerDuty default policies
The SDK includes 8 PagerDuty incident-response default policies. See the policy rules and SOC 2 and ISO 27001 mappings.
Slack default policies
The SDK includes 5 Slack workspace default policies. See the policy rules and SOC 2 and ISO 27001 mappings.
Jira default policies
The SDK includes 5 Jira default policies in examples/jira_*.py. They check anonymous project access, open project administration grants, administrator group size, approval before Done on change workflows, and recent audit records. Each policy maps one SOC 2 control and one ISO 27001 control.
Two cross-provider policies check that each merged GitHub pull request or GitLab merge request links to a Jira issue. See the Jira change link rules and mappings.
Intune default policies
The SDK includes 8 Intune device and compliance policies. See the policy rules, version baselines, and SOC 2 and ISO 27001 mappings.
Entra ID default policies
The SDK includes 11 Microsoft Entra ID policies. Three user policies check MFA registration, stale accounts, and guest access. Four privileged role policies check the Global Administrator count, MFA for role holders, permanent assignments, and PIM use. Three Conditional Access policies check the access control baseline, legacy authentication, and MFA for all users. One application policy checks expiring secrets and certificates. See the policy rules, parameters, and SOC 2 and ISO 27001 mappings.
Auth0 starter policies
The SDK includes Auth0 tenant MFA, brute-force blocking, and breached-password blocking policies. See the Auth0 policy rules and parameters.
Jamf Pro default policies
The SDK includes 4 Jamf Pro computer policies for FileVault encryption, supported macOS versions, screen lock, and management state. See the policy rules, parameters, and SOC 2 and ISO 27001 mappings.
Azure Resource Manager reads
The SDK exposes typed Azure storage, network, Key Vault, role assignment, and Activity Log reads. Each read covers every subscription in scope and raises on a failed or incomplete ARM response.
Rippling lifecycle policies
The SDK exposes typed Rippling lifecycle models and policy reads. Company-wide workforce reads remain closed while coverage is unknown. Policies can read workers reconciled to the returned user directory through an explicit scoped operation.
Deel workforce lifecycle reads
The SDK exposes typed Deel person models and policy reads. list_people() returns the roster only for a fresh, complete, non-empty collection. Every other collection state raises a provider enumeration error.
Gusto workforce lifecycle reads
The SDK exposes typed Gusto employee models and policy reads. list_employees() returns the employees only for a fresh, complete, non-empty collection. Every other collection state raises a provider enumeration error.
Zoom account security reads
The SDK exposes typed Zoom user, role, and security settings models and policy reads. list_users(), list_roles(), and list_role_members() return data only for a fresh, complete, non-empty population. Every other state raises ZoomUnavailableError with a typed reason. A settings property raises the same error when Zoom did not report that field.
Salesforce security reads
Import list_users, list_permission_assignments, list_mfa_methods, list_health_check_risks,
or list_setup_audit_events from calethia.salesforce. Each read uses the Salesforce organization
bound to the platform policy run. Each resource carries that Organization ID and contract version
1.0.0. The setup audit read covers an inclusive 180-day window.
The SDK raises SalesforceUnavailableError when it cannot verify a requested population. A complete
query can return an empty list. Findings use identifiers and allowlisted security fields. The public
models omit delegate-user text because the field can contain a name or username.
Datadog org access reads
The SDK exposes typed Datadog user, role, and org security settings models and policy reads. list_users() and list_roles() return data only for a fresh, complete, non-empty population. Every other state raises DatadogUnavailableError with a typed reason. A settings property raises the same error when Calethia could not read that SAML setting. The SDK also includes 5 default Datadog access-control policies for MFA, inactive accounts, org management assignment, SAML strict mode, and Okta deprovisioning. See the default policy pack.
Browser captures
The SDK captures vendor portal pages with scripted browser steps. BrowserContext.capture() returns the screenshot, the page text, the final URL, and an action trace, and records the trace as evidence. Every request must reach a declared host and pass the bound destination policy. A failed step, a blocked navigation, or an oversized screenshot raises BrowserCaptureError.
The Penpot WebGL browser AI demo uses a separate password connection and one typed screenshot interpretation. The rule has no security-framework mapping.
AI questions
A policy can ask a model about a screenshot or a text. calethia.ai.ask() and calethia.ai.interpret() read the target into a frozen, typed observation, and the policy code decides pass or fail from its fields. An observation below the confidence threshold records a needs_review finding, and a failed call records an error finding. A policy declares model use with @policy(ai=AiRequirement(...)), and calethia run reads the provider key from your environment.
Narrative policy documents
Not every control is closed by a technical check. calethia.documents ships the core
SOC 2 narrative policy documents as byte-deterministic Markdown templates, each of which
declares the (framework, control_id, aspect_key) triples it covers, so a generated
document arrives already mapped:
import datetime
from calethia.documents import OrgFacts, get_document_templates, render
template = get_document_templates()["access-control-policy"]
markdown = render(
template,
OrgFacts(organization_name="Acme, Inc.", effective_date=datetime.date(2026, 1, 15)),
)
render is pure: no clock, no environment, no filesystem, no network, no randomness, so
the same inputs produce the same bytes on every machine. The public surface is render,
get_document_templates, is_in_coverage_scope, format_effective_date,
DocumentTemplate, OrgFacts, ControlMapping, ProseSlot,
OUT_OF_SCOPE_CONTROL_PREFIXES, and DOCUMENT_CONTENT_VERSION. To author a template of
your own, see Authoring a narrative policy document template.
Asset discovery (census)
A census is a degenerate policy: instead of rendering a pass/fail verdict it enumerates
everything a connected provider exposes and records each resource as DISCOVERED. It reuses the
same machine as any other policy — scheduler, executor, provider auth, and evidence signing — so
the inventory it produces is cryptographically signed and timestamped. Because census findings are
non-verdict, they are excluded from every compliance rollup by kind, not by status, so a census
passing can never inflate a control's status.
To write one for a provider, see Writing a census (asset discovery) for a provider.
Resource catalogs
Resource catalogs declare typed provider environments without executing repository code. See
Resource catalog declarations for the static-only dialect.
For AWS policies, @policy(applies_to=...) filters returned resource models after each normal
context operation. Calethia keeps a complete classification census and stops execution when it
cannot classify a returned resource or read tags required by a matching catalog group.
Ticketing routes
Declare which Jira project receives each owning team's findings in policies/ticketing.py. See
Ticketing routes for the route file format and its lint checks.
Authoring your own framework
calethia.frameworks.authoring lets a GRC engineer declare a compliance framework and
its CCF crosswalk in typed Python, in your own Git repository. The platform never
executes the module: extract_framework_pack reads the source statically (AST only) and
returns a frozen pack. The public entry points are extract_framework_pack, Control,
CustomFramework, and CcfMapping. The calethia framework command group scaffolds a
lint-clean pack, imports one from a CSV of requirements (offline, CSV only), and runs the
identical extractor the platform runs at sync time:
calethia framework new acme_baseline
calethia framework import requirements.csv --slug acme_baseline
calethia framework lint frameworks/acme_baseline --output text
Mutation is a commit, not an API call. For the full field, bounds, and static-only dialect reference, see the Framework authoring section of the SDK reference.
Offline verification (calethia verify)
calethia verify checks an evidence bundle or record on your own machine, with no Calethia
account, no credentials, and no network access. It recomputes every signed digest — including
the per-run population attestation that commits to the full set of resources a run evaluated —
and exits non-zero when a claim does not hold.
For what a passing result proves, and what it deliberately does not, see Offline evidence verification and the trust model.
Custom providers
Write your own integration and run it from your laptop against your own system, with no
Calethia account and no platform call. calethia scaffold provider <name> emits a complete,
runnable package; calethia check lints it offline; the calethia.testing fixtures unit-test
it with no network; and calethia run evaluates a real policy against your real system using
local credentials.
For the end-to-end loop — scaffold, check, test, and run with the credential-source precedence — see Authoring a custom provider.
Google Workspace and Gmail
For typed Google Workspace identity and Gmail policy contexts, including their platform connector requirements, see Google Workspace and Gmail. For the versioned default policy pack and its control mappings, see Google Workspace default policy pack mappings.
GitHub review evidence
The SSO and outside-collaborator review policies require signed administrator observations. See GitHub review evidence for the recording and verification flow.
GitHub change evidence
Three bundled policies evaluate GitHub change history: merged pull request approvals, Dependabot alert remediation, and remediation issue tracking. See GitHub change evidence for the rules, parameters, evidence fields, and required permissions.
BambooHR-to-Okta access removal SLA
bamboohr.offboarding.access_removal_sla is the SDK's first shipped two-provider policy: it
joins the BambooHR terminated-employee population to Okta account state and proves that access
removal met a configured SLA. For the sla_days and termination_timezone parameters, the
evidence fields, the email/login join rule, and every error outcome, see BambooHR-to-Okta
access removal SLA.
License
Source-available under the Functional Source License 1.1 with an Apache 2.0 Future License (FSL-1.1-ALv2). Copyright 2026 Calethia.
In short:
- You may read, run, modify, and redistribute this SDK for any purpose except a Competing Use — reselling it, or shipping it inside a commercial product or service that substitutes for Calethia. Internal use at your company, non-commercial education, and non-commercial research are all expressly permitted.
- Your policies are yours. FSL carries no copyleft or share-alike obligation.
Importing
calethiadoes not encumber the policy code you write against it — keep it, relicense it, or take it elsewhere. - Every version becomes Apache-2.0 on the second anniversary of its release, so you can keep running your compliance checks indefinitely, with or without an account.
FSL is source-available, not an OSI-approved open source license. The SDK is provided as is, without warranties, and Calethia's liability is limited — see the Disclaimer section of LICENSE.md. It assists with compliance verification; it does not guarantee a passing audit. Third-party dependency licenses are inventoried in NOTICE.md.
For agent clients, see the stdio MCP server.
Metadata
Release files for calethia 0.8.2
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 | Actions |
|---|---|---|---|---|
| calethia-0.8.2.tar.gz | 2.2 MB | With provenance | Details for calethia-0.8.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| calethia-0.8.2-py3-none-any.whl | Python 3 | none | any | Details for calethia-0.8.2-py3-none-any.whl |
Total release size: 4.3 MB
Release files / calethia-0.8.2.tar.gz
| Download URL | calethia-0.8.2.tar.gz |
|---|---|
| Size | 2.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc92358d568043b053f0d9da659ebf1d23f8e25929c84254618d1d9017bdb574
|
|
BLAKE2b-256 checksum How to use checksums |
5df18f6cb6641845aa442634064263a726accf4c36048ecd3548f03d6fec69fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logRelease files / calethia-0.8.2-py3-none-any.whl
| Download URL | calethia-0.8.2-py3-none-any.whl |
|---|---|
| Size | 2.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff19b2fd1ecd34e6c7cc8140276997dce00e6ead0d4bf864a8835251cbad2f2b
|
|
BLAKE2b-256 checksum How to use checksums |
e8017c808c18740b685da00cf4eaea931fbdc8a985b6fc3e79c309ca3dcf0ace
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 2, 2026.
Transparency logSecurity for calethia 0.8.2
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
Both files in this release have been uploaded with provenance metadata.
Attestation for calethia-0.8.2.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 Dec 2, 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.