vectorguard-agentproof 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. vectorguard_agentproof-1.1.0/.gitignore +43 -0
  2. vectorguard_agentproof-1.1.0/LICENSE +21 -0
  3. vectorguard_agentproof-1.1.0/PKG-INFO +493 -0
  4. vectorguard_agentproof-1.1.0/README.md +433 -0
  5. vectorguard_agentproof-1.1.0/pyproject.toml +128 -0
  6. vectorguard_agentproof-1.1.0/src/agentproof/__init__.py +1 -0
  7. vectorguard_agentproof-1.1.0/src/agentproof/agent_builder.py +388 -0
  8. vectorguard_agentproof-1.1.0/src/agentproof/agent_chain.py +304 -0
  9. vectorguard_agentproof-1.1.0/src/agentproof/agent_client.py +106 -0
  10. vectorguard_agentproof-1.1.0/src/agentproof/agent_package.py +129 -0
  11. vectorguard_agentproof-1.1.0/src/agentproof/agent_registry.py +242 -0
  12. vectorguard_agentproof-1.1.0/src/agentproof/agent_remote.py +261 -0
  13. vectorguard_agentproof-1.1.0/src/agentproof/agent_runtime.py +404 -0
  14. vectorguard_agentproof-1.1.0/src/agentproof/agent_verifier.py +591 -0
  15. vectorguard_agentproof-1.1.0/src/agentproof/api.py +1019 -0
  16. vectorguard_agentproof-1.1.0/src/agentproof/api_keys.py +167 -0
  17. vectorguard_agentproof-1.1.0/src/agentproof/assurance.py +46 -0
  18. vectorguard_agentproof-1.1.0/src/agentproof/audit.py +306 -0
  19. vectorguard_agentproof-1.1.0/src/agentproof/billing.py +392 -0
  20. vectorguard_agentproof-1.1.0/src/agentproof/chain/__init__.py +17 -0
  21. vectorguard_agentproof-1.1.0/src/agentproof/chain/anchor_gateway.py +314 -0
  22. vectorguard_agentproof-1.1.0/src/agentproof/chain/circuit_breaker.py +93 -0
  23. vectorguard_agentproof-1.1.0/src/agentproof/chain/evm.py +342 -0
  24. vectorguard_agentproof-1.1.0/src/agentproof/chain/evm_lite.py +448 -0
  25. vectorguard_agentproof-1.1.0/src/agentproof/chain/file_registry.py +80 -0
  26. vectorguard_agentproof-1.1.0/src/agentproof/chain/protocol.py +97 -0
  27. vectorguard_agentproof-1.1.0/src/agentproof/chain/registry.py +112 -0
  28. vectorguard_agentproof-1.1.0/src/agentproof/chain_checkpoint.py +310 -0
  29. vectorguard_agentproof-1.1.0/src/agentproof/challenge.py +284 -0
  30. vectorguard_agentproof-1.1.0/src/agentproof/cli.py +1051 -0
  31. vectorguard_agentproof-1.1.0/src/agentproof/credential_jwt.py +52 -0
  32. vectorguard_agentproof-1.1.0/src/agentproof/credential_store.py +142 -0
  33. vectorguard_agentproof-1.1.0/src/agentproof/crypto/__init__.py +1 -0
  34. vectorguard_agentproof-1.1.0/src/agentproof/crypto/encryption.py +60 -0
  35. vectorguard_agentproof-1.1.0/src/agentproof/crypto/hashing.py +21 -0
  36. vectorguard_agentproof-1.1.0/src/agentproof/crypto/jwt.py +165 -0
  37. vectorguard_agentproof-1.1.0/src/agentproof/crypto/keys.py +129 -0
  38. vectorguard_agentproof-1.1.0/src/agentproof/crypto/sd_jwt.py +244 -0
  39. vectorguard_agentproof-1.1.0/src/agentproof/did/__init__.py +1 -0
  40. vectorguard_agentproof-1.1.0/src/agentproof/did/cache.py +115 -0
  41. vectorguard_agentproof-1.1.0/src/agentproof/did/did_ethr.py +144 -0
  42. vectorguard_agentproof-1.1.0/src/agentproof/did/did_key.py +80 -0
  43. vectorguard_agentproof-1.1.0/src/agentproof/did/did_web.py +118 -0
  44. vectorguard_agentproof-1.1.0/src/agentproof/did/governance.py +291 -0
  45. vectorguard_agentproof-1.1.0/src/agentproof/did/resolver.py +67 -0
  46. vectorguard_agentproof-1.1.0/src/agentproof/did/rotation.py +229 -0
  47. vectorguard_agentproof-1.1.0/src/agentproof/dispute.py +197 -0
  48. vectorguard_agentproof-1.1.0/src/agentproof/distributed_lock.py +171 -0
  49. vectorguard_agentproof-1.1.0/src/agentproof/domain_link.py +211 -0
  50. vectorguard_agentproof-1.1.0/src/agentproof/dpop.py +170 -0
  51. vectorguard_agentproof-1.1.0/src/agentproof/events.py +358 -0
  52. vectorguard_agentproof-1.1.0/src/agentproof/fees.py +127 -0
  53. vectorguard_agentproof-1.1.0/src/agentproof/holder.py +64 -0
  54. vectorguard_agentproof-1.1.0/src/agentproof/hosted_did.py +132 -0
  55. vectorguard_agentproof-1.1.0/src/agentproof/hsm_signer.py +90 -0
  56. vectorguard_agentproof-1.1.0/src/agentproof/http_signatures.py +458 -0
  57. vectorguard_agentproof-1.1.0/src/agentproof/issuer.py +268 -0
  58. vectorguard_agentproof-1.1.0/src/agentproof/key_store.py +384 -0
  59. vectorguard_agentproof-1.1.0/src/agentproof/ledger_mirror.py +278 -0
  60. vectorguard_agentproof-1.1.0/src/agentproof/mcp.py +51 -0
  61. vectorguard_agentproof-1.1.0/src/agentproof/merchant.py +181 -0
  62. vectorguard_agentproof-1.1.0/src/agentproof/metrics.py +68 -0
  63. vectorguard_agentproof-1.1.0/src/agentproof/models/__init__.py +1 -0
  64. vectorguard_agentproof-1.1.0/src/agentproof/models/agent.py +256 -0
  65. vectorguard_agentproof-1.1.0/src/agentproof/models/agent_api.py +355 -0
  66. vectorguard_agentproof-1.1.0/src/agentproof/models/agent_registry.py +51 -0
  67. vectorguard_agentproof-1.1.0/src/agentproof/models/api.py +916 -0
  68. vectorguard_agentproof-1.1.0/src/agentproof/models/api_key.py +33 -0
  69. vectorguard_agentproof-1.1.0/src/agentproof/models/billing.py +165 -0
  70. vectorguard_agentproof-1.1.0/src/agentproof/models/credential.py +137 -0
  71. vectorguard_agentproof-1.1.0/src/agentproof/models/did_document.py +60 -0
  72. vectorguard_agentproof-1.1.0/src/agentproof/models/dispute.py +31 -0
  73. vectorguard_agentproof-1.1.0/src/agentproof/models/fee.py +40 -0
  74. vectorguard_agentproof-1.1.0/src/agentproof/models/policy.py +15 -0
  75. vectorguard_agentproof-1.1.0/src/agentproof/models/presentation.py +40 -0
  76. vectorguard_agentproof-1.1.0/src/agentproof/models/rbac.py +108 -0
  77. vectorguard_agentproof-1.1.0/src/agentproof/models/reputation.py +59 -0
  78. vectorguard_agentproof-1.1.0/src/agentproof/models/schemas.py +246 -0
  79. vectorguard_agentproof-1.1.0/src/agentproof/models/status.py +39 -0
  80. vectorguard_agentproof-1.1.0/src/agentproof/models/status_list.py +120 -0
  81. vectorguard_agentproof-1.1.0/src/agentproof/models/tenant.py +127 -0
  82. vectorguard_agentproof-1.1.0/src/agentproof/models/trust.py +99 -0
  83. vectorguard_agentproof-1.1.0/src/agentproof/models/webhook.py +28 -0
  84. vectorguard_agentproof-1.1.0/src/agentproof/net_safety.py +181 -0
  85. vectorguard_agentproof-1.1.0/src/agentproof/oauth_as.py +582 -0
  86. vectorguard_agentproof-1.1.0/src/agentproof/oauth_client.py +153 -0
  87. vectorguard_agentproof-1.1.0/src/agentproof/oauth_rs.py +276 -0
  88. vectorguard_agentproof-1.1.0/src/agentproof/pg/__init__.py +36 -0
  89. vectorguard_agentproof-1.1.0/src/agentproof/pg/agent_registry.py +167 -0
  90. vectorguard_agentproof-1.1.0/src/agentproof/pg/api_keys.py +109 -0
  91. vectorguard_agentproof-1.1.0/src/agentproof/pg/attestation.py +208 -0
  92. vectorguard_agentproof-1.1.0/src/agentproof/pg/audit.py +310 -0
  93. vectorguard_agentproof-1.1.0/src/agentproof/pg/credential_store.py +104 -0
  94. vectorguard_agentproof-1.1.0/src/agentproof/pg/dispute.py +197 -0
  95. vectorguard_agentproof-1.1.0/src/agentproof/pg/fees.py +97 -0
  96. vectorguard_agentproof-1.1.0/src/agentproof/pg/key_store.py +159 -0
  97. vectorguard_agentproof-1.1.0/src/agentproof/pg/pool.py +613 -0
  98. vectorguard_agentproof-1.1.0/src/agentproof/pg/rbac.py +139 -0
  99. vectorguard_agentproof-1.1.0/src/agentproof/pg/reputation.py +67 -0
  100. vectorguard_agentproof-1.1.0/src/agentproof/pg/retry.py +71 -0
  101. vectorguard_agentproof-1.1.0/src/agentproof/pg/spend.py +311 -0
  102. vectorguard_agentproof-1.1.0/src/agentproof/pg/status_list.py +138 -0
  103. vectorguard_agentproof-1.1.0/src/agentproof/pg/tenant.py +157 -0
  104. vectorguard_agentproof-1.1.0/src/agentproof/pg/trust.py +230 -0
  105. vectorguard_agentproof-1.1.0/src/agentproof/pg/webhook.py +163 -0
  106. vectorguard_agentproof-1.1.0/src/agentproof/platform.py +112 -0
  107. vectorguard_agentproof-1.1.0/src/agentproof/policy.py +89 -0
  108. vectorguard_agentproof-1.1.0/src/agentproof/rate_limit.py +381 -0
  109. vectorguard_agentproof-1.1.0/src/agentproof/rbac.py +192 -0
  110. vectorguard_agentproof-1.1.0/src/agentproof/receipts.py +122 -0
  111. vectorguard_agentproof-1.1.0/src/agentproof/reputation.py +101 -0
  112. vectorguard_agentproof-1.1.0/src/agentproof/routes/__init__.py +1 -0
  113. vectorguard_agentproof-1.1.0/src/agentproof/routes/_deps.py +297 -0
  114. vectorguard_agentproof-1.1.0/src/agentproof/routes/agent.py +339 -0
  115. vectorguard_agentproof-1.1.0/src/agentproof/routes/agent_builder.py +335 -0
  116. vectorguard_agentproof-1.1.0/src/agentproof/routes/agents.py +540 -0
  117. vectorguard_agentproof-1.1.0/src/agentproof/routes/api_keys.py +228 -0
  118. vectorguard_agentproof-1.1.0/src/agentproof/routes/audit.py +82 -0
  119. vectorguard_agentproof-1.1.0/src/agentproof/routes/billing.py +287 -0
  120. vectorguard_agentproof-1.1.0/src/agentproof/routes/chain_auth.py +314 -0
  121. vectorguard_agentproof-1.1.0/src/agentproof/routes/credentials.py +529 -0
  122. vectorguard_agentproof-1.1.0/src/agentproof/routes/dev.py +76 -0
  123. vectorguard_agentproof-1.1.0/src/agentproof/routes/disputes.py +193 -0
  124. vectorguard_agentproof-1.1.0/src/agentproof/routes/events.py +77 -0
  125. vectorguard_agentproof-1.1.0/src/agentproof/routes/fees.py +91 -0
  126. vectorguard_agentproof-1.1.0/src/agentproof/routes/health.py +88 -0
  127. vectorguard_agentproof-1.1.0/src/agentproof/routes/issuers.py +417 -0
  128. vectorguard_agentproof-1.1.0/src/agentproof/routes/merchants.py +53 -0
  129. vectorguard_agentproof-1.1.0/src/agentproof/routes/oauth.py +167 -0
  130. vectorguard_agentproof-1.1.0/src/agentproof/routes/onboarding.py +217 -0
  131. vectorguard_agentproof-1.1.0/src/agentproof/routes/platform.py +70 -0
  132. vectorguard_agentproof-1.1.0/src/agentproof/routes/portal.py +373 -0
  133. vectorguard_agentproof-1.1.0/src/agentproof/routes/principals.py +91 -0
  134. vectorguard_agentproof-1.1.0/src/agentproof/routes/reputation.py +102 -0
  135. vectorguard_agentproof-1.1.0/src/agentproof/routes/spend.py +135 -0
  136. vectorguard_agentproof-1.1.0/src/agentproof/routes/tenants.py +312 -0
  137. vectorguard_agentproof-1.1.0/src/agentproof/routes/usage.py +89 -0
  138. vectorguard_agentproof-1.1.0/src/agentproof/routes/verification.py +253 -0
  139. vectorguard_agentproof-1.1.0/src/agentproof/routes/webhooks.py +109 -0
  140. vectorguard_agentproof-1.1.0/src/agentproof/routes/workloads.py +53 -0
  141. vectorguard_agentproof-1.1.0/src/agentproof/secret_rotation.py +94 -0
  142. vectorguard_agentproof-1.1.0/src/agentproof/secrets.py +93 -0
  143. vectorguard_agentproof-1.1.0/src/agentproof/security/__init__.py +1 -0
  144. vectorguard_agentproof-1.1.0/src/agentproof/security/pentest.py +351 -0
  145. vectorguard_agentproof-1.1.0/src/agentproof/security/run_pentest.py +99 -0
  146. vectorguard_agentproof-1.1.0/src/agentproof/security/threat_model.py +282 -0
  147. vectorguard_agentproof-1.1.0/src/agentproof/signing_delegation.py +602 -0
  148. vectorguard_agentproof-1.1.0/src/agentproof/spend.py +967 -0
  149. vectorguard_agentproof-1.1.0/src/agentproof/status_list.py +150 -0
  150. vectorguard_agentproof-1.1.0/src/agentproof/tenant.py +156 -0
  151. vectorguard_agentproof-1.1.0/src/agentproof/tracing.py +62 -0
  152. vectorguard_agentproof-1.1.0/src/agentproof/trust.py +256 -0
  153. vectorguard_agentproof-1.1.0/src/agentproof/verifier.py +632 -0
  154. vectorguard_agentproof-1.1.0/src/agentproof/webhook.py +320 -0
  155. vectorguard_agentproof-1.1.0/src/agentproof/workers.py +123 -0
  156. vectorguard_agentproof-1.1.0/src/agentproof/workload.py +137 -0
