arsia-protocol 1.0.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 (147) hide show
  1. arsia_protocol-1.0.0/.gitignore +1 -0
  2. arsia_protocol-1.0.0/LICENSE +140 -0
  3. arsia_protocol-1.0.0/NOTICE +14 -0
  4. arsia_protocol-1.0.0/PKG-INFO +254 -0
  5. arsia_protocol-1.0.0/README.md +198 -0
  6. arsia_protocol-1.0.0/hatch_build.py +64 -0
  7. arsia_protocol-1.0.0/pyproject.toml +123 -0
  8. arsia_protocol-1.0.0/src/arsia_protocol/__init__.py +927 -0
  9. arsia_protocol-1.0.0/src/arsia_protocol/__main__.py +544 -0
  10. arsia_protocol-1.0.0/src/arsia_protocol/_data/profiles/arsia-compliance-profiles.json +166 -0
  11. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-action-descriptor.schema.json +182 -0
  12. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-action-discovery-response.schema.json +252 -0
  13. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-asset-transfer-receipt.schema.json +177 -0
  14. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-asset-transfer-request.schema.json +411 -0
  15. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-asset-transfer-reversal.schema.json +41 -0
  16. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-audit-query-response.schema.json +737 -0
  17. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-audit-record.schema.json +751 -0
  18. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-breach-notification.schema.json +97 -0
  19. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-broker-discovery-request.schema.json +19 -0
  20. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-broker-entry.schema.json +83 -0
  21. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-broker-relay-audit.schema.json +117 -0
  22. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-capability-descriptor.schema.json +55 -0
  23. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-capability-policy.schema.json +69 -0
  24. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-common.schema.json +54 -0
  25. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-compliance-field.schema.json +267 -0
  26. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-compliance-profiles.schema.json +132 -0
  27. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-discovery-response.schema.json +131 -0
  28. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-dora-incident.schema.json +102 -0
  29. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-dpop-proof.schema.json +98 -0
  30. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-escrow-conditions.schema.json +60 -0
  31. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-explanation.schema.json +80 -0
  32. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-identity-record.schema.json +132 -0
  33. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-jwk-entry.schema.json +208 -0
  34. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-jwt-claims.schema.json +157 -0
  35. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-message.schema.json +2023 -0
  36. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-mifid-audit-record.schema.json +289 -0
  37. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-onboarding-decision.schema.json +258 -0
  38. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-state-entry.schema.json +247 -0
  39. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-state-operations.schema.json +940 -0
  40. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-test-vectors.meta.json +208 -0
  41. arsia_protocol-1.0.0/src/arsia_protocol/_data/schemas/arsia-websocket-frame.schema.json +123 -0
  42. arsia_protocol-1.0.0/src/arsia_protocol/_data/test-vectors/arsia-test-vectors.json +16821 -0
  43. arsia_protocol-1.0.0/src/arsia_protocol/_data/test-vectors/keypairs.json +51 -0
  44. arsia_protocol-1.0.0/src/arsia_protocol/_data_resolver.py +64 -0
  45. arsia_protocol-1.0.0/src/arsia_protocol/_errors.py +38 -0
  46. arsia_protocol-1.0.0/src/arsia_protocol/actions/__init__.py +93 -0
  47. arsia_protocol-1.0.0/src/arsia_protocol/actions/actions.py +1286 -0
  48. arsia_protocol-1.0.0/src/arsia_protocol/assets/__init__.py +152 -0
  49. arsia_protocol-1.0.0/src/arsia_protocol/assets/assets.py +3000 -0
  50. arsia_protocol-1.0.0/src/arsia_protocol/core/__init__.py +243 -0
  51. arsia_protocol-1.0.0/src/arsia_protocol/core/authorization.py +1107 -0
  52. arsia_protocol-1.0.0/src/arsia_protocol/core/compliance.py +909 -0
  53. arsia_protocol-1.0.0/src/arsia_protocol/core/encryption.py +179 -0
  54. arsia_protocol-1.0.0/src/arsia_protocol/core/errors.py +772 -0
  55. arsia_protocol-1.0.0/src/arsia_protocol/core/idempotency.py +717 -0
  56. arsia_protocol-1.0.0/src/arsia_protocol/core/message.py +820 -0
  57. arsia_protocol-1.0.0/src/arsia_protocol/core/validation.py +883 -0
  58. arsia_protocol-1.0.0/src/arsia_protocol/core/version.py +193 -0
  59. arsia_protocol-1.0.0/src/arsia_protocol/hazmat/__init__.py +10 -0
  60. arsia_protocol-1.0.0/src/arsia_protocol/hazmat/canonicalization.py +70 -0
  61. arsia_protocol-1.0.0/src/arsia_protocol/hazmat/primitives/__init__.py +4 -0
  62. arsia_protocol-1.0.0/src/arsia_protocol/hazmat/primitives/ecdsa.py +116 -0
  63. arsia_protocol-1.0.0/src/arsia_protocol/hazmat/primitives/ed25519.py +238 -0
  64. arsia_protocol-1.0.0/src/arsia_protocol/hazmat/primitives/jwe.py +271 -0
  65. arsia_protocol-1.0.0/src/arsia_protocol/identity/__init__.py +176 -0
  66. arsia_protocol-1.0.0/src/arsia_protocol/identity/agent_id.py +342 -0
  67. arsia_protocol-1.0.0/src/arsia_protocol/identity/certificates.py +729 -0
  68. arsia_protocol-1.0.0/src/arsia_protocol/identity/discovery.py +618 -0
  69. arsia_protocol-1.0.0/src/arsia_protocol/identity/onboarding.py +1377 -0
  70. arsia_protocol-1.0.0/src/arsia_protocol/py.typed +0 -0
  71. arsia_protocol-1.0.0/src/arsia_protocol/routing/__init__.py +82 -0
  72. arsia_protocol-1.0.0/src/arsia_protocol/routing/routing.py +1307 -0
  73. arsia_protocol-1.0.0/src/arsia_protocol/state/__init__.py +135 -0
  74. arsia_protocol-1.0.0/src/arsia_protocol/state/audit.py +484 -0
  75. arsia_protocol-1.0.0/src/arsia_protocol/state/breach.py +169 -0
  76. arsia_protocol-1.0.0/src/arsia_protocol/state/state.py +1691 -0
  77. arsia_protocol-1.0.0/src/arsia_protocol/types/__init__.py +146 -0
  78. arsia_protocol-1.0.0/src/arsia_protocol/types/actions.py +193 -0
  79. arsia_protocol-1.0.0/src/arsia_protocol/types/assets.py +249 -0
  80. arsia_protocol-1.0.0/src/arsia_protocol/types/breach.py +97 -0
  81. arsia_protocol-1.0.0/src/arsia_protocol/types/compliance.py +134 -0
  82. arsia_protocol-1.0.0/src/arsia_protocol/types/envelope.py +285 -0
  83. arsia_protocol-1.0.0/src/arsia_protocol/types/errors.py +75 -0
  84. arsia_protocol-1.0.0/src/arsia_protocol/types/identity.py +234 -0
  85. arsia_protocol-1.0.0/src/arsia_protocol/types/routing.py +153 -0
  86. arsia_protocol-1.0.0/src/arsia_protocol/types/security.py +62 -0
  87. arsia_protocol-1.0.0/src/arsia_protocol/types/state.py +380 -0
  88. arsia_protocol-1.0.0/tests/adversarial/test_adversarial.py +1558 -0
  89. arsia_protocol-1.0.0/tests/conftest.py +75 -0
  90. arsia_protocol-1.0.0/tests/fixtures/__init__.py +3 -0
  91. arsia_protocol-1.0.0/tests/fixtures/envelopes/.gitkeep +0 -0
  92. arsia_protocol-1.0.0/tests/fixtures/in_memory_idempotency_store.py +164 -0
  93. arsia_protocol-1.0.0/tests/fixtures/keys/.gitkeep +0 -0
  94. arsia_protocol-1.0.0/tests/integration/__init__.py +3 -0
  95. arsia_protocol-1.0.0/tests/integration/test_actions_flow.py +826 -0
  96. arsia_protocol-1.0.0/tests/integration/test_assets_flow.py +339 -0
  97. arsia_protocol-1.0.0/tests/integration/test_e2e_flows.py +866 -0
  98. arsia_protocol-1.0.0/tests/integration/test_e2e_lifecycle.py +1275 -0
  99. arsia_protocol-1.0.0/tests/integration/test_encryption_flow.py +493 -0
  100. arsia_protocol-1.0.0/tests/integration/test_identity_flow.py +625 -0
  101. arsia_protocol-1.0.0/tests/integration/test_routing_flow.py +327 -0
  102. arsia_protocol-1.0.0/tests/integration/test_state_audit_flow.py +268 -0
  103. arsia_protocol-1.0.0/tests/property/__init__.py +3 -0
  104. arsia_protocol-1.0.0/tests/property/test_canonicalization_properties.py +73 -0
  105. arsia_protocol-1.0.0/tests/security/__init__.py +3 -0
  106. arsia_protocol-1.0.0/tests/security/test_security.py +1090 -0
  107. arsia_protocol-1.0.0/tests/smoke/__init__.py +3 -0
  108. arsia_protocol-1.0.0/tests/smoke/test_smoke.py +132 -0
  109. arsia_protocol-1.0.0/tests/unit/hazmat/__init__.py +3 -0
  110. arsia_protocol-1.0.0/tests/unit/hazmat/primitives/__init__.py +3 -0
  111. arsia_protocol-1.0.0/tests/unit/hazmat/primitives/test_ecdsa.py +118 -0
  112. arsia_protocol-1.0.0/tests/unit/hazmat/primitives/test_ed25519.py +296 -0
  113. arsia_protocol-1.0.0/tests/unit/hazmat/test_canonicalization.py +160 -0
  114. arsia_protocol-1.0.0/tests/unit/test_actions_module.py +1467 -0
  115. arsia_protocol-1.0.0/tests/unit/test_assets.py +2463 -0
  116. arsia_protocol-1.0.0/tests/unit/test_audit.py +1105 -0
  117. arsia_protocol-1.0.0/tests/unit/test_authorization.py +1101 -0
  118. arsia_protocol-1.0.0/tests/unit/test_breach.py +218 -0
  119. arsia_protocol-1.0.0/tests/unit/test_c6_must_missing.py +367 -0
  120. arsia_protocol-1.0.0/tests/unit/test_certificates.py +917 -0
  121. arsia_protocol-1.0.0/tests/unit/test_cli.py +415 -0
  122. arsia_protocol-1.0.0/tests/unit/test_compliance_module.py +989 -0
  123. arsia_protocol-1.0.0/tests/unit/test_discovery.py +783 -0
  124. arsia_protocol-1.0.0/tests/unit/test_encryption.py +461 -0
  125. arsia_protocol-1.0.0/tests/unit/test_errors_registry.py +743 -0
  126. arsia_protocol-1.0.0/tests/unit/test_idempotency.py +807 -0
  127. arsia_protocol-1.0.0/tests/unit/test_identity.py +402 -0
  128. arsia_protocol-1.0.0/tests/unit/test_identity_fixes.py +466 -0
  129. arsia_protocol-1.0.0/tests/unit/test_message.py +1110 -0
  130. arsia_protocol-1.0.0/tests/unit/test_module_boundaries.py +428 -0
  131. arsia_protocol-1.0.0/tests/unit/test_onboarding.py +1428 -0
  132. arsia_protocol-1.0.0/tests/unit/test_routing.py +1315 -0
  133. arsia_protocol-1.0.0/tests/unit/test_smoke.py +13 -0
  134. arsia_protocol-1.0.0/tests/unit/test_state.py +1759 -0
  135. arsia_protocol-1.0.0/tests/unit/test_validation.py +1018 -0
  136. arsia_protocol-1.0.0/tests/unit/types/test_actions.py +160 -0
  137. arsia_protocol-1.0.0/tests/unit/types/test_assets.py +167 -0
  138. arsia_protocol-1.0.0/tests/unit/types/test_breach.py +263 -0
  139. arsia_protocol-1.0.0/tests/unit/types/test_compliance.py +156 -0
  140. arsia_protocol-1.0.0/tests/unit/types/test_envelope.py +364 -0
  141. arsia_protocol-1.0.0/tests/unit/types/test_errors.py +176 -0
  142. arsia_protocol-1.0.0/tests/unit/types/test_identity_types.py +189 -0
  143. arsia_protocol-1.0.0/tests/unit/types/test_routing.py +128 -0
  144. arsia_protocol-1.0.0/tests/unit/types/test_security.py +71 -0
  145. arsia_protocol-1.0.0/tests/unit/types/test_state.py +132 -0
  146. arsia_protocol-1.0.0/tests/vectors/__init__.py +4 -0
  147. arsia_protocol-1.0.0/tests/vectors/test_vectors.py +533 -0
