Skip to main content
Pre-release

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

agent-control-spec (Python)

Python binding for the Agent Control Specification runtime: a stateless policy decision engine that plugs into any agent-hooks host as an interceptor.

pip install --pre agent-control-spec
from agent_hooks import InterceptionEmitter, EnforcementMode
from agent_control_spec import AcsInterceptor

emitter = InterceptionEmitter(mode=EnforcementMode.ENFORCE)
emitter.register(AcsInterceptor("manifest.yaml"), "acs")

The manifest binds policies (Rego and Cedar through their built-in evaluators, or test doubles) to interception points; the runtime evaluates each context and returns an agent-hooks verdict. Engine failures never raise into the host loop: they normalize into fail-closed deny verdicts with runtime_error:* reasons.

Activating a policy version

A host that pins a policy version and serves traffic against it wants the expensive work done once, at a moment of its choosing. ActivatedPolicy reads the manifest, loads every Rego module and data document, and compiles the entrypoint each intervention point queries; every later evaluate costs no I/O and no compile.

Compiling is bounded by the eval timeout. A policy too slow to compile in that window activates anyway, not necessarily fully readied, and pays compilation on its first decision instead.

from agent_control_spec import ActivatedPolicy

policy = ActivatedPolicy("manifest.yaml")  # once per policy version
verdict = policy.evaluate("input", context)  # many times, hot path
policy.intervention_points  # what this version governs

The instance is immutable and evaluation releases the GIL, so one instance serves concurrent threads. A policy edit on disk needs a new activation: the host decides when a version changes. Evaluation stays fail-closed, including for a point the version does not bind; only boundary problems (an unknown point name, a context that will not serialize) raise.

A service that keeps manifests and Rego in a database has no directory to point a manifest at. from_memory takes both as values, so nothing is staged to a temporary directory per activation:

policy = ActivatedPolicy.from_memory(
    manifest_yaml,
    {"gate": {"modules": {"gate.rego": rego_source}}},
)

A bundle may also carry data documents, as {"mount": ["limits"], "document": {...}} entries under "data". A Rego policy left naming a relative bundle or data path is rejected: manifest text has no directory of its own, so the path would resolve against the process working directory. Absolute paths are left as written.

Manifests can also be checked on their own, without building a runtime or resolving a policy bundle. Useful when generating or migrating manifests:

from agent_control_spec import ManifestInvalidError, validate_manifest

try:
    validate_manifest(source)
except ManifestInvalidError as error:
    print(error)  # names the offending field

A manifest that uses extends cannot be judged from its own source, because validation checks references across the merged document. Pass a path instead and the chain is resolved first:

from agent_control_spec import validate_manifest_file

validate_manifest_file("manifest.yaml")

supported_manifest_versions() reports the grammar versions this engine accepts. Read it rather than hardcoding the set.

Trust model: a cooperative contract, not a security boundary — the host is fully trusted. See the repository's SECURITY.md.

Benchmark: python sdk/python/bench/activation_bench.py runs against examples/bank_agent, reporting activation cost, first-evaluate cost, warm p50/p95/p99, and a thread-count throughput sweep up to 32.

Docs and spec: https://github.com/responsibleai/agent-control-spec

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_control_spec-0.4.0a2.tar.gz (238.4 kB view details)

Uploaded Source

Built Distribution

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

agent_control_spec-0.4.0a2-cp311-abi3-manylinux_2_34_x86_64.whl (7.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ x86-64

File details

Details for the file agent_control_spec-0.4.0a2.tar.gz.

File metadata

  • Download URL: agent_control_spec-0.4.0a2.tar.gz
  • Upload date:
  • Size: 238.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for agent_control_spec-0.4.0a2.tar.gz
Algorithm Hash digest
SHA256 abe9ae8765542380615300388287af1a5d205eb126837ce0cb9423d4c8bba719
MD5 10ca913c5ec6a7d0d77848bd6d32f5ce
BLAKE2b-256 41c109444d47f16979f1c2fa426b15aec1faa5d2e25d24dcb772822e3a45ac49

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_control_spec-0.4.0a2.tar.gz:

Publisher: release.yml on responsibleai/agent-control-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_control_spec-0.4.0a2-cp311-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for agent_control_spec-0.4.0a2-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bd8dea8c5059d0cc82806f43f634e2b2f49df6275140c8e69153a68d143eab59
MD5 ef00235eff9dcb4c34b4cef42e6275da
BLAKE2b-256 1e02b614416306199c398ee6f8643b71c77ba1d640b89f4017cfd4d252ec5530

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_control_spec-0.4.0a2-cp311-abi3-manylinux_2_34_x86_64.whl:

Publisher: release.yml on responsibleai/agent-control-spec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.0a2 This release

2 files

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