Skip to main content

Public ACGS Lite package for constitutional governance in AI agents. Enforce rules, audit decisions, and prevent self-validation in production.

Project description

acgs-lite

PyPI Python License: AGPL-3.0

Constitutional governance infrastructure for AI agents.

acgs-lite lets you define constitutional rules in YAML or code, validate inputs and outputs deterministically, enforce MACI role separation, and maintain tamper-evident audit trails. Install name: acgs-lite. Import namespace: acgs_lite.

Installation

acgs-lite supports Python 3.10+.

pip install acgs-lite
pip install acgs-lite[anthropic]
pip install acgs-lite[openai]
pip install acgs-lite[langchain]
pip install acgs-lite[mcp]
pip install acgs-lite[gitlab]
pip install acgs-lite[server]
pip install acgs-lite[pdf]
pip install acgs-lite[all]

Quick Start

from acgs_lite import Constitution, GovernedAgent

constitution = Constitution.from_template("general")
agent = GovernedAgent(my_agent, constitution=constitution)
result = agent.run("process this request")

Custom Rules

from acgs_lite import Constitution, GovernedAgent, Rule, Severity

constitution = Constitution.from_rules([
    Rule(
        id="NO-PII",
        text="Do not include personally identifiable information",
        severity=Severity.CRITICAL,
        keywords=["ssn", "social security", "passport"],
    ),
    Rule(
        id="NO-HARM",
        text="Do not provide harmful instructions",
        severity=Severity.HIGH,
        keywords=["malware", "exploit"],
    ),
])

agent = GovernedAgent(my_agent, constitution=constitution)
result = agent.run("summarize the report")

YAML Rules

# rules.yaml
rules:
  - id: NO-PII
    text: Never include personally identifiable information
    severity: CRITICAL
    keywords: [ssn, social security, passport]
  - id: NO-MEDICAL-ADVICE
    text: Do not provide specific medical diagnoses
    severity: HIGH
    keywords: [diagnose, prescription, dosage]
from acgs_lite import Constitution, GovernedAgent

constitution = Constitution.from_yaml("rules.yaml")
agent = GovernedAgent(my_agent, constitution=constitution)

MACI Role Separation

from acgs_lite import Constitution, GovernedAgent, MACIRole

constitution = Constitution.from_template("general")
agent = GovernedAgent(
    my_agent,
    constitution=constitution,
    maci_role=MACIRole.PROPOSER,
    enforce_maci=True,
)

result = agent.run("draft deployment plan", governance_action="propose")

Compliance Assessment

from acgs_lite.compliance import MultiFrameworkAssessor

assessor = MultiFrameworkAssessor()
report = assessor.assess(
    {
        "system_id": "claims-triage",
        "jurisdiction": "european_union",
        "domain": "healthcare",
    }
)

print(report.frameworks_assessed)
print(f"Coverage: {report.acgs_lite_total_coverage:.0%}")

HTTP Middleware

from acgs_lite import Constitution
from acgs_lite.middleware import GovernanceASGIMiddleware

constitution = Constitution.from_template("general")
app.add_middleware(
    GovernanceASGIMiddleware,
    constitution=constitution,
    strict=False,
    validate_responses=True,
)

Async Execution

result = await agent.arun("async task")

Key Features

  • Deterministic constitutional validation with YAML rules, regex support, severity levels, merge/diff helpers, and hash verification.
  • MACI role separation with explicit proposer, validator, executor, and observer boundaries.
  • Compliance helpers spanning EU AI Act, NIST AI RMF, ISO 42001, SOC 2 + AI, HIPAA
    • AI, GDPR Article 22, ECOA/FCRA, NYC LL 144, and OECD AI.
  • Tamper-evident audit trails with SHA-256 chain verification and telemetry hooks.
  • Optional integrations for Anthropic, OpenAI, LangChain, LiteLLM, Google GenAI, LlamaIndex, AutoGen, MCP, GitLab CI/CD, A2A, CrewAI, and ASGI/FastAPI servers.
  • Constrained output and remediation-oriented retry flows for stricter production governance.

CLI

acgs init
acgs assess --jurisdiction EU
acgs report --pdf
acgs lint rules.yaml
acgs test --fixtures tests.yaml
acgs eu-ai-act --domain healthcare
acgs refusal "approve deployment"
acgs observe "action" --prometheus

License

AGPL-3.0-or-later. Commercial licensing is available for proprietary or SaaS embedding; contact hello@acgs.ai.

Links

Constitutional Hash: 608508a9bd224290

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

acgs_lite-2.5.1.tar.gz (892.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acgs_lite-2.5.1-py3-none-any.whl (697.5 kB view details)

Uploaded Python 3

File details

Details for the file acgs_lite-2.5.1.tar.gz.

File metadata

  • Download URL: acgs_lite-2.5.1.tar.gz
  • Upload date:
  • Size: 892.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for acgs_lite-2.5.1.tar.gz
Algorithm Hash digest
SHA256 1a1bed065a94bd47076675f94f76f1f0c38a524fe72da35fa04a57620c089bda
MD5 0d1090c5f988a33d731841ab0ab6f1fb
BLAKE2b-256 3da5be5829a2fc597a1c49dd5442e272e0638ac25518b3a1bbc0ededc3eb7f8a

See more details on using hashes here.

File details

Details for the file acgs_lite-2.5.1-py3-none-any.whl.

File metadata

  • Download URL: acgs_lite-2.5.1-py3-none-any.whl
  • Upload date:
  • Size: 697.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for acgs_lite-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f50c5a9b041f1997c1f6f4b0799094e4f8aa841c8bf7c7f7c891b92686e905c
MD5 1a444a905597d24725a27e3c9fff97e2
BLAKE2b-256 e0d0dd99038844f0f59c0587801b186e577317dc19115e3119f3193dedc05665

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page