Constitutional Token Governance for AI Agents — ACGS × Auth0 Token Vault
Project description
acgs-auth0
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
MACIScopePolicyandConstitutionalTokenVault.validate(). - Auth0 Token Vault exchange flow with optional step-up handling for elevated scopes.
- Audit primitives including
TokenAuditLogandTokenAccessAuditEntry. - 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file acgs_auth0-0.1.1.tar.gz.
File metadata
- Download URL: acgs_auth0-0.1.1.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
580781d375a41aba5181752b3ce59a28a8dbd342685ae4ecb2f588324f9ddf79
|
|
| MD5 |
d65b1c199ff13d85792a81eed925877e
|
|
| BLAKE2b-256 |
03929d078d7af3db301a39bc772ce6f7023b4cb6a0a5120dc6810c55c4a109a3
|
File details
Details for the file acgs_auth0-0.1.1-py3-none-any.whl.
File metadata
- Download URL: acgs_auth0-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d868594a05e505cf18c5e2c7f49fb525709c3a9bb2a7a533702d42bcfef6ad44
|
|
| MD5 |
b4139d54a066fb377742b90d14df1bbe
|
|
| BLAKE2b-256 |
721f723f50292cff6e4c5591e5a02b57f7f20fb9b0d4bd4f7ecf58f7aa742a1c
|