Deterministic, fail-closed governance enforcement for AI model invocations.
Project description
AIGC — Auditable Intelligence Governance Contract
AIGC is a Python SDK for deterministic, fail-closed governance of AI model invocations. It validates every invocation against a declared policy, enforces role and schema constraints, evaluates optional custom gates and risk scoring, and emits a tamper-evident audit artifact for every pass or fail path.
Governance in AIGC is runtime enforcement, not documentation and not prompting.
At a Glance
- Package:
pip install aigc-sdk - Import:
import aigc - Current release:
v0.3.2on2026-04-05 - Current release scope: split enforcement, audit schema
v1.3, token integrity hardening, unified-mode compatibility retained - Verification baseline:
818 tests, coverage above the90%CI gate
Why This Repo Exists
Most AI governance guidance stays advisory. AIGC is opinionated about turning governance into an executable contract:
- Policies are declarative YAML and validated against JSON Schema.
- Enforcement is deterministic and fail-closed.
- Audit artifacts are mandatory, structured, and checksum-based.
- Governance is model- and provider-agnostic.
- Split enforcement is available when hosts need pre-call authorization before token spend.
If a model call cannot be justified by policy and evidenced by an audit record, AIGC treats it as invalid.
Runtime Model
AIGC sits at the invocation boundary between the host application and the model provider.
- The host assembles an invocation and selects a policy.
- AIGC loads and resolves the policy, enforces ordered governance gates, and computes audit metadata.
- AIGC returns or emits a PASS/FAIL audit artifact that can be stored, exported, chained, or inspected offline.
Unified mode is still the default. v0.3.2 adds split mode so pre-call checks
can run before the model executes while preserving the same gate ordering.
Release Narrative
This is the versioned story of the repo's current state and how it evolved release by release.
| Release | Date | What changed for users |
|---|---|---|
0.1.0 |
2026-02-16 | Initial SDK: policy loading, role allowlists, preconditions, output schema validation, postconditions, deterministic audit artifacts |
0.1.1 to 0.1.3 |
2026-02-17 to 2026-02-23 | Installation and integration stabilization: context in audit artifacts, absolute policy paths, packaged schemas, public API guidance, aigc-sdk PyPI package name |
0.2.0 |
2026-03-06 | SDK ergonomics and operability: instance-scoped AIGC, typed preconditions, exception sanitization, policy caching, sink failure modes, audit schema v1.2, InvocationBuilder, AST-based guards, policy CLI |
0.3.0 |
2026-03-15 | Governance hardening: risk scoring, artifact signing, audit chain utility, pluggable PolicyLoader, policy dates, telemetry, policy testing, compliance export, custom gate isolation and metadata preservation |
0.3.1 |
2026-04-04 | Demo parity release: React demo and FastAPI backend became the maintained hands-on surface for all 7 labs |
0.3.2 |
2026-04-05 | Split enforcement release: enforce_pre_call() / enforce_post_call(), PreCallResult, split decorator mode, audit schema v1.3, and post-release security hardening from the 2026-04-05 audit |
For the full change log, use CHANGELOG.md.
Installation
pip install aigc-sdk
Editable install from source:
python3 -m venv aigc-env
source aigc-env/bin/activate
python -m pip install --upgrade pip setuptools wheel
pip install --no-build-isolation -e '.[dev]'
The --no-build-isolation flag keeps editable installs working in
network-restricted environments by reusing already-installed build tools.
Quick Start
Unified enforcement remains the simplest integration path:
from aigc import enforce_invocation
artifact = enforce_invocation(
{
"policy_file": "policies/base_policy.yaml",
"model_provider": "anthropic",
"model_identifier": "claude-sonnet-4-6",
"role": "assistant",
"input": {"query": "Summarize this incident"},
"output": {"result": "Summary text", "confidence": 0.94},
"context": {"role_declared": True, "schema_exists": True},
}
)
For new code that needs isolated configuration, use the instance API:
from aigc import AIGC, JsonFileAuditSink
engine = AIGC(sink=JsonFileAuditSink("audit.jsonl"))
artifact = engine.enforce(invocation)
Split Enforcement in v0.3.2
Split mode lets you authorize before the model call and validate output after the call:
from aigc import enforce_post_call, enforce_pre_call
pre = enforce_pre_call(
{
"policy_file": "policies/base_policy.yaml",
"model_provider": "anthropic",
"model_identifier": "claude-sonnet-4-6",
"role": "assistant",
"input": {"query": "Summarize this incident"},
"context": {"role_declared": True, "schema_exists": True},
}
)
output = model.generate(...)
artifact = enforce_post_call(pre, output)
The decorator also supports split mode:
from aigc import governed
@governed(
policy_file="policies/base_policy.yaml",
role="assistant",
model_provider="anthropic",
model_identifier="claude-sonnet-4-6",
pre_call_enforcement=True,
)
def run_model(input_data, context):
return model.generate(input_data)
Interactive Demo
The maintained demo is a React frontend plus FastAPI backend:
- Site: https://nealsolves.github.io/aigc/
- Coverage: 7 labs across risk scoring, signing, audit chain, composition, loaders and policy dates, custom gates, and compliance export
- Purpose: hands-on orientation to the runtime that shipped in
v0.3.x
CLI Surface
The aigc console script exposes three practical commands:
aigc policy lint <file...>for syntax and schema checksaigc policy validate <file...>for semantic validation, including composition and cycle detectionaigc compliance export --input audit.jsonl [--output report.json]for offline compliance reporting over stored audit trails
Repo Guide
If you are new to the repo, start here:
| Document | Why it matters |
|---|---|
| PROJECT.md | Best repo-level orientation: architecture diagram, repo map, and release-by-release narrative |
| Architecture Design | Authoritative runtime design and invariants |
| Integration Guide | Host integration patterns, split-mode guidance, and compliance checklist |
| Policy DSL Spec | Full policy format reference |
| Cookbook | Task-oriented recipes for common integration patterns |
| Public Integration Contract | End-to-end runnable integration contract |
Development Gates
Before release, the repo expects these checks to pass locally:
python -m pytest --cov=aigc --cov-report=term-missing --cov-fail-under=90
flake8 aigc
npx markdownlint-cli2 "**/*.md"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aigc_sdk-0.3.2.tar.gz.
File metadata
- Download URL: aigc_sdk-0.3.2.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cc1c267f96db4a41ba7a542bf3beabe5ce5596648beacf35f5e6b9865d5b9f5
|
|
| MD5 |
38fc564d4eb893b41b7f82fb54519fa0
|
|
| BLAKE2b-256 |
adc53dd577e7414de06f988741428b3e78ef6f9d32cd7f45293b03c9bc0e7158
|
Provenance
The following attestation bundles were made for aigc_sdk-0.3.2.tar.gz:
Publisher:
release.yml on nealsolves/aigc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aigc_sdk-0.3.2.tar.gz -
Subject digest:
5cc1c267f96db4a41ba7a542bf3beabe5ce5596648beacf35f5e6b9865d5b9f5 - Sigstore transparency entry: 1244516551
- Sigstore integration time:
-
Permalink:
nealsolves/aigc@a725de6d15f865dccd60331bf04d615e7f6f4369 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/nealsolves
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a725de6d15f865dccd60331bf04d615e7f6f4369 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aigc_sdk-0.3.2-py3-none-any.whl.
File metadata
- Download URL: aigc_sdk-0.3.2-py3-none-any.whl
- Upload date:
- Size: 77.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c59ddd84d4dfeb451a2a1f5f12d0f521b45721988cf2053b11b6ab1eca75525
|
|
| MD5 |
961141ab1ee6713e4bb01311bea38db0
|
|
| BLAKE2b-256 |
6630202df55cc91ec7749d29ebd9a991829048874eaef636e8044bc3fe1d2478
|
Provenance
The following attestation bundles were made for aigc_sdk-0.3.2-py3-none-any.whl:
Publisher:
release.yml on nealsolves/aigc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aigc_sdk-0.3.2-py3-none-any.whl -
Subject digest:
8c59ddd84d4dfeb451a2a1f5f12d0f521b45721988cf2053b11b6ab1eca75525 - Sigstore transparency entry: 1244516578
- Sigstore integration time:
-
Permalink:
nealsolves/aigc@a725de6d15f865dccd60331bf04d615e7f6f4369 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/nealsolves
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a725de6d15f865dccd60331bf04d615e7f6f4369 -
Trigger Event:
push
-
Statement type: