Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ACGP Python SDK

The Python SDK is the canonical runtime implementation for ACGP v1.0-alpha.

Python SDK package version: 1.0.0a7 Protocol claim surface: 1.0.0-alpha.2 Standard Alpha

This is a Python SDK patch release over the current Standard Alpha protocol surface. It does not promote new feature vectors into the frozen standard-alpha claim suite.

Bounded condition paths and observable state

Tripwire expressions support dot identifiers, non-negative array indexes, [*] wildcards, and JSON double-quoted object keys. State predicates keep missing, explicit null, redacted, and truncated values distinct:

condition:
  all_of:
    - expr: is_present(args.items[0].amount)
    - expr: any_match(args.items[*].amount, "gte", 100)
    - expr: is_missing(args.optional_note)

Use is_present, is_missing, is_null, is_redacted, or is_truncated for existential matching and the corresponding all_* form for universal matching. Use any_match or all_match for wildcard comparisons. Empty wildcard selections return false for both quantifiers. Direct wildcard comparisons are rejected, and unavailable/mixed comparison inputs fail closed. See ACGP-4 for the complete grammar, markers, truth table, and evaluation limits.

Use it for:

  • local Standard Profile evaluation
  • server-managed runtime event clients for production adapters
  • conformance testing
  • Python-native agent integrations
  • evaluator-service runtime internals

For v1.0-alpha, the canonical runtime implementation is the Python SDK.

Use the Python SDK when you want local Standard Profile evaluation. Use the Steward/evaluator service when integrating from JavaScript, TypeScript, JVM, Go, or other runtimes.

TypeScript SDK support is under development and will be included in a future release.

Which path should I use?

Situation Recommended path
I want to try ACGP quickly Local Python SDK
I am building a Python agent Local Python SDK
I am integrating a production LangChain/LangGraph agent Adapter StewardMonitor wrapper
I am building a custom production framework adapter Runtime events client
I want to run conformance vectors Local Python SDK
I am building a JavaScript or TypeScript app Evaluator service
I am building a JVM, Go, Rust, or other non-Python service Evaluator service
I need centralized governance and audit persistence Evaluator service
I need production-like deployment Evaluator service
I want TypeScript local runtime support Coming soon

Start here

From the repository root:

python -m venv .venv
source .venv/bin/activate
pip install -e sdk/python-sdk
python sdk/python-sdk/examples/basic_usage.py

From sdk/python-sdk/ directly:

python -m venv .venv
source .venv/bin/activate
pip install -e .
python examples/basic_usage.py

Minimal local evaluation

from acgp import CognitiveTrace, GovernanceSteward
from acgp.state_storage import SQLiteStateStorage

steward = GovernanceSteward(
    blueprint_file="examples/blueprint-standard.yaml",
    conformance_level="standard",
    state_storage=SQLiteStateStorage("acgp-runtime.sqlite"),
    enable_warnings=False,
)

decision = steward.evaluate(
    CognitiveTrace(
        trace_id="trace-001",
        agent_id="urn:acgp:agent:demo:local:001",
        session_id="session-001",
        hook="tool_call",
        context={},
        governance_tier="GT-2",
        reasoning="User wants to buy a $50 item",
        action={"name": "purchase", "parameters": {"amount": 50, "item_id": "ABC123"}},
    )
)

if decision.intervention.value == "block":
    raise RuntimeError(decision.message)

print(decision.intervention.value)

Server-managed runtime events

Production framework adapters should use server-managed runtime events instead of app-owned local monitor/enforce state:

from acgp_langchain import StewardMonitor

agent = StewardMonitor.wrap(
    agent,
    steward_url="https://steward.example.com",
    api_key=STEWARD_API_KEY,
    agent_id="urn:acgp:agent:refund-agent:prod",
    governance_tier="GT-2",
)

Custom frameworks can use RuntimeEventsClient, RuntimeEventPayloadV1, and the runtime ID helpers directly. See RUNTIME_EVENTS.md.

GovernanceSteward remains supported for local/evaluator use. Framework wrappers such as GovernedChain and GovernedGraph are retired from the production path in favor of StewardMonitor, but they remain available for local governance, tests, and migrations.

Standard Alpha conformance

From the repository root:

python conformance/run_conformance.py --suite standard-alpha

Relationship to the evaluator service

The evaluator service wraps the Python SDK behind an HTTP boundary.

Use the evaluator service when integrating from non-Python runtimes or when governance should be backend-owned.

Runtime posture

  • memory: tests only
  • sqlite: local and single-node development only
  • postgres: production runtime-state path

Standard and active decisions require a committed audit record before return. Provide a file-backed SQLite or PostgreSQL state store; an asynchronous logger alone is insufficient. Audit failures raise AuditPersistenceError and must stop the action. See Decision audit durability for storage upgrades, crash guarantees, and recoverable review completion. Identical HITL/appeal retries return the original result and stable permit_id; effect receivers must deduplicate that ID. All review completion requires durable storage, including passive development reviews.

License

MIT

Shadow rule and tripwire conditions use disposable state overlays. Direct StateStorage callbacks and functools.partial wrappers are rebound to those snapshots, including callbacks supplied through trace context. Opaque custom callbacks cannot be isolated and produce a non-enforcing evaluation error instead of executing side effects. Observe checks report when evaluation is skipped. Local enforced decisions and review flags also participate in remote tripwire results, with the strictest intervention retained.

Drained runtime queue events reserve capacity until delivery is settled. The transport settles automatically; manual drain_batch() consumers must call settle_drained() after acknowledgment or requeue_front() for retry. Sender exceptions retain the failed event and unattempted suffix in FIFO order. Retries can deliver an event again when acknowledgment is uncertain. Byte truncation includes extensions and marks removed payloads and the event as truncated.

Runtime transport defaults to fail_open=False: timeout or unavailability stops a declared blockable before-hook. After/error observations remain non-blocking. Explicit fail_open=True permits continuation with a failed_open receipt and no server authorization; strict declared coverage rejects this opt-in.

Release maintainers can build and install exact source-verified distributions with the Python release verification guide. The provenance manifest identifies source and packaging inputs plus wheel/sdist hashes, including dirty source snapshots.

Tier-0 admission and remote verification

TRACE governance_tier must be exactly GT-0, GT-1, GT-2, GT-3, GT-4, or GT-5. Missing values, aliases, whitespace, lowercase spellings, and other types are rejected. The steward rechecks tiers at evaluation admission, including models created with model_construct, copied without validation, or mutated after construction. An optional tier0_remote_verify_min_governance_tier uses the same canonical values and is validated at startup even when Tier-0 is disabled; None means no minimum.

For a Tier-0-only bundle, tier0_remote_sample_rate selects full policy evaluation using fresh cryptographically secure randomness per evaluation, independent of caller trace IDs, actions, and tiers. Rates 0 and 1 mean never and always sample. Intermediate rates are probabilistic: they do not guarantee that a given action or repeated submissions receive full verification. To require verification for every action, force-disable the fast path, use rate 1, or configure an applicable mandatory minimum tier. Sampling is assurance telemetry and selective verification, not retry-proof admission control.

Bounded MCP integration

Install the opt-in extra from this repository checkout on Python 3.10+:

pip install './sdk/python-sdk[mcp]'
from acgp.integrations.mcp import MCPGovernanceAdapter

This adapter supports mcp==2.3.0, MCP protocol 2025-11-25 and Streamable HTTP with a trusted host route and a credential-bearing server that enforces exact-action broker admission. See the MCP guide for the executable local example, receipt recovery and explicit coverage limits. It is an opt-in extension outside frozen Standard Alpha conformance.

Metadata

Release files for acgp 1.0.0a7

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

Source distribution (sdist)

Source distribution for acgp 1.0.0a7
File Size Uploaded Provenance Actions
acgp-1.0.0a7.tar.gz 161.0 kB Without provenance Details for acgp-1.0.0a7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for acgp 1.0.0a7
File Interpreter ABI Platform Actions
acgp-1.0.0a7-py3-none-any.whl Python 3 none any Details for acgp-1.0.0a7-py3-none-any.whl

Total release size: 348.5 kB

Release files / acgp-1.0.0a7.tar.gz

Download URL acgp-1.0.0a7.tar.gz
Size 161.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c0fcd74867ff3f101565a265183a3f205c97c3b8e71d7c4ab2c49b843a6eb579
BLAKE2b-256 checksum
How to use checksums
06919533634d0a953bf27cc1c71ba0947404639f0dac5227abc1e62d84e9a20b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / acgp-1.0.0a7-py3-none-any.whl

Download URL acgp-1.0.0a7-py3-none-any.whl
Size 187.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e1676a3a39ca4f9e2bff3e37aa22896f5f98e3f542e20756a7d4da09e21a773
BLAKE2b-256 checksum
How to use checksums
69097977d5228efe9d1a2e3f630450fb30691242500e525f7874fdc2ce5fca9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for acgp 1.0.0a7

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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