atp-profiles (Python)
Fail-closed security profiles for AI agents, from Agent Trust Protocol (ATP). Before an agent runs a tool, map the tool to an action category (shell, filesystem, network, credentials, messaging) and ask the active profile whether the action is allowed, needs approval, or is denied.
This is the Python port of the atp-profiles npm package. The built-in profiles are generated from the TypeScript package. The evaluator is tested against the same shared conformance vectors, so both languages return the same decision and reason for the same input. Version numbers track the npm package whose behaviour this mirrors.
Not to be confused with the unrelated atp-core package on PyPI ("Attested Transport Protocol").
Install
pip install atp-profiles
Python 3.9 or newer. No dependencies.
Use
from atp_profiles import BUILTIN_PROFILES, evaluate_action_with_profile
TOOL_CATEGORIES = {"terminal": "shell", "read_file": "filesystem", "http_get": "network"}
def check(tool_name: str) -> None:
category = TOOL_CATEGORIES.get(tool_name)
result = evaluate_action_with_profile(
BUILTIN_PROFILES["safe-default"],
{"actionType": category, "state": "executing"},
)
if result.decision == "require_approval":
raise PermissionError(f"{tool_name} needs human approval ({result.reason})")
if not result.allowed:
raise PermissionError(f"{tool_name} is denied ({result.reason})")
check("read_file") # passes
check("terminal") # PermissionError: terminal needs human approval (control_blocked)
check("unmapped") # PermissionError: unmapped is denied (unknown_action_type)
Call the check at every tool boundary. Block both deny and require_approval unless your host has a real approval flow.
API
evaluate_action_with_profile(profile, context)returns aProfileEvaluationResultwithallowed,decision("allow" | "deny" | "require_approval") andreason.to_dict()gives the TypeScript JSON shape.contextuses the TypeScript keys:actionType(required),stateorsessionState, and the externally verifiedtrustScore(0 to 1) andmandateVerified. Those two must come from trusted verifiers, never from the agent or the tool call.
BUILTIN_PROFILESis a read-only mapping ofsafe-default,dev-mode,enterprise-lockedandopenclaw-sandbox. Each is also available as a constant, such asSAFE_DEFAULT_PROFILE. A custom profile is a plaindictwith the same schema.
Fails closed
- A missing, unknown or malformed profile returns
deny(reasonunknown_profile) instead of raising. - An
actionTypethat is neither a control category nor named by the active state's policy returnsdeny(unknown_action_type).dev-modereturnsrequire_approvalinstead. - A missing or non-string
actionTypereturnsdeny. - Trust and mandate requirements deny unless a verified score or mandate is supplied.
Scope
A profile is a category and state gate, not an operating-system sandbox. It does not inspect commands, paths or domains, verify identities, or write an audit log. Keep your runtime's own permissions and sandbox in place.
Development
From the repository root:
cd packages/atp-profiles && npm ci && npm run build && node scripts/gen-conformance.mjs --check
cd ../atp-profiles-python && python -m unittest discover -s tests
gen-conformance.mjs regenerates src/atp_profiles/builtin_profiles.json and the shared vectors from the TypeScript package. CI fails if they drift.
License
Apache-2.0. Part of ATP Core.
Metadata
Release files for atp-profiles 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| atp_profiles-3.0.0.tar.gz | 13.0 kB | With provenance | Details for atp_profiles-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| atp_profiles-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for atp_profiles-3.0.0-py3-none-any.whl |
Total release size: 24.8 kB
Release files / atp_profiles-3.0.0.tar.gz
| Download URL | atp_profiles-3.0.0.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1af529b192b2d3df00dd5171c1f6f08497cc18ae184b87f9ce686ee8c7487cf
|
|
BLAKE2b-256 checksum How to use checksums |
4bacd6d0400aeea3e213ff450c9f802231024bce70c39a6b959f3c5186a998cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 5, 2026.
Transparency logRelease files / atp_profiles-3.0.0-py3-none-any.whl
| Download URL | atp_profiles-3.0.0-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2cd20583991fa4b3326fab183e0d86356da623b8142b2213b86c1c9b8e505ade
|
|
BLAKE2b-256 checksum How to use checksums |
547d7ccd957521c5a15c4521760f208a4477623f4beca43567c5b97454e69ca1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 5, 2026.
Transparency logSecurity for atp-profiles 3.0.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
Both files in this release have been uploaded with provenance metadata.
Attestation for atp_profiles-3.0.0.tar.gz
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 Nov 5, 2026.
Transparency logA 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.