@@ -0,0 +1 @@
1
+ src/arsia_protocol/_data/
@@ -0,0 +1,140 @@
1
+ # Business Source License 1.1
2
+
3
+ ## Parameters
4
+
5
+ ```
6
+ Licensor: Arsia Tecnologia Unipessoal Lda
7
+
8
+ Licensed Work: ARSIA Protocol SDK, including all Python source code,
9
+ tests, examples, documentation, conformance runner,
10
+ build configuration, and automation code contained
11
+ in this repository, whether distributed as part of
12
+ this repository or otherwise by the Licensor.
13
+
14
+ The Licensed Work does not include the contents of
15
+ the shared/ directory, which contains technical
16
+ interoperability artifacts licensed separately under
17
+ the Apache License 2.0. See shared/LICENSE-ARTIFACTS.md.
18
+
19
+ Copyright: Copyright 2025-2026 Arsia Labs
20
+ (Arsia Tecnologia Unipessoal Lda)
21
+
22
+ Additional Use Grant: You may make production use of the Licensed Work,
23
+ provided that your use does not include offering
24
+ the Licensed Work, modified or unmodified, to third
25
+ parties on a hosted, embedded, managed, packaged, or
26
+ substantially similar basis in order to provide a
27
+ product or service that competes with the Licensor's
28
+ paid products or services.
29
+
30
+ For purposes of this License, a "Competitive Offering"
31
+ means a product, service, SDK, API, platform, hosted
32
+ service, managed service, packaged distribution, or
33
+ substantially similar offering, made available to
34
+ third parties, that substantially overlaps with the
35
+ capabilities of the Licensor's paid products or
36
+ services.
37
+
38
+ Internal use within your organization, including use
39
+ in production systems, is not considered a Competitive
40
+ Offering.
41
+
42
+ For purposes of this License, "your organization"
43
+ includes your company, institution, or legal entity,
44
+ together with entities that control, are controlled by,
45
+ or are under common control with that entity.
46
+
47
+ Contractors, subcontractors, consultants, and service
48
+ providers may use the Licensed Work on your behalf,
49
+ solely for your organization's internal use and subject
50
+ to this License.
51
+
52
+ Development, testing, evaluation, research,
53
+ interoperability, conformance testing, and
54
+ non-production use are permitted.
55
+
56
+ Change Date: Four years from the date of each release
57
+
58
+ Change License: Mozilla Public License Version 2.0 (MPL-2.0),
59
+ without the Exhibit B "Incompatible With Secondary
60
+ Licenses" notice
61
+
62
+ Contact: licensing@arsialabs.ai
63
+ ```
64
+
65
+ ---
66
+
67
+ License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
68
+ "Business Source License" is a trademark of MariaDB plc.
69
+
70
+ ## Terms
71
+
72
+ The Licensor hereby grants you the right to copy, modify, create derivative
73
+ works, redistribute, and make non-production use of the Licensed Work. The
74
+ Licensor may make an Additional Use Grant, above, permitting limited
75
+ production use.
76
+
77
+ Effective on the Change Date, or the fourth anniversary of the first publicly
78
+ available distribution of a specific version of the Licensed Work under this
79
+ License, whichever comes first, the Licensor hereby grants you rights under
80
+ the terms of the Change License, and the rights granted in the paragraph
81
+ above terminate.
82
+
83
+ If your use of the Licensed Work does not comply with the requirements
84
+ currently in effect as described in this License, you must purchase a
85
+ commercial license from the Licensor, its affiliated entities, or authorized
86
+ resellers, or you must refrain from using the Licensed Work.
87
+
88
+ All copies of the original and modified Licensed Work, and derivative works
89
+ of the Licensed Work, are subject to this License. This License applies
90
+ separately for each version of the Licensed Work and the Change Date may vary
91
+ for each version of the Licensed Work released by Licensor.
92
+
93
+ You must conspicuously display this License on each original or modified copy
94
+ of the Licensed Work. If you receive the Licensed Work in original or
95
+ modified form from a third party, the terms and conditions set forth in this
96
+ License apply to your use of that work.
97
+
98
+ Any use of the Licensed Work in violation of this License will automatically
99
+ terminate your rights under this License for the current and all other
100
+ versions of the Licensed Work.
101
+
102
+ This License does not grant you any right in any trademark or logo of
103
+ Licensor or its affiliates (provided that you may use a trademark or logo of
104
+ Licensor as expressly required by this License).
105
+
106
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
107
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
108
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
109
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
110
+ TITLE.
111
+
112
+ MariaDB hereby grants you permission to use this License's text to license
113
+ your works, and to refer to it using the trademark "Business Source License",
114
+ as long as you comply with the Covenants of Licensor below.
115
+
116
+ ## Covenants of Licensor
117
+
118
+ In consideration of the right to use this License's text and the "Business
119
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
120
+ other recipients of the licensed work to be provided by Licensor:
121
+
122
+ To specify as the Change License the GPL Version 2.0 or any later version,
123
+ or a license that is compatible with GPL Version 2.0 or a later version,
124
+ where "compatible" means that software provided under the Change License can
125
+ be included in a program with software provided under GPL Version 2.0 or a
126
+ later version. Licensor may specify additional Change Licenses without
127
+ limitation.
128
+
129
+ To either: (a) specify an additional grant of rights to use that does not
130
+ impose any additional restriction on the right granted in this License, as
131
+ the Additional Use Grant; or (b) insert the text "None" to specify a Change
132
+ Date.
133
+
134
+ Not to modify this License in any other way.
135
+
136
+ ## Notice
137
+
138
+ The Business Source License (this document, or the "License") is not an Open
139
+ Source license. However, the Licensed Work will eventually be made available
140
+ under an Open Source License, as stated in this License.
@@ -0,0 +1,14 @@
1
+ ARSIA Protocol SDK
2
+ Copyright 2025-2026 Arsia Labs (Arsia Tecnologia Unipessoal Lda)
3
+
4
+ This product includes technical interoperability artifacts (schemas,
5
+ compliance profiles, and test vectors) from the ARSIA Protocol specification,
6
+ licensed under the Apache License 2.0.
7
+
8
+ Source: https://github.com/arsialabs/arsia-protocol
9
+ Copyright 2025-2026 Arsia Labs (Arsia Tecnologia Unipessoal Lda)
10
+ Licensed under the Apache License, Version 2.0
11
+ https://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ These artifacts are located in the _data/ directory of the installed package
14
+ and in the shared/ directory of the source repository.
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: arsia-protocol
3
+ Version: 1.0.0
4
+ Summary: ARSIA Protocol SDK — EdDSA signing, message types, compliance profiles for autonomous AI agent infrastructure
5
+ Project-URL: Homepage, https://arsiaprotocol.org
6
+ Project-URL: Documentation, https://arsiaprotocol.org
7
+ Project-URL: Repository, https://github.com/arsialabs/arsia-protocol-sdk
8
+ Project-URL: Specification, https://github.com/arsialabs/arsia-protocol
9
+ Project-URL: Changelog, https://github.com/arsialabs/arsia-protocol-sdk/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/arsialabs/arsia-protocol-sdk/issues
11
+ Author-email: Kirk Patrick <kirk@arsialabs.ai>, Greici Savoldi <greici@arsialabs.ai>
12
+ License-Expression: BUSL-1.1
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Keywords: agents,ai-agents,arsia,arsia-protocol,audit,autonomous-agents,compliance,dora,ed25519,eddsa,eu-ai-act,gdpr,jcs,mifid
16
+ Classifier: Development Status :: 3 - Alpha
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Intended Audience :: Financial and Insurance Industry
19
+ Classifier: Intended Audience :: Information Technology
20
+ Classifier: Intended Audience :: Legal Industry
21
+ Classifier: License :: Other/Proprietary License
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Programming Language :: Python :: 3
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Programming Language :: Python :: Implementation :: CPython
27
+ Classifier: Topic :: Security
28
+ Classifier: Topic :: Security :: Cryptography
29
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
+ Classifier: Topic :: System :: Distributed Computing
31
+ Classifier: Typing :: Typed
32
+ Requires-Python: >=3.12
33
+ Requires-Dist: cryptography>=43.0
34
+ Requires-Dist: jsonschema>=4.21.0
35
+ Requires-Dist: pydantic>=2.6.0
36
+ Requires-Dist: rfc8785>=0.1.4
37
+ Provides-Extra: cli
38
+ Requires-Dist: click>=8.0; extra == 'cli'
39
+ Provides-Extra: dev
40
+ Requires-Dist: build>=1.0; extra == 'dev'
41
+ Requires-Dist: click>=8.0; extra == 'dev'
42
+ Requires-Dist: httpx>=0.27.0; extra == 'dev'
43
+ Requires-Dist: hypothesis>=6.100.0; extra == 'dev'
44
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
45
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
46
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
47
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
48
+ Requires-Dist: pyyaml>=6.0; extra == 'dev'
49
+ Requires-Dist: ruff>=0.5.0; extra == 'dev'
50
+ Requires-Dist: types-jsonschema>=4.21.0; extra == 'dev'
51
+ Provides-Extra: docs
52
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
53
+ Requires-Dist: mkdocs<2,>=1.6; extra == 'docs'
54
+ Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
55
+ Description-Content-Type: text/markdown
56
+
57
+ # arsia-protocol — Python SDK
58
+
59
+ Reference Python implementation of the
60
+ [ARSIA Protocol](https://arsiaprotocol.org): the compliance-enforced
61
+ communication layer for autonomous AI agents. The SDK builds, signs,
62
+ verifies, and validates ARSIA message envelopes. It is
63
+ **transport-agnostic** — you choose HTTP, WebSocket, gRPC, MCP, A2A,
64
+ stdio, or anything else.
65
+
66
+ - **License:** BSL 1.1
67
+ - **Python:** ≥ 3.12
68
+ - **Status:** `1.0.0`
69
+ - **Specification:** <https://github.com/arsialabs/arsia-protocol>
70
+
71
+ ## Install
72
+
73
+ ```bash
74
+ pip install arsia-protocol # core SDK
75
+ pip install "arsia-protocol[cli]" # plus the `arsia` CLI
76
+ pip install "arsia-protocol[dev]" # development (tests, mypy, ruff)
77
+ ```
78
+
79
+ ## Quickstart
80
+
81
+ ```python
82
+ from arsia_protocol import (
83
+ create_request, generate_ed25519_keypair, sign_message, verify_message,
84
+ )
85
+
86
+ # 1. Generate an Ed25519 keypair (developer convenience — use an HSM / KMS
87
+ # in production).
88
+ priv, pub = generate_ed25519_keypair()
89
+ kid = "agent:acme.bot#k1"
90
+
91
+ # 2. Build a signed request envelope.
92
+ envelope = create_request(
93
+ from_agent="agent:acme.bot",
94
+ to_agent="agent:other.svc",
95
+ payload_type="com.arsiaprotocol.echo",
96
+ capabilities=["com.arsiaprotocol.echo"],
97
+ args={"msg": "hello"},
98
+ )
99
+ signed = sign_message(envelope, priv, kid)
100
+
101
+ # 3. On the recipient side — verify the signature.
102
+ assert verify_message(signed, pub) is True
103
+ ```
104
+
105
+ ### Validate against schema + semantics
106
+
107
+ ```python
108
+ from arsia_protocol import validate_schema, validate_semantic
109
+
110
+ l1_errors = validate_schema(signed) # L1: JSON Schema (Draft 2020-12)
111
+ l2_errors = validate_semantic(signed) # L2: timestamps, kid match, etc.
112
+ assert l1_errors == [] and l2_errors == []
113
+ ```
114
+
115
+ ### Apply a compliance profile
116
+
117
+ ```python
118
+ from arsia_protocol import apply_profile
119
+
120
+ # The envelope must declare compliance.profile — apply_profile reads it
121
+ # from there and inherits the profile's defaults (retention, jurisdiction, …).
122
+ envelope["compliance"] = {"profile": "GDPR-STANDARD"}
123
+ enriched = apply_profile(envelope) # strict=False by default
124
+ ```
125
+
126
+ ## Documentation
127
+
128
+ | Resource | Description |
129
+ |----------|-------------|
130
+ | [Learning Path](docs/learning-path.md) | Step-by-step guide from install to production |
131
+ | [Concepts](docs/concepts.md) | Mental model: envelopes, lifecycle, naming, profiles |
132
+ | [Cookbook](docs/cookbook.md) | 22 copy-pasteable recipes for common tasks |
133
+ | [Examples](examples/) | 14 runnable scripts (10 basic + 4 regulated use cases) |
134
+ | [API Reference](docs/api/) | Full API documentation (run `mkdocs serve`) |
135
+
136
+ ## Key Concepts
137
+
138
+ ### verify vs. validate
139
+
140
+ | Function | What it checks | Question it answers |
141
+ |----------|---------------|---------------------|
142
+ | `verify_message(envelope, pub_key)` | Ed25519/ES256 signature | "Was this signed by the claimed sender?" |
143
+ | `validate_schema(envelope)` | JSON Schema (Draft 2020-12) | "Does this match the ARSIA envelope structure?" |
144
+ | `validate_semantic(envelope)` | Cross-field rules (timestamps, kid prefix, capabilities) | "Is this envelope internally consistent?" |
145
+ | `validate_envelope(envelope)` | Both schema + semantic (convenience) | "Is this well-formed and consistent?" |
146
+
147
+ A typical receiver calls both: `verify_message()` to trust the sender, then
148
+ `validate_envelope()` to trust the content.
149
+
150
+ ### build_* vs. create_* naming
151
+
152
+ - **`create_*`** (7 functions) — envelope-level factories that produce a
153
+ complete, signable ARSIA envelope: `create_request`, `create_response`,
154
+ `create_error`, `create_event`, `create_pending_approval`,
155
+ `create_approval_decision`, `create_rollback_request`.
156
+
157
+ - **`build_*`** (49 functions) — sub-component builders that produce parts of
158
+ envelopes: audit records, error details, JWKs, state operation arguments,
159
+ discovery documents, etc.
160
+
161
+ Rule of thumb: if it returns a complete envelope ready to sign, it's `create_*`.
162
+ If it returns a component or record, it's `build_*`.
163
+
164
+ ## `arsia` command-line tool
165
+
166
+ Installed with the `cli` extra.
167
+
168
+ ```bash
169
+ arsia --version
170
+ arsia keygen --kid agent:acme.bot#k1 # generate Ed25519 key material
171
+ arsia verify envelope.json --jwk sender.jwk # verify a signed envelope
172
+ arsia canonicalize doc.json # emit RFC 8785 canonical bytes
173
+ arsia inspect envelope.json # pretty-print with diagnostics
174
+ arsia schemas # list bundled JSON Schemas
175
+ arsia vectors # list bundled test vectors
176
+ arsia profiles GDPR-STANDARD # print a compliance profile
177
+ ```
178
+
179
+ The CLI is a thin operator-ergonomics wrapper around the public SDK API.
180
+ It is not a configuration surface for production agents — import the
181
+ SDK directly.
182
+
183
+ ## Module map
184
+
185
+ | Module | Layer | Purpose |
186
+ |--------|-------|---------|
187
+ | `hazmat.canonicalization` | 0 | RFC 8785 JCS (use `rfc8785`; never `json.dumps(sort_keys=True)`) |
188
+ | `hazmat.primitives.ed25519` | 0 | Raw Ed25519 sign / verify / JWK helpers |
189
+ | `version`, `identity` | 0 | Semver parsing, `agent:org.name` validation |
190
+ | `types` | 1 | Pydantic v2 envelope / payload / audit models |
191
+ | `message` | 2 | Envelope factories (`create_request`, …), `sign_message`, `verify_message` |
192
+ | `errors` | 2 | Error-code registry, retry policy, error-envelope builders |
193
+ | `compliance` | 2 | Profile loading (GDPR, EU AI Act, MiFID II, DORA, …), retention floor |
194
+ | `validation` | 3 | L1 schema + L2 semantic validation |
195
+ | `actions` | 4 | Capability model, reserved prefixes, oversight, explainability |
196
+ | `state` | 4 | State operations, scope taxonomy, GDPR retention |
197
+ | `assets` | 4 | Transfer lifecycle, escrow, MiFID II, DORA, PSD2 SCA |
198
+ | `routing` | 4 | Topology determination, broker discovery, retry / lifecycle |
199
+ | `discovery` | 4 | Discovery document + JWKS builders |
200
+ | `authorization` | 4 | JWT + DPoP, scope coverage, JWK thumbprint |
201
+ | `certificates` | 4 | X.509 trust levels L1 / L2 / L3 |
202
+ | `onboarding` | 4 | External agent onboarding flow |
203
+ | `audit` | 5 | Audit record builders, payload hash, immutability |
204
+ | `idempotency` | 5 | Store protocol, duplicate detection, scope helpers |
205
+ | `__main__` | 6 | `arsia` CLI (optional dep) |
206
+
207
+ Primitive modules never import transport libraries (`httpx`, `fastapi`,
208
+ `websockets`). Boundary rules are enforced by
209
+ `tests/unit/test_module_boundaries.py`.
210
+
211
+ ## What the SDK does NOT do
212
+
213
+ - Transport (HTTP, WebSocket, MCP, A2A) — that's
214
+ `arsiactl`, not the SDK.
215
+ - Agent execution, planning, tool use — that's the agent framework.
216
+ - Audit trail storage — that's the server (`arsiactl`). The SDK
217
+ builds audit records; it does not persist them.
218
+ - OAuth2 issuance — the SDK validates tokens, does not issue them.
219
+ - Payload interpretation — the SDK signs and verifies envelopes; it
220
+ never inspects payload content beyond routing-relevant fields.
221
+
222
+ ## Development
223
+
224
+ ```bash
225
+ cd python
226
+ pip install -e ".[dev]"
227
+ pytest tests/ -v
228
+ mypy src/arsia_protocol/
229
+ ruff check src/
230
+ ruff format src/
231
+ python -m build
232
+ ```
233
+
234
+ Cross-language conformance lives at
235
+ `../conformance/runners/python/` and is installed separately:
236
+
237
+ ```bash
238
+ cd ../conformance/runners/python
239
+ pip install -e .
240
+ python -m arsia_conformance
241
+ ```
242
+
243
+ ## Links
244
+
245
+ - **Specification:** <https://github.com/arsialabs/arsia-protocol>
246
+ - **SDKs repo:** <https://github.com/arsialabs/arsia-protocol-sdk>
247
+ - **Website:** <https://arsiaprotocol.org>
248
+ - **Issues:** <https://github.com/arsialabs/arsia-protocol-sdk/issues>
249
+ - **Changelog:** [`CHANGELOG.md`](../CHANGELOG.md)
250
+
251
+ ---
252
+
253
+ ARSIA Protocol ([arsiaprotocol.org](https://arsiaprotocol.org)) ·
254
+ by [Arsia Labs](https://arsialabs.ai) · BSL 1.1
@@ -0,0 +1,198 @@
1
+ # arsia-protocol — Python SDK
2
+
3
+ Reference Python implementation of the
4
+ [ARSIA Protocol](https://arsiaprotocol.org): the compliance-enforced
5
+ communication layer for autonomous AI agents. The SDK builds, signs,
6
+ verifies, and validates ARSIA message envelopes. It is
7
+ **transport-agnostic** — you choose HTTP, WebSocket, gRPC, MCP, A2A,
8
+ stdio, or anything else.
9
+
10
+ - **License:** BSL 1.1
11
+ - **Python:** ≥ 3.12
12
+ - **Status:** `1.0.0`
13
+ - **Specification:** <https://github.com/arsialabs/arsia-protocol>
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pip install arsia-protocol # core SDK
19
+ pip install "arsia-protocol[cli]" # plus the `arsia` CLI
20
+ pip install "arsia-protocol[dev]" # development (tests, mypy, ruff)
21
+ ```
22
+
23
+ ## Quickstart
24
+
25
+ ```python
26
+ from arsia_protocol import (
27
+ create_request, generate_ed25519_keypair, sign_message, verify_message,
28
+ )
29
+
30
+ # 1. Generate an Ed25519 keypair (developer convenience — use an HSM / KMS
31
+ # in production).
32
+ priv, pub = generate_ed25519_keypair()
33
+ kid = "agent:acme.bot#k1"
34
+
35
+ # 2. Build a signed request envelope.
36
+ envelope = create_request(
37
+ from_agent="agent:acme.bot",
38
+ to_agent="agent:other.svc",
39
+ payload_type="com.arsiaprotocol.echo",
40
+ capabilities=["com.arsiaprotocol.echo"],
41
+ args={"msg": "hello"},
42
+ )
43
+ signed = sign_message(envelope, priv, kid)
44
+
45
+ # 3. On the recipient side — verify the signature.
46
+ assert verify_message(signed, pub) is True
47
+ ```
48
+
49
+ ### Validate against schema + semantics
50
+
51
+ ```python
52
+ from arsia_protocol import validate_schema, validate_semantic
53
+
54
+ l1_errors = validate_schema(signed) # L1: JSON Schema (Draft 2020-12)
55
+ l2_errors = validate_semantic(signed) # L2: timestamps, kid match, etc.
56
+ assert l1_errors == [] and l2_errors == []
57
+ ```
58
+
59
+ ### Apply a compliance profile
60
+
61
+ ```python
62
+ from arsia_protocol import apply_profile
63
+
64
+ # The envelope must declare compliance.profile — apply_profile reads it
65
+ # from there and inherits the profile's defaults (retention, jurisdiction, …).
66
+ envelope["compliance"] = {"profile": "GDPR-STANDARD"}
67
+ enriched = apply_profile(envelope) # strict=False by default
68
+ ```
69
+
70
+ ## Documentation
71
+
72
+ | Resource | Description |
73
+ |----------|-------------|
74
+ | [Learning Path](docs/learning-path.md) | Step-by-step guide from install to production |
75
+ | [Concepts](docs/concepts.md) | Mental model: envelopes, lifecycle, naming, profiles |
76
+ | [Cookbook](docs/cookbook.md) | 22 copy-pasteable recipes for common tasks |
77
+ | [Examples](examples/) | 14 runnable scripts (10 basic + 4 regulated use cases) |
78
+ | [API Reference](docs/api/) | Full API documentation (run `mkdocs serve`) |
79
+
80
+ ## Key Concepts
81
+
82
+ ### verify vs. validate
83
+
84
+ | Function | What it checks | Question it answers |
85
+ |----------|---------------|---------------------|
86
+ | `verify_message(envelope, pub_key)` | Ed25519/ES256 signature | "Was this signed by the claimed sender?" |
87
+ | `validate_schema(envelope)` | JSON Schema (Draft 2020-12) | "Does this match the ARSIA envelope structure?" |
88
+ | `validate_semantic(envelope)` | Cross-field rules (timestamps, kid prefix, capabilities) | "Is this envelope internally consistent?" |
89
+ | `validate_envelope(envelope)` | Both schema + semantic (convenience) | "Is this well-formed and consistent?" |
90
+
91
+ A typical receiver calls both: `verify_message()` to trust the sender, then
92
+ `validate_envelope()` to trust the content.
93
+
94
+ ### build_* vs. create_* naming
95
+
96
+ - **`create_*`** (7 functions) — envelope-level factories that produce a
97
+ complete, signable ARSIA envelope: `create_request`, `create_response`,
98
+ `create_error`, `create_event`, `create_pending_approval`,
99
+ `create_approval_decision`, `create_rollback_request`.
100
+
101
+ - **`build_*`** (49 functions) — sub-component builders that produce parts of
102
+ envelopes: audit records, error details, JWKs, state operation arguments,
103
+ discovery documents, etc.
104
+
105
+ Rule of thumb: if it returns a complete envelope ready to sign, it's `create_*`.
106
+ If it returns a component or record, it's `build_*`.
107
+
108
+ ## `arsia` command-line tool
109
+
110
+ Installed with the `cli` extra.
111
+
112
+ ```bash
113
+ arsia --version
114
+ arsia keygen --kid agent:acme.bot#k1 # generate Ed25519 key material
115
+ arsia verify envelope.json --jwk sender.jwk # verify a signed envelope
116
+ arsia canonicalize doc.json # emit RFC 8785 canonical bytes
117
+ arsia inspect envelope.json # pretty-print with diagnostics
118
+ arsia schemas # list bundled JSON Schemas
119
+ arsia vectors # list bundled test vectors
120
+ arsia profiles GDPR-STANDARD # print a compliance profile
121
+ ```
122
+
123
+ The CLI is a thin operator-ergonomics wrapper around the public SDK API.
124
+ It is not a configuration surface for production agents — import the
125
+ SDK directly.
126
+
127
+ ## Module map
128
+
129
+ | Module | Layer | Purpose |
130
+ |--------|-------|---------|
131
+ | `hazmat.canonicalization` | 0 | RFC 8785 JCS (use `rfc8785`; never `json.dumps(sort_keys=True)`) |
132
+ | `hazmat.primitives.ed25519` | 0 | Raw Ed25519 sign / verify / JWK helpers |
133
+ | `version`, `identity` | 0 | Semver parsing, `agent:org.name` validation |
134
+ | `types` | 1 | Pydantic v2 envelope / payload / audit models |
135
+ | `message` | 2 | Envelope factories (`create_request`, …), `sign_message`, `verify_message` |
136
+ | `errors` | 2 | Error-code registry, retry policy, error-envelope builders |
137
+ | `compliance` | 2 | Profile loading (GDPR, EU AI Act, MiFID II, DORA, …), retention floor |
138
+ | `validation` | 3 | L1 schema + L2 semantic validation |
139
+ | `actions` | 4 | Capability model, reserved prefixes, oversight, explainability |
140
+ | `state` | 4 | State operations, scope taxonomy, GDPR retention |
141
+ | `assets` | 4 | Transfer lifecycle, escrow, MiFID II, DORA, PSD2 SCA |
142
+ | `routing` | 4 | Topology determination, broker discovery, retry / lifecycle |
143
+ | `discovery` | 4 | Discovery document + JWKS builders |
144
+ | `authorization` | 4 | JWT + DPoP, scope coverage, JWK thumbprint |
145
+ | `certificates` | 4 | X.509 trust levels L1 / L2 / L3 |
146
+ | `onboarding` | 4 | External agent onboarding flow |
147
+ | `audit` | 5 | Audit record builders, payload hash, immutability |
148
+ | `idempotency` | 5 | Store protocol, duplicate detection, scope helpers |
149
+ | `__main__` | 6 | `arsia` CLI (optional dep) |
150
+
151
+ Primitive modules never import transport libraries (`httpx`, `fastapi`,
152
+ `websockets`). Boundary rules are enforced by
153
+ `tests/unit/test_module_boundaries.py`.
154
+
155
+ ## What the SDK does NOT do
156
+
157
+ - Transport (HTTP, WebSocket, MCP, A2A) — that's
158
+ `arsiactl`, not the SDK.
159
+ - Agent execution, planning, tool use — that's the agent framework.
160
+ - Audit trail storage — that's the server (`arsiactl`). The SDK
161
+ builds audit records; it does not persist them.
162
+ - OAuth2 issuance — the SDK validates tokens, does not issue them.
163
+ - Payload interpretation — the SDK signs and verifies envelopes; it
164
+ never inspects payload content beyond routing-relevant fields.
165
+
166
+ ## Development
167
+
168
+ ```bash
169
+ cd python
170
+ pip install -e ".[dev]"
171
+ pytest tests/ -v
172
+ mypy src/arsia_protocol/
173
+ ruff check src/
174
+ ruff format src/
175
+ python -m build
176
+ ```
177
+
178
+ Cross-language conformance lives at
179
+ `../conformance/runners/python/` and is installed separately:
180
+
181
+ ```bash
182
+ cd ../conformance/runners/python
183
+ pip install -e .
184
+ python -m arsia_conformance
185
+ ```
186
+
187
+ ## Links
188
+
189
+ - **Specification:** <https://github.com/arsialabs/arsia-protocol>
190
+ - **SDKs repo:** <https://github.com/arsialabs/arsia-protocol-sdk>
191
+ - **Website:** <https://arsiaprotocol.org>
192
+ - **Issues:** <https://github.com/arsialabs/arsia-protocol-sdk/issues>
193
+ - **Changelog:** [`CHANGELOG.md`](../CHANGELOG.md)
194
+
195
+ ---
196
+
197
+ ARSIA Protocol ([arsiaprotocol.org](https://arsiaprotocol.org)) ·
198
+ by [Arsia Labs](https://arsialabs.ai) · BSL 1.1
@@ -0,0 +1,64 @@
1
+ """Hatch build hook — stage shared/ artifacts into src/arsia_protocol/_data/.
2
+
3
+ The SDK's schemas, test vectors, and compliance profiles live in
4
+ ``/shared/`` at the monorepo root so that the Python and TypeScript
5
+ packages share a single source of truth (see CONTRIBUTING.md "Data artifacts").
6
+ Hatchling's ``force-include`` used to pull them into the wheel, but
7
+ that only works when building the wheel directly from source —
8
+ ``python -m build`` chains sdist→wheel, and the extracted sdist has
9
+ no ``../shared/`` to reach.
10
+
11
+ This hook resolves the artifacts at build start and stages them
12
+ inside the Python package tree:
13
+
14
+ * **Source build** (``python -m build --sdist`` or ``--wheel`` run
15
+ from the monorepo): ``../shared/`` exists; copy into ``_data/``.
16
+ The staged copy is included in both targets.
17
+ * **Sdist-extracted build** (second stage of ``python -m build``):
18
+ ``../shared/`` is absent because the sdist root is what used to be
19
+ the ``python/`` directory. The sdist already carries ``_data/``
20
+ from the first-stage copy, so the hook is a no-op.
21
+
22
+ ``_data/`` is git-ignored and recreated on every build — never
23
+ commit it.
24
+ """
25
+
26
+ from __future__ import annotations
27
+
28
+ import shutil
29
+ from pathlib import Path
30
+
31
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
32
+
33
+ _SUBDIRS = ("schemas", "test-vectors", "profiles")
34
+
35
+
36
+ class StageSharedHook(BuildHookInterface):
37
+ PLUGIN_NAME = "stage-shared"
38
+
39
+ def initialize(self, version: str, build_data: dict) -> None:
40
+ root = Path(self.root)
41
+ data_dir = root / "src" / "arsia_protocol" / "_data"
42
+ shared_dir = root.parent / "shared"
43
+
44
+ if shared_dir.is_dir():
45
+ if data_dir.exists():
46
+ shutil.rmtree(data_dir)
47
+ data_dir.mkdir(parents=True, exist_ok=True)
48
+ for sub in _SUBDIRS:
49
+ src = shared_dir / sub
50
+ if not src.is_dir():
51
+ raise FileNotFoundError(
52
+ f"Expected shared artifacts at {src}; "
53
+ f"monorepo layout may have changed."
54
+ )
55
+ shutil.copytree(src, data_dir / sub)
56
+ return
57
+
58
+ missing = [sub for sub in _SUBDIRS if not (data_dir / sub).is_dir()]
59
+ if missing:
60
+ raise FileNotFoundError(
61
+ f"Cannot build: neither ../shared/ nor src/arsia_protocol/_data/ "
62
+ f"contains the required artifacts ({missing}). Run from a source "
63
+ f"checkout or use a complete sdist."
64
+ )