Skip to main content

agentcreds (Python)

Python bindings for AgentCreds - verifiable, attenuable delegation for autonomous AI agents, verified offline.

These bindings wrap the agentcreds-core Rust engine via PyO3/maturin.

A note on async

Every operation in this SDK is synchronous - there is no async/await anywhere in this API. The underlying Rust operations (DID generation, credential issuance/verification, token minting/attenuation/verification, revocation checks) all complete in well under a millisecond, so wrapping them in coroutines would add overhead without benefit. This is a deliberate deviation from async-styled quickstarts you may see elsewhere in the AgentCreds docs.

Installation

pip install agentcreds

(or, building from source: maturin build --release / maturin develop)

Quick start

import agentcreds as ac

# 1. Org trust anchor (in production: keys live in an HSM)
anchor = ac.TrustAnchor.generate()

# 2. Agent enrolled at deploy time
agent = ac.AgentIdentity.create_did_key()

# 3. Issue a capability credential
claims = ac.CapabilityClaims(
    tools=["tool:search", "tool:email"],
    max_delegation_depth=3,
    valid_for_secs=3600,  # valid for 1 hour
)
vc = ac.CapabilityCredential.issue(anchor, agent.did, claims)

# 4. Mint a short-lived runtime token (valid 5 minutes)
scope = ac.Scope(tools=["tool:search"], budget_usd=100, max_depth=2)
token = ac.DelegationToken.mint(vc, scope, 300, agent)

# 5. Verify at every tool call boundary (<1ms)
action = ac.Action("tool:search", "q=agentcreds")
token.verify(action)

# 6. Delegate to a sub-agent (scope can only narrow)
sub_agent = ac.AgentIdentity.create_did_key()
narrow = ac.Scope(tools=["tool:search"], budget_usd=10, max_depth=1)
child_token = token.attenuate(narrow, 60, sub_agent)

Cross-org verification

import agentcreds as ac

# Org B registers Org A's trust anchor (resolved from a TRAIL registry in production)
registry = ac.TrustRegistry()
registry.register(ac.TrustEntry(
    org_a_anchor.did,
    "Organization A",
    org_a_anchor.public_key,
    "verified",
))

# Verify Org A's credential WITHOUT calling back to Org A
entry = registry.verify_credential(vc_from_org_a)
print(f"Verified by {entry.org_name} ({entry.trust_level})")

Revocation

import agentcreds as ac

# Create an OAuth Token Status List (131,072 entries by default)
revocation_list = ac.RevocationList("https://registry.example.com/status/1", anchor)

# Revoke credential at index 42 (propagates in <30s in production)
revocation_list.revoke(42, anchor)

# Check revocation status (<0.1ms, no network call)
assert revocation_list.is_revoked(42)

Error handling

All errors raised by this SDK derive from agentcreds.AgentCredsError:

import agentcreds as ac

try:
    token.verify(ac.Action("tool:delete-everything", ""))
except ac.ActionDeniedError as e:
    print(f"denied: {e}")
except ac.TokenExpiredError as e:
    print(f"expired: {e}")
except ac.AgentCredsError as e:
    print(f"other agentcreds error: {e}")
Exception Raised when
DidError DID resolution, signature, or key-material problems
CredentialError Malformed claims, issuer mismatch, invalid proof
CredentialExpiredError A credential's expiration_date has passed
CredentialRevokedError A credential's index is set in a revocation list
DelegationError Token chain integrity / depth-limit problems
ScopeWideningError An attenuation attempt would widen scope
TokenExpiredError A delegation token (or one of its blocks) has expired
ActionDeniedError The requested tool is not in the leaf block's scope
RevocationError Revocation list index out of bounds / bad signature
SerializationError JSON / CBOR / base64 (de)serialization failure
ValidationError A field value is missing or out of bounds

Type stubs

A agentcreds.pyi stub ships with this package for editor/IDE autocomplete and static type checking (mypy/pyright).

Building

maturin build --release
cargo test --manifest-path ../agentcreds-core/Cargo.toml

License

Apache-2.0

Metadata

Release files for agentcreds 0.2.0

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

Built distributions (wheels)

Table of built distributions (wheels) for agentcreds 0.2.0
File Actions
agentcreds-0.2.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for agentcreds-0.2.0-cp38-abi3-win_amd64.whl
agentcreds-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for agentcreds-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
agentcreds-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for agentcreds-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
agentcreds-0.2.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 Details for agentcreds-0.2.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Total release size: 13.6 MB

Release files / agentcreds-0.2.0-cp38-abi3-win_amd64.whl

Download URL agentcreds-0.2.0-cp38-abi3-win_amd64.whl
Size 2.5 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9a4e119b6bf8e54ce1c179a6a8731624d214b9a0aa09355371eabe789b762f65
BLAKE2b-256 checksum
How to use checksums
f122cd9015ddfef88bafbba81cd22f3a74d3f8a91eb9b9fe2c2ef8b6ee37fcca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

Release files / agentcreds-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL agentcreds-0.2.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.9 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
61162f2af68b5544ff9ed0ead2f65662a5d6f858b0cc16bcdcfbfa44f5e31d74
BLAKE2b-256 checksum
How to use checksums
d13ec7feaac28e59f680ff93ce47af45ec2e30ff7aee317c9c93ccf0e2d306d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

Release files / agentcreds-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL agentcreds-0.2.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.9 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
7eda0c2694f1c7c13435940b3c86a4244d046e42f064c28e0d49d32dea515a91
BLAKE2b-256 checksum
How to use checksums
6785ed66275b70d58cad4f777c22e3a92583d9ec1b0f1157466e4bf46d70e03f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

Release files / agentcreds-0.2.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL agentcreds-0.2.0-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 5.3 MB
Tags CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cd444f9813b83d853bb43ef390a79336bb8d9a12a1d26bb53cb331850b1c51a6
BLAKE2b-256 checksum
How to use checksums
e950dab7f7141b59b645b3bec39f5a279855440da0b1a033f563de49ed6e3755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 22, 2026.

Transparency log

Security for agentcreds 0.2.0

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 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for agentcreds-0.2.0-cp38-abi3-win_amd64.whl

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 Sep 22, 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

4 release files Full provenance

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