Catalog PyPI
PACKAGE EXPLORERView in registry

aigc-sdk

PyPI

Deterministic, fail-closed governance enforcement for AI model invocations.

aiauditdeterministicenforcementgovernancellmpolicy
Versions collected1
Direct dependencies6From release 0.3.3
Last observed21 Oct, 10:46 UTC

README

Version 0.3.3 documentation

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.

ReleaseDateWhat changed for users
0.1.02026-02-16Initial SDK: policy loading, role allowlists, preconditions, output schema validation, postconditions, deterministic audit artifacts
0.1.1 to 0.1.32026-02-17 to 2026-02-23Installation and integration stabilization: context in audit artifacts, absolute policy paths, packaged schemas, public API guidance, aigc-sdk PyPI package name
0.2.02026-03-06SDK 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.02026-03-15Governance 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.12026-04-04Demo parity release: React demo and FastAPI backend became the maintained hands-on surface for all 7 labs
0.3.22026-04-05Split 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.32026-04-10Workflow-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:

DocumentWhy it matters
PROJECT.mdBest repo-level orientation: architecture diagram, repo map, and release-by-release narrative
Architecture DesignAuthoritative runtime design and invariants
Integration GuideHost integration patterns, split-mode guidance, and compliance checklist
Policy DSL SpecFull policy format reference
CookbookTask-oriented recipes for common integration patterns
Public Integration ContractEnd-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"

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.3.314 Apr 20266

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
nealsolves/aigc

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:46 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:e394858fbd917a03bdfec4aca4531c33f0da4edac634d99c7b9a1ec46c66ccb4