@@ -0,0 +1,43 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ venv/
11
+ .env
12
+ *.pem
13
+ *.key
14
+ .ruff_cache/
15
+ .pytest_cache/
16
+ .mypy_cache/
17
+ .coverage
18
+ htmlcov/
19
+ node_modules/
20
+ artifacts/
21
+ cache/
22
+ nohup.out
23
+
24
+ # sops / age secrets
25
+ keys.txt
26
+ secrets.json
27
+
28
+ # Generated key files (contain private keys — never commit)
29
+ issuer.json
30
+ subject.json
31
+
32
+ # Issued credential files (contain signed JWTs — never commit)
33
+ credential.json
34
+ kyc.json
35
+ aml.json
36
+
37
+ # Frontend
38
+ # frontend/
39
+ .vercel
40
+
41
+ # Database hardening
42
+ certs/
43
+ backups/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pavon Dunbar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,493 @@
1
+ Metadata-Version: 2.5
2
+ Name: vectorguard-agentproof
3
+ Version: 1.1.0
4
+ Summary: Agent identity: verify which AI agent is calling and which human or business is accountable, using verifiable credentials and signed HTTP requests
5
+ Project-URL: Homepage, https://agentproof.vectorguardlabs.com
6
+ Project-URL: Documentation, https://agentproof.vectorguardlabs.com/docs
7
+ Project-URL: Repository, https://github.com/VectorGuard-Labs/AgentProof
8
+ Project-URL: Issues, https://github.com/VectorGuard-Labs/AgentProof/issues
9
+ Project-URL: Changelog, https://github.com/VectorGuard-Labs/AgentProof/releases
10
+ Project-URL: PyPI, https://pypi.org/project/vectorguard-agentproof/
11
+ Author-email: Pavon Dunbar <pavon@vectorguardlabs.com>
12
+ License-Expression: MIT
13
+ License-File: LICENSE
14
+ Keywords: agent-identity,ai-agents,aml,attestation,blockchain,credential-issuance,credential-verification,decentralized-identity,delegation,did,http-message-signatures,jwt,kyc,sd-jwt,selective-disclosure,trust-registry,verifiable-credentials,w3c
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Security :: Cryptography
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.13
24
+ Requires-Dist: click==8.3.3
25
+ Requires-Dist: cryptography==50.0.2
26
+ Requires-Dist: fastapi==0.136.1
27
+ Requires-Dist: httpx==0.28.1
28
+ Requires-Dist: multiformats==0.3.1.post4
29
+ Requires-Dist: prometheus-client==0.22.1
30
+ Requires-Dist: pycryptodomex==3.23.0
31
+ Requires-Dist: pydantic==2.13.3
32
+ Requires-Dist: pyjwt[crypto]==2.15.1
33
+ Requires-Dist: redis[hiredis]==5.2.1
34
+ Requires-Dist: stripe==11.4.1
35
+ Requires-Dist: uvicorn==0.46.0
36
+ Provides-Extra: dev
37
+ Requires-Dist: hypothesis==6.155.1; extra == 'dev'
38
+ Requires-Dist: mutmut==3.5.0; extra == 'dev'
39
+ Requires-Dist: pip-audit==2.10.1; extra == 'dev'
40
+ Requires-Dist: pytest-asyncio==1.3.0; extra == 'dev'
41
+ Requires-Dist: pytest-cov==7.1.0; extra == 'dev'
42
+ Requires-Dist: pytest==9.2.0; extra == 'dev'
43
+ Requires-Dist: ruff==0.15.12; extra == 'dev'
44
+ Requires-Dist: ty==0.0.49; extra == 'dev'
45
+ Provides-Extra: evm
46
+ Requires-Dist: web3==7.6.0; extra == 'evm'
47
+ Provides-Extra: loadtest
48
+ Requires-Dist: locust==2.32.4; extra == 'loadtest'
49
+ Provides-Extra: pg
50
+ Requires-Dist: alembic==1.15.2; extra == 'pg'
51
+ Requires-Dist: psycopg[binary,pool]==3.2.6; extra == 'pg'
52
+ Requires-Dist: sqlalchemy==2.0.41; extra == 'pg'
53
+ Provides-Extra: tracing
54
+ Requires-Dist: opentelemetry-api==1.33.0; extra == 'tracing'
55
+ Requires-Dist: opentelemetry-exporter-otlp==1.33.0; extra == 'tracing'
56
+ Requires-Dist: opentelemetry-instrumentation-fastapi==0.54b0; extra == 'tracing'
57
+ Requires-Dist: opentelemetry-instrumentation-httpx==0.54b0; extra == 'tracing'
58
+ Requires-Dist: opentelemetry-sdk==1.33.0; extra == 'tracing'
59
+ Description-Content-Type: text/markdown
60
+
61
+ # AgentProof: Identity, Authority and Spend Control for AI Agents
62
+
63
+ [![PyPI version](https://img.shields.io/pypi/v/vectorguard-agentproof)](https://pypi.org/project/vectorguard-agentproof/)
64
+ [![Python 3.13+](https://img.shields.io/badge/python-3.13%2B-blue)](https://www.python.org/downloads/)
65
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
66
+
67
+ AgentProof lets a business delegate real authority, including money, to an AI agent,
68
+ and lets every merchant or API the agent calls check that authority before acting.
69
+
70
+ It answers four questions on every request:
71
+
72
+ 1. **Who is this agent, and who is accountable for it?** The agent signs each HTTP
73
+ request with its own key. AgentProof ties that key to a registered agent and to the
74
+ organization that owns it.
75
+ 2. **What may it do?** The owner signs a delegation that limits scopes, merchants,
76
+ expiry and spending. Sub-agents can only narrow it.
77
+ 3. **May it spend this much, here, now?** The purchase is reserved against every
78
+ budget in the delegation chain in one PostgreSQL transaction, or refused.
79
+ 4. **Can this be proven later?** Every decision returns a signed receipt. Every
80
+ committed money movement is mirrored to VectorLedger as tamper-evident evidence,
81
+ and every security event goes on a hash-chained log with external checkpoints.
82
+
83
+ Revoking an agent or a delegation takes effect on the next request.
84
+
85
+ ```
86
+ owner (business) agent merchant / API
87
+ ──────────────── ───── ──────────────
88
+ registers agent ───────────────▶ holds its own key
89
+ delegates $5,000/day ───────────▶ signs every request ─────────────▶ POST /api/v1/verify-agent
90
+ (scopes, merchants, expiry) (RFC 9421) identity + delegation +
91
+ revocation + budget
92
+ revokes agent ──────────────────────────────────────────────────────▶ next request: DENY
93
+ receipt, ledger, events
94
+ ```
95
+
96
+ **Status.** AgentProof is a pilot candidate, not yet a production-certified financial
97
+ authorization service. The architecture, spend enforcement, recovery drills and
98
+ evidence pipeline are tested (see [Testing](#testing-and-ci)), but an independent
99
+ security review and a design-partner deployment are still to come. See
100
+ [Project status](#project-status).
101
+
102
+ ---
103
+
104
+ ## Contents
105
+
106
+ - [How it works](#how-it-works)
107
+ - [Quick start](#quick-start)
108
+ - [Walkthrough: an agent makes a purchase](#walkthrough-an-agent-makes-a-purchase)
109
+ - [OAuth and MCP](#oauth-and-mcp)
110
+ - [Evidence and accountability](#evidence-and-accountability)
111
+ - [Security model](#security-model)
112
+ - [Running in production](#running-in-production)
113
+ - [API overview](#api-overview)
114
+ - [The credential layer underneath](#the-credential-layer-underneath)
115
+ - [Testing and CI](#testing-and-ci)
116
+ - [Project status](#project-status)
117
+ - [Documentation](#documentation)
118
+
119
+ ---
120
+
121
+ ## How it works
122
+
123
+ | Component | Role |
124
+ |---|---|
125
+ | **AgentProof API** (`agentproof-server`, FastAPI) | Agent registry, delegations, `/verify-agent`, spend lifecycle, OAuth authorization server, receipts, event log. |
126
+ | **PostgreSQL** | **Source of truth.** Authorization and spending enforcement: every reserve, capture, release, refund and expiry is one transaction holding the state change and every budget move. |
127
+ | **VectorLedger** (optional) | **Evidence, not enforcement.** A transactional outbox in PostgreSQL feeds every committed move into VectorLedger's hash-chained ledger, at least once, with reconciliation. Never on the request path. |
128
+ | **PyHSM** (optional, recommended) | Holds the platform root key. It certifies short-lived receipt-signing keys, so receipts don't wait on the HSM. |
129
+ | **Redis** | Replay cache, single-use challenges, rate limits across instances. |
130
+ | **Checkpoint sinks** | Signed heads of the event chains, stored outside the database's control, so a privileged rewrite of history is detectable. |
131
+
132
+ PostgreSQL is the supported production database. YugabyteDB is experimental.
133
+
134
+ Design notes: [spend operations](docs/OPERATIONS_SPEND.md),
135
+ [OAuth design](docs/design/oauth-authorization.md),
136
+ [receipt signing keys](docs/design/receipt-signing-keys.md).
137
+
138
+ ---
139
+
140
+ ## Quick start
141
+
142
+ ```bash
143
+ pip install vectorguard-agentproof # or: pip install -e ".[dev,pg]" from a checkout
144
+ ```
145
+
146
+ Run the full agent-commerce scenario in one process, with real cryptography (Ed25519
147
+ keys, signed credentials, RFC 9421 signatures, signed receipts):
148
+
149
+ ```bash
150
+ python scripts/demo_agent_commerce.py # in-memory ledger
151
+ python scripts/demo_agent_commerce.py --database postgresql://... # PostgreSQL enforcement
152
+ python scripts/demo_agent_commerce.py --database postgresql://... \
153
+ --vectorledger 127.0.0.1:5433 --vl-user admin --vl-password-file ./vl-password
154
+ ```
155
+
156
+ It registers a purchasing agent for Acme, grants it $5,000/day ($1,500 per purchase,
157
+ $2,000/day at one merchant), buys from two merchants, is refused when it exceeds its
158
+ authority, is revoked, and then verifies the evidence.
159
+
160
+ Run the API locally:
161
+
162
+ ```bash
163
+ agentproof_ENV=development agentproof-server # http://localhost:8000
164
+ curl http://localhost:8000/api/v1/health
165
+ ```
166
+
167
+ With a database, set `agentproof_DATABASE_URL` and run `alembic upgrade head` first.
168
+
169
+ ---
170
+
171
+ ## Walkthrough: an agent makes a purchase
172
+
173
+ The full version, with every option, is the
174
+ [Agent Identity guide](docs/guides/agent-identity.md).
175
+
176
+ ### 1. The owner registers the agent
177
+
178
+ The agent generates its own Ed25519 key; AgentProof never sees the private key. The
179
+ agent proves possession by signing a challenge addressed to the owner:
180
+
181
+ ```python
182
+ from agentproof.holder import build_presentation
183
+
184
+ # POST /api/v1/agents/challenge (owner's admin key) -> {"nonce", "audience": owner_did}
185
+ proof = build_presentation(agent_did, [], agent_keypair,
186
+ audience=owner_did, nonce=nonce).proof.jwt
187
+ # POST /api/v1/agents (owner's admin key)
188
+ # {"did": agent_did, "hosted": true, "name": "Purchasing", "agentId": "buyer-001",
189
+ # "ownerDomain": "acme.com", "challenge": nonce, "proof": proof}
190
+ ```
191
+
192
+ The response holds the registry record and a platform-signed registration credential.
193
+ With `hosted: true` the agent gets a `did:web` identity whose keys can be rotated
194
+ without changing the agent.
195
+
196
+ ### 2. The owner delegates authority
197
+
198
+ ```bash
199
+ curl -X POST $API/api/v1/agents/$AGENT_DID/delegations -H "X-API-Key: $OWNER_KEY" -d '{
200
+ "scopes": ["commerce:buy"],
201
+ "expiresInSeconds": 86400,
202
+ "maxDepth": 1,
203
+ "spendLimit": {"amount": "5000", "currency": "USD", "period": "day",
204
+ "maxPerTransaction": "1500",
205
+ "merchantLimits": [{"merchantDid": "did:web:books.example", "amount": "2000"}]},
206
+ "audiences": ["shop.example.com", "books.example"]
207
+ }'
208
+ ```
209
+
210
+ A sub-delegation can only narrow scopes, limits, audiences and expiry. Every link
211
+ with a limit is charged: if Acme gives agent A $10,000/day and A gives B and C
212
+ $7,000/day each, B and C together can never spend more than $10,000 a day.
213
+
214
+ ### 3. The agent signs its requests
215
+
216
+ ```python
217
+ import httpx
218
+ from agentproof.agent_client import AgentAuth, AgentSigner
219
+
220
+ signer = AgentSigner(agent_did, agent_keypair,
221
+ credentials=[registration_jwt, delegation_jwt],
222
+ key_id=f"{agent_did}#key-1")
223
+ async with httpx.AsyncClient(auth=AgentAuth(signer)) as client:
224
+ await client.post("https://shop.example.com/checkout", json={"sku": "abc"})
225
+ ```
226
+
227
+ Signatures follow RFC 9421 (Ed25519) and cover the method, host, path, query and body
228
+ digest, with a nonce and an expiry of at most 5 minutes.
229
+
230
+ ### 4. The merchant verifies and reserves funds
231
+
232
+ A merchant authenticates with an API key bound to a DID that is linked to its domain.
233
+ It forwards the signed request, plus the purchase, to AgentProof:
234
+
235
+ ```bash
236
+ curl -X POST $API/api/v1/verify-agent -H "X-API-Key: $MERCHANT_KEY" -d '{
237
+ "method": "POST", "authority": "shop.example.com", "path": "/checkout",
238
+ "signatureInput": "...", "signature": "...", "credentials": "...",
239
+ "requiredScopes": ["commerce:buy"], "requireRegistered": true,
240
+ "spend": {"amount": "1200.00", "currency": "USD", "reference": "order-8812"}
241
+ }'
242
+ ```
243
+
244
+ The response says `ALLOW` or `DENY` with a reason, names the agent, its owner and
245
+ the delegation used, and includes the reservation and a signed receipt. If any budget
246
+ in the chain is short, nothing is held. Or use the middleware:
247
+
248
+ ```python
249
+ from agentproof.agent_remote import RemoteAgentVerifier
250
+ from agentproof.merchant import AgentIdentityMiddleware
251
+
252
+ app.add_middleware(AgentIdentityMiddleware,
253
+ verifier=RemoteAgentVerifier("https://agentproof.vectorguardlabs.com",
254
+ merchant_api_key,
255
+ required_scopes=["commerce:buy"],
256
+ require_registered=True))
257
+ ```
258
+
259
+ ### 5. Capture, release or refund
260
+
261
+ | Call | Effect |
262
+ |---|---|
263
+ | `POST /api/v1/spend/reservations/{id}/capture` | Take the money; `"final": false` for split shipments. Re-checks revocation first. |
264
+ | `POST /api/v1/spend/reservations/{id}/release` | Return the hold for an abandoned order. |
265
+ | `POST /api/v1/spend/reservations/{id}/refund` | Return captured money to the budgets. |
266
+
267
+ Unused holds expire (15 minutes by default) and a background worker returns them.
268
+ Every call is idempotent by reference.
269
+
270
+ ### 6. Verify a receipt offline
271
+
272
+ ```python
273
+ from agentproof.receipts import verify_receipt
274
+
275
+ body = await verify_receipt(receipt_jwt, resolver, trusted_issuers=[platform_did],
276
+ context=my_merchant_did)
277
+ ```
278
+
279
+ ### 7. The owner revokes the agent
280
+
281
+ ```bash
282
+ curl -X PATCH $API/api/v1/agents/$AGENT_DID/status -H "X-API-Key: $OWNER_KEY" \
283
+ -d '{"status": "REVOKED"}'
284
+ ```
285
+
286
+ The next `/verify-agent` call is denied, outstanding reservations can no longer be
287
+ captured, and OAuth tokens stop being accepted at introspection.
288
+
289
+ ### Or build the agent in AgentProof
290
+
291
+ A company can also design the agent itself in AgentProof: its purpose, instructions,
292
+ AI model (OpenAI or Anthropic, on the company's own account), tools and spending rules.
293
+ AgentProof produces a package the company runs on its own infrastructure. On first
294
+ start the agent generates its key where it runs and enrolls with a one-time token; it
295
+ is registered and receives its delegation automatically. The agent's key and the
296
+ company's AI-provider key never reach AgentProof. See the
297
+ [Agent Builder guide](docs/guides/agent-builder.md).
298
+
299
+ ---
300
+
301
+ ## OAuth and MCP
302
+
303
+ AgentProof is also an OAuth 2.1 authorization server, so MCP servers and APIs that
304
+ accept OAuth tokens can accept AgentProof agents without the SDK:
305
+
306
+ - `client_credentials` with `private_key_jwt` and mandatory DPoP. The agent's DID is
307
+ its client id.
308
+ - Tokens are RFC 9068 JWTs: 5 minutes, one audience, DPoP-bound, no refresh tokens,
309
+ and scopes never wider than the verified delegation.
310
+ - Endpoints: `/.well-known/oauth-authorization-server`, `/oauth/token`,
311
+ `/oauth/introspect`, `/oauth/revoke`, `/oauth/jwks`.
312
+ - MCP tool-level scopes (`agentproof.mcp`): a delegation can grant
313
+ `mcp:tool:search` without granting other tools.
314
+
315
+ Tokens carry identity and scopes only. Spending always goes through a reservation.
316
+
317
+ ---
318
+
319
+ ## Evidence and accountability
320
+
321
+ - **Signed receipts** for every decision. With delegation enabled
322
+ (`agentproof_RECEIPT_KEY_DELEGATION=1`), the PyHSM root key certifies short-lived
323
+ per-tenant keys. Measured with a local PyHSM: 197 purchases/s against 33/s when the
324
+ HSM signs every receipt, with one HSM signature for 600 purchases
325
+ ([benchmarks](docs/BENCHMARKS.md)). Keys rotate automatically and can be revoked
326
+ across all instances (`POST /api/v1/platform/signing-keys/revoke`).
327
+ - **Objective event log**: denials, replays, revocations, spend transitions and admin
328
+ reads. One hash chain per agent, append-only in the database, exportable as a signed
329
+ bundle that verifies offline (`GET /api/v1/agents/{did}/events/export`).
330
+ - **External checkpoints**: the platform key signs the chain heads at intervals and
331
+ writes them to storage outside the database (`agentproof_CHECKPOINT_FILE`, several
332
+ paths for independent copies). A rewritten chain, or a rolled-back checkpoint log,
333
+ is then detected.
334
+ - **VectorLedger mirror**: every committed money movement, delivered at least once
335
+ through the outbox and reconciled hourly. `GET /api/v1/spend/evidence-status` shows
336
+ whether the evidence is in sync, how far behind it is, and when it was last
337
+ reconciled. A purchase is valid once PostgreSQL commits it, whatever the mirror's
338
+ state.
339
+
340
+ ---
341
+
342
+ ## Security model
343
+
344
+ Full list of claims, where each is enforced, the test that backs it, and known
345
+ limitations: [docs/SECURITY_REVIEW_PACKAGE.md](docs/SECURITY_REVIEW_PACKAGE.md).
346
+
347
+ Main properties:
348
+
349
+ - No overspend across a delegation chain, under concurrency and across instances
350
+ (PostgreSQL row locks and `CHECK` constraints; tested with concurrent children and
351
+ grandchildren and a property-based state machine).
352
+ - Each spend operation is all or nothing, including when the process is killed
353
+ mid-transaction.
354
+ - Only `/verify-agent` takes budget; OAuth tokens carry no spend authority.
355
+ - Replay protection on signed requests and DPoP proofs; single-use challenges.
356
+ - Tenant isolation of events, receipts and receipt-signing keys.
357
+ - The application database role cannot alter evidence or un-revoke a receipt key.
358
+ - The root key stays in PyHSM; receipt keys are never written to disk.
359
+
360
+ Report vulnerabilities privately to VectorGuard Labs (not in public issues).
361
+
362
+ ---
363
+
364
+ ## Running in production
365
+
366
+ | Concern | What to set or run |
367
+ |---|---|
368
+ | Database | `agentproof_DATABASE_URL` (PostgreSQL 16, TLS). Run `alembic upgrade head` before deploying. Roles: `scripts/db_roles.sql`. |
369
+ | Platform key | `agentproof_PYHSM_SOCKET`, `agentproof_PYHSM_SECRET_FILE`, `agentproof_PLATFORM_PYHSM_KEY` (or `agentproof_PLATFORM_SIGNING_KEY` without an HSM). |
370
+ | Receipt keys | `agentproof_RECEIPT_KEY_DELEGATION=1`; see [receipt-signing-keys.md](docs/design/receipt-signing-keys.md). |
371
+ | Redis | `agentproof_REDIS_URL` (required outside development: replay cache and challenges fail closed without it). |
372
+ | Evidence | `agentproof_VLEDGER_URL`, `agentproof_VLEDGER_USER`, `agentproof_VLEDGER_PASSWORD`; `agentproof_CHECKPOINT_FILE`. |
373
+ | Audit log | `agentproof_AUDIT_HMAC_SECRET`. |
374
+ | Backups | Encrypted base backups and WAL archive: `scripts/pg-backup.sh`, `scripts/pg-wal-archive.sh`, `scripts/pg-restore.sh` ([DATABASE_HARDENING.md](docs/DATABASE_HARDENING.md)). |
375
+ | Failover | Synchronous standby; drill in `scripts/pg_failover_drill.sh` (no acknowledged purchase lost). |
376
+ | Monitoring | Prometheus metrics and alert rules in `monitoring/alerts.yml`; runbook in [OPERATIONS_SPEND.md](docs/OPERATIONS_SPEND.md). |
377
+
378
+ `docker compose up` starts a development stack (API, YugabyteDB, Redis, Prometheus,
379
+ Grafana, Jaeger, Caddy). It uses YugabyteDB, which is experimental for AgentProof;
380
+ use PostgreSQL for anything beyond local testing. Secrets handling:
381
+ [SECRET_MANAGEMENT.md](docs/SECRET_MANAGEMENT.md).
382
+
383
+ ---
384
+
385
+ ## API overview
386
+
387
+ | Endpoint | Who | Purpose |
388
+ |---|---|---|
389
+ | `POST /api/v1/agents/challenge`, `POST /api/v1/agents` | owner | Register an agent |
390
+ | `POST /api/v1/agents/{did}/delegations` | owner | Delegate authority |
391
+ | `PATCH /api/v1/agents/{did}/status` | owner | Suspend, reactivate or revoke |
392
+ | `POST /api/v1/agents/{did}/keys`, `.../keys/{kid}/revoke` | owner | Rotate or revoke agent keys |
393
+ | `GET /api/v1/agents/{handle}/did.json` | anyone | Hosted agent DID document |
394
+ | `POST /api/v1/agent-blueprints`, `GET`/`PUT`/`DELETE .../{id}` | owner | Design agents (agent builder) |
395
+ | `POST /api/v1/agent-blueprints/{id}/enrollments`, `.../package` | owner | One-time enrollment tokens; downloadable agent package |
396
+ | `POST /api/v1/enrollment/challenge`, `/complete` | agent (enrollment token) | Agent enrolls with its own key |
397
+ | `POST /api/v1/verify-agent` | merchant | Verify a signed request; optionally reserve spend |
398
+ | `POST /api/v1/agent/challenge` | merchant | Single-use challenge for high-value actions |
399
+ | `POST /api/v1/spend/reservations/{id}/capture` \| `release` \| `refund` | merchant | Spend lifecycle |
400
+ | `GET /api/v1/spend/evidence-status` | any key | Evidence mirror status |
401
+ | `POST /api/v1/merchants/domain-link`, `.../verify` | merchant | Bind the merchant DID to its domain |
402
+ | `POST /api/v1/principals/{did}/domain-link`, `.../verify` | owner | Prove control of the owner's domain |
403
+ | `POST /api/v1/merchants/disputes` | merchant | Record a dispute as a fact |
404
+ | `GET /api/v1/agents/{did}/events`, `.../events/export` | owner | Event log and signed export |
405
+ | `GET /api/v1/platform/did.json`, `.../signing-key-revocations` | anyone | Platform keys and revoked receipt keys |
406
+ | `POST /api/v1/platform/signing-keys/revoke` | platform admin | Revoke receipt keys |
407
+ | `/oauth/*`, `/.well-known/oauth-authorization-server` | agents, resource servers | OAuth 2.1 |
408
+ | `GET /api/v1/health`, `/api/v1/health/workers` | monitoring | Health and worker state |
409
+
410
+ Full request and response details: [API-Docs.md](API-Docs.md).
411
+
412
+ ---
413
+
414
+ ## The credential layer underneath
415
+
416
+ AgentProof's registration and delegation credentials are W3C verifiable credentials.
417
+ The same layer provides `did:key`, `did:web` and `did:ethr` resolution, an issuer trust
418
+ registry with tiers, StatusList2021 revocation, optional on-chain attestation
419
+ anchoring (`contracts/AttestationRegistry.sol`), SD-JWT selective disclosure, billing,
420
+ and example KYC, AML and accredited-investor credential types that can back a
421
+ verified organization.
422
+
423
+ That layer and its CLI (`agentproof issue`, `agentproof verify`, ...) are documented in
424
+ [docs/CREDENTIAL_LAYER.md](docs/CREDENTIAL_LAYER.md) and [API-Docs.md](API-Docs.md).
425
+
426
+ ---
427
+
428
+ ## Testing and CI
429
+
430
+ ```bash
431
+ pip install -e ".[dev,pg]"
432
+ pytest -q # without a database: DB tests skip
433
+ export agentproof_TEST_DATABASE_URL=postgresql://user@localhost/agentproof_test
434
+ pytest -q # everything (about 1 minute)
435
+ pytest -m security -q # release-blocking adversarial tests
436
+ PYTHON=python scripts/pg_recovery_drill.sh # encrypted point-in-time recovery
437
+ PYTHON=python scripts/pg_failover_drill.sh # synchronous standby failover
438
+ ```
439
+
440
+ CI (`.github/workflows/ci.yml`) runs lint and type checks against recorded baselines
441
+ (no new findings allowed), a dependency audit, the security suite, the whole suite on
442
+ PostgreSQL 16 with a coverage floor, migration upgrade and rollback, and both drills.
443
+ YugabyteDB runs as a non-blocking experimental job. Policy and baselines:
444
+ [TESTING_POLICY.md](docs/TESTING_POLICY.md).
445
+
446
+ ---
447
+
448
+ ## Project status
449
+
450
+ Done and tested: agent registry and delegation chains, hierarchical spend limits,
451
+ atomic spend operations, the expiry worker, the evidence outbox and reconciliation,
452
+ signed receipts with HSM-certified short-lived keys and shared revocation, event hash
453
+ chains with external checkpoints, OAuth 2.1 with DPoP, encrypted backups, and
454
+ point-in-time recovery and standby failover drills.
455
+
456
+ Not done yet:
457
+
458
+ - An independent security review.
459
+ - Failover and restore drills on a production-sized deployment with production
460
+ secrets and automatic failover (Patroni or a managed service).
461
+ - VectorLedger evidence throughput: about 10 purchases per second per node. Batching
462
+ needs atomic multi-entry posting in VectorLedger, which does not exist yet.
463
+ - YugabyteDB support, which is experimental: the database tests pass on it but are
464
+ about 100 times slower, and the recovery drills are PostgreSQL-only.
465
+ - SPIRE workload attestation is a prototype. It passes against a real SPIRE server and
466
+ agent (`scripts/spire_test_env.sh`, CI job `test-spire`).
467
+ - Test coverage at the 80% target (currently 75.3%).
468
+
469
+ ---
470
+
471
+ ## Documentation
472
+
473
+ | Topic | Document |
474
+ |---|---|
475
+ | Agent identity, delegation and spend, end to end | [docs/guides/agent-identity.md](docs/guides/agent-identity.md) |
476
+ | Designing agents in AgentProof (agent builder) | [docs/guides/agent-builder.md](docs/guides/agent-builder.md) |
477
+ | Spend operations, workers, evidence pipeline, runbook | [docs/OPERATIONS_SPEND.md](docs/OPERATIONS_SPEND.md) |
478
+ | OAuth 2.1 design | [docs/design/oauth-authorization.md](docs/design/oauth-authorization.md) |
479
+ | Receipt signing keys and revocation | [docs/design/receipt-signing-keys.md](docs/design/receipt-signing-keys.md) |
480
+ | Security claims for reviewers | [docs/SECURITY_REVIEW_PACKAGE.md](docs/SECURITY_REVIEW_PACKAGE.md) |
481
+ | Database hardening, backups, restore | [docs/DATABASE_HARDENING.md](docs/DATABASE_HARDENING.md) |
482
+ | Benchmarks | [docs/BENCHMARKS.md](docs/BENCHMARKS.md) |
483
+ | Testing policy and baselines | [docs/TESTING_POLICY.md](docs/TESTING_POLICY.md) |
484
+ | API reference | [API-Docs.md](API-Docs.md) |
485
+ | Credential layer reference | [docs/CREDENTIAL_LAYER.md](docs/CREDENTIAL_LAYER.md) |
486
+
487
+ ## License
488
+
489
+ MIT. See [LICENSE](LICENSE).
490
+
491
+ *A [VectorGuard Labs](https://vectorguardlabs.com) product.*
492
+ **Website:** [agentproof.vectorguardlabs.com](https://agentproof.vectorguardlabs.com) |
493
+ **PyPI:** [pypi.org/project/vectorguard-agentproof](https://pypi.org/project/vectorguard-agentproof/)