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.3on2026-04-10 - Current release scope: workflow-aware governance, audit schema
v1.4,AuditLineage,ProvenanceGate,RiskHistory,@governeddefaults to split enforcement - Verification baseline:
966 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.
Since v0.3.3, split enforcement is the default — Phase A runs before the model
call, Phase B validates output after. Pass pre_call_enforcement=False for the
legacy unified mode (deprecated).
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 |
0.3.3 |
2026-04-10 |
Workflow-aware governance: audit schema v1.4 provenance metadata, AuditLineage DAG reconstruction, ProvenanceGate built-in enforcement gate, RiskHistory risk trend tracking, @governed defaults to pre_call_enforcement=True (split enforcement is the standard execution model) |
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 @governed decorator uses split enforcement by default (since v0.3.3):
from aigc import governed
@governed(
policy_file="policies/base_policy.yaml",
role="assistant",
model_provider="anthropic",
model_identifier="claude-sonnet-4-6",
)
def run_model(input_data, context):
return model.generate(input_data)
Phase A runs before the model call; Phase B validates output after. Pass
pre_call_enforcement=False for legacy unified mode (deprecated).
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] [--lineage]for offline compliance reporting over stored audit trails; add--lineageto include DAG-level lineage analysis (node counts, duplicate detection, root/leaf/orphan lists, cycle detection)
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.3.tar.gz.
File metadata
- Download URL: aigc_sdk-0.3.3.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38bd3d49973b6fb9e6329ad33f7abccfd55254b77e4796f41393f438162ea015
|
|
| MD5 |
bf2e3e3b526cc96daaa716515c9f72df
|
|
| BLAKE2b-256 |
66be9d1602a9528e206e60b161b81d766e80c4884d1091b6b7b1a7d0495d6d9f
|
Provenance
The following attestation bundles were made for aigc_sdk-0.3.3.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.3.tar.gz -
Subject digest:
38bd3d49973b6fb9e6329ad33f7abccfd55254b77e4796f41393f438162ea015 - Sigstore transparency entry: 1291407944
- Sigstore integration time:
-
Permalink:
nealsolves/aigc@9c6ae642657720b66a3178fcb9eb8bbf14570ed7 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/nealsolves
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c6ae642657720b66a3178fcb9eb8bbf14570ed7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aigc_sdk-0.3.3-py3-none-any.whl.
File metadata
- Download URL: aigc_sdk-0.3.3-py3-none-any.whl
- Upload date:
- Size: 87.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
557efbf9272f8a41fc7a6f7eb39fd36cc5fd3dd757d9c3d01a5fdb4195120010
|
|
| MD5 |
ae33e0434cf00c705ef8593159103df4
|
|
| BLAKE2b-256 |
c9f45da114ca0252b18766b376fc9fb2502e46714cec35a9bc8ee0e951deb1fc
|
Provenance
The following attestation bundles were made for aigc_sdk-0.3.3-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.3-py3-none-any.whl -
Subject digest:
557efbf9272f8a41fc7a6f7eb39fd36cc5fd3dd757d9c3d01a5fdb4195120010 - Sigstore transparency entry: 1291408047
- Sigstore integration time:
-
Permalink:
nealsolves/aigc@9c6ae642657720b66a3178fcb9eb8bbf14570ed7 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/nealsolves
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c6ae642657720b66a3178fcb9eb8bbf14570ed7 -
Trigger Event:
push
-
Statement type: