Skip to main content

acgs-auth0

PyPI Python License: AGPL-3.0

Constitutional token governance for AI agents.

acgs-auth0 bridges Auth0 Token Vault with ACGS MACI governance so the constitution, not the agent, decides which OAuth scopes can be requested. It supports offline pre-flight checks, step-up approval for elevated scopes, and audit logging around every exchange.

Installation

acgs-auth0 supports Python 3.11+.

pip install acgs-auth0
pip install acgs-auth0[langchain]

Quick Start

Define a Scope Policy

# constitution.yaml
token_vault:
  constitutional_hash: "608508a9bd224290"
  connections:
    github:
      EXECUTIVE:
        permitted_scopes: ["read:user", "repo:read"]
        high_risk_scopes: []
      IMPLEMENTER:
        permitted_scopes: ["read:user", "repo:read", "repo:write"]
        high_risk_scopes: ["repo:write"]

Validate and Exchange Tokens

from acgs_auth0 import ConstitutionalTokenVault, MACIScopePolicy
from acgs_auth0.token_vault import TokenVaultRequest

policy = MACIScopePolicy.from_yaml("constitution.yaml")
vault = ConstitutionalTokenVault(policy=policy)

request = TokenVaultRequest(
    agent_id="planner",
    role="EXECUTIVE",
    connection="github",
    scopes=["repo:read"],
    refresh_token="rt_example",
    tool_name="list_issues",
)

validation = vault.validate(request)
assert validation.permitted is True

response = await vault.exchange(request)
print(response.access_token, response.scope)

Step-Up for High-Risk Scopes

request = TokenVaultRequest(
    agent_id="builder",
    role="IMPLEMENTER",
    connection="github",
    scopes=["repo:write"],
    refresh_token="rt_example",
)

validation = vault.validate(request)
print(validation.step_up_required)

Tool Decorator

from acgs_auth0 import get_token_vault_credentials, with_constitutional_token_vault

with_github = with_constitutional_token_vault(
    policy,
    connection="github",
    scopes=["read:user", "repo:read"],
)

@with_github
async def list_issues(repo: str) -> str:
    creds = get_token_vault_credentials()
    return f"using {creds['token_type']} for {repo}"

Configuration

Set these environment variables for live Token Vault exchanges:

Variable Purpose
AUTH0_DOMAIN Auth0 tenant domain
AUTH0_CLIENT_ID Auth0 client ID
AUTH0_CLIENT_SECRET Auth0 client secret

Key Features

  • YAML-driven MACI role-to-scope governance.
  • Offline validation through MACIScopePolicy and ConstitutionalTokenVault.validate().
  • Auth0 Token Vault exchange flow with optional step-up handling for elevated scopes.
  • Audit primitives including TokenAuditLog and TokenAccessAuditEntry.
  • Decorator-based integration for LangChain or plain Python callables.

License

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

Links

Constitutional Hash: 608508a9bd224290

Metadata

Release files for acgs-auth0 0.1.1

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

Source distribution (sdist)

Source distribution for acgs-auth0 0.1.1
File Size Uploaded Provenance Actions
acgs_auth0-0.1.1.tar.gz 21.7 kB Without provenance Details for acgs_auth0-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for acgs-auth0 0.1.1
File Interpreter ABI Platform Actions
acgs_auth0-0.1.1-py3-none-any.whl Python 3 none any Details for acgs_auth0-0.1.1-py3-none-any.whl

Total release size: 41.8 kB

Release files / acgs_auth0-0.1.1.tar.gz

Download URL acgs_auth0-0.1.1.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
580781d375a41aba5181752b3ce59a28a8dbd342685ae4ecb2f588324f9ddf79
BLAKE2b-256 checksum
How to use checksums
03929d078d7af3db301a39bc772ce6f7023b4cb6a0a5120dc6810c55c4a109a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / acgs_auth0-0.1.1-py3-none-any.whl

Download URL acgs_auth0-0.1.1-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d868594a05e505cf18c5e2c7f49fb525709c3a9bb2a7a533702d42bcfef6ad44
BLAKE2b-256 checksum
How to use checksums
721f723f50292cff6e4c5591e5a02b57f7f20fb9b0d4bd4f7ecf58f7aa742a1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for acgs-auth0 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No 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