Skip to main content

AIGC — Auditable Intelligence Governance Contract

AIGC Banner

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.3 on 2026-04-10
  • Current release scope: workflow-aware governance, audit schema v1.4, AuditLineage, ProvenanceGate, RiskHistory, @governed defaults to split enforcement
  • Verification baseline: 966 tests, coverage above the 90% 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.

  1. The host assembles an invocation and selects a policy.
  2. AIGC loads and resolves the policy, enforces ordered governance gates, and computes audit metadata.
  3. 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 checks
  • aigc policy validate <file...> for semantic validation, including composition and cycle detection
  • aigc compliance export --input audit.jsonl [--output report.json] [--lineage] for offline compliance reporting over stored audit trails; add --lineage to 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"

Metadata

Release files for aigc-sdk 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aigc-sdk 0.3.3
File Size Uploaded Provenance
aigc_sdk-0.3.3.tar.gz 1.2 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aigc-sdk 0.3.3
File Interpreter ABI Platform
aigc_sdk-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / aigc_sdk-0.3.3.tar.gz

Download URL aigc_sdk-0.3.3.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
38bd3d49973b6fb9e6329ad33f7abccfd55254b77e4796f41393f438162ea015
BLAKE2b-256 checksum
How to use checksums
66be9d1602a9528e206e60b161b81d766e80c4884d1091b6b7b1a7d0495d6d9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 14, 2026.

Transparency log

Release files / aigc_sdk-0.3.3-py3-none-any.whl

Download URL aigc_sdk-0.3.3-py3-none-any.whl
Size 87.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
557efbf9272f8a41fc7a6f7eb39fd36cc5fd3dd757d9c3d01a5fdb4195120010
BLAKE2b-256 checksum
How to use checksums
c9f45da114ca0252b18766b376fc9fb2502e46714cec35a9bc8ee0e951deb1fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 14, 2026.

Transparency log

Security for aigc-sdk 0.3.3

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aigc_sdk-0.3.3.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 Apr 14, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page