authority-runtime 0.3.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.
- authority_runtime-0.3.0/LICENSE +89 -0
- authority_runtime-0.3.0/PKG-INFO +220 -0
- authority_runtime-0.3.0/README.md +171 -0
- authority_runtime-0.3.0/pyproject.toml +92 -0
- authority_runtime-0.3.0/setup.cfg +4 -0
- authority_runtime-0.3.0/src/authority_runtime/__init__.py +139 -0
- authority_runtime-0.3.0/src/authority_runtime/approvals.py +267 -0
- authority_runtime-0.3.0/src/authority_runtime/backends/__init__.py +16 -0
- authority_runtime-0.3.0/src/authority_runtime/backends/memory.py +296 -0
- authority_runtime-0.3.0/src/authority_runtime/backends/slos.py +555 -0
- authority_runtime-0.3.0/src/authority_runtime/cli.py +1405 -0
- authority_runtime-0.3.0/src/authority_runtime/compiler.py +719 -0
- authority_runtime-0.3.0/src/authority_runtime/compliance.py +572 -0
- authority_runtime-0.3.0/src/authority_runtime/constraints.py +124 -0
- authority_runtime-0.3.0/src/authority_runtime/crypto.py +212 -0
- authority_runtime-0.3.0/src/authority_runtime/enforce.py +590 -0
- authority_runtime-0.3.0/src/authority_runtime/envelope.py +575 -0
- authority_runtime-0.3.0/src/authority_runtime/keys.py +212 -0
- authority_runtime-0.3.0/src/authority_runtime/langgraph.py +407 -0
- authority_runtime-0.3.0/src/authority_runtime/logging_config.py +71 -0
- authority_runtime-0.3.0/src/authority_runtime/mcp_server.py +1431 -0
- authority_runtime-0.3.0/src/authority_runtime/policy.py +245 -0
- authority_runtime-0.3.0/src/authority_runtime/roles.py +539 -0
- authority_runtime-0.3.0/src/authority_runtime/shell.py +489 -0
- authority_runtime-0.3.0/src/authority_runtime/storage.py +970 -0
- authority_runtime-0.3.0/src/authority_runtime/types.py +281 -0
- authority_runtime-0.3.0/src/authority_runtime/validation.py +428 -0
- authority_runtime-0.3.0/src/authority_runtime/vault_scope.py +175 -0
- authority_runtime-0.3.0/src/authority_runtime.egg-info/PKG-INFO +220 -0
- authority_runtime-0.3.0/src/authority_runtime.egg-info/SOURCES.txt +53 -0
- authority_runtime-0.3.0/src/authority_runtime.egg-info/dependency_links.txt +1 -0
- authority_runtime-0.3.0/src/authority_runtime.egg-info/entry_points.txt +2 -0
- authority_runtime-0.3.0/src/authority_runtime.egg-info/requires.txt +29 -0
- authority_runtime-0.3.0/src/authority_runtime.egg-info/top_level.txt +1 -0
- authority_runtime-0.3.0/tests/test_archive.py +147 -0
- authority_runtime-0.3.0/tests/test_cli.py +467 -0
- authority_runtime-0.3.0/tests/test_compiler.py +760 -0
- authority_runtime-0.3.0/tests/test_compliance.py +222 -0
- authority_runtime-0.3.0/tests/test_compliance_report.py +238 -0
- authority_runtime-0.3.0/tests/test_constraints.py +347 -0
- authority_runtime-0.3.0/tests/test_envelope.py +429 -0
- authority_runtime-0.3.0/tests/test_hash_chain.py +256 -0
- authority_runtime-0.3.0/tests/test_integration.py +533 -0
- authority_runtime-0.3.0/tests/test_logging.py +102 -0
- authority_runtime-0.3.0/tests/test_mcp_auth.py +149 -0
- authority_runtime-0.3.0/tests/test_mcp_server.py +503 -0
- authority_runtime-0.3.0/tests/test_memory_backend.py +236 -0
- authority_runtime-0.3.0/tests/test_migrations.py +226 -0
- authority_runtime-0.3.0/tests/test_policy.py +268 -0
- authority_runtime-0.3.0/tests/test_roles.py +352 -0
- authority_runtime-0.3.0/tests/test_scope_matching.py +143 -0
- authority_runtime-0.3.0/tests/test_slos_backend.py +455 -0
- authority_runtime-0.3.0/tests/test_storage.py +374 -0
- authority_runtime-0.3.0/tests/test_validation.py +268 -0
- authority_runtime-0.3.0/tests/test_vault_scope.py +157 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
|
|
6
|
+
Licensor: Tronmongoose LLC
|
|
7
|
+
Licensed Work: Carryall / Authority Runtime 0.3.0 or later.
|
|
8
|
+
The Licensed Work is (c) 2025 Tronmongoose LLC.
|
|
9
|
+
Additional Use Grant: You may make production use of the Licensed Work, provided
|
|
10
|
+
Your use does not include offering the Licensed Work to third
|
|
11
|
+
parties on a hosted or embedded basis in order to compete with
|
|
12
|
+
Tronmongoose's paid version(s) of the Licensed Work. For
|
|
13
|
+
purposes of this license:
|
|
14
|
+
|
|
15
|
+
A "competitive offering" is a Product that is offered to third
|
|
16
|
+
parties on a paid basis, including through paid support
|
|
17
|
+
arrangements, that significantly overlaps with the capabilities
|
|
18
|
+
of Tronmongoose's paid version(s) of the Licensed Work. If Your
|
|
19
|
+
Product is not a competitive offering when You first make it
|
|
20
|
+
generally available, it will not become a competitive offering
|
|
21
|
+
later due to Tronmongoose releasing a new version of the
|
|
22
|
+
Licensed Work with additional capabilities. In addition,
|
|
23
|
+
Products that are not provided on a paid basis are not
|
|
24
|
+
competitive.
|
|
25
|
+
|
|
26
|
+
"Product" means software that is offered to end users to manage
|
|
27
|
+
in their own environments or offered as a service on a hosted
|
|
28
|
+
basis.
|
|
29
|
+
|
|
30
|
+
"Embedded" means including the source code or executable code
|
|
31
|
+
from the Licensed Work in a competitive offering. "Embedded"
|
|
32
|
+
also means packaging the competitive offering in such a way
|
|
33
|
+
that the Licensed Work must be accessed or downloaded for the
|
|
34
|
+
competitive offering to operate.
|
|
35
|
+
|
|
36
|
+
Hosting or using the Licensed Work(s) for internal purposes
|
|
37
|
+
within an organization is not considered a competitive
|
|
38
|
+
offering. Tronmongoose considers your organization to include
|
|
39
|
+
all of your affiliates under common control.
|
|
40
|
+
Change Date: Four years from the date the Licensed Work is published.
|
|
41
|
+
Change License: Apache License, Version 2.0
|
|
42
|
+
|
|
43
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
44
|
+
please contact licensing@tronmongoose.com.
|
|
45
|
+
|
|
46
|
+
Notice
|
|
47
|
+
|
|
48
|
+
Business Source License 1.1
|
|
49
|
+
|
|
50
|
+
Terms
|
|
51
|
+
|
|
52
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
53
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
54
|
+
Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
55
|
+
|
|
56
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
57
|
+
available distribution of a specific version of the Licensed Work under this
|
|
58
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
59
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
60
|
+
above terminate.
|
|
61
|
+
|
|
62
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
63
|
+
currently in effect as described in this License, you must purchase a
|
|
64
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
65
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
66
|
+
|
|
67
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
68
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
69
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
70
|
+
for each version of the Licensed Work released by Licensor.
|
|
71
|
+
|
|
72
|
+
You must conspicuously display this License on each original or modified copy
|
|
73
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
74
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
75
|
+
License apply to your use of that work.
|
|
76
|
+
|
|
77
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
78
|
+
terminate your rights under this License for the current and all other
|
|
79
|
+
versions of the Licensed Work.
|
|
80
|
+
|
|
81
|
+
This License does not grant you any right in any trademark or logo of
|
|
82
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
83
|
+
Licensor as expressly required by this License).
|
|
84
|
+
|
|
85
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
86
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
87
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
88
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
89
|
+
TITLE.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: authority-runtime
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: IAM + Context Control Plane for AI Agents — cryptographic policy enforcement with Ed25519 signed envelopes
|
|
5
|
+
Author-email: Authority Runtime <hello@authority-runtime.dev>
|
|
6
|
+
License: BSL-1.1
|
|
7
|
+
Project-URL: Homepage, https://github.com/tronmongoose/agent.carryall
|
|
8
|
+
Project-URL: Repository, https://github.com/tronmongoose/agent.carryall
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: Other/Proprietary License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: pynacl>=1.5.0
|
|
24
|
+
Requires-Dist: pydantic>=2.0.0
|
|
25
|
+
Requires-Dist: typer>=0.9.0
|
|
26
|
+
Requires-Dist: rich>=13.0.0
|
|
27
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
28
|
+
Requires-Dist: pyyaml>=6.0
|
|
29
|
+
Requires-Dist: pyrage>=1.2.0
|
|
30
|
+
Provides-Extra: llm
|
|
31
|
+
Requires-Dist: openai<2.0.0,>=1.10.0; extra == "llm"
|
|
32
|
+
Requires-Dist: anthropic>=0.7.0; extra == "llm"
|
|
33
|
+
Provides-Extra: langchain
|
|
34
|
+
Requires-Dist: langchain>=1.0.0; extra == "langchain"
|
|
35
|
+
Requires-Dist: langchain-core>=1.0.0; extra == "langchain"
|
|
36
|
+
Requires-Dist: langchain-openai>=1.0.0; extra == "langchain"
|
|
37
|
+
Requires-Dist: langgraph>=0.2.0; extra == "langchain"
|
|
38
|
+
Provides-Extra: all
|
|
39
|
+
Requires-Dist: authority-runtime[langchain,llm]; extra == "all"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: authority-runtime[all]; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
45
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
46
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
47
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# Authority Runtime
|
|
51
|
+
|
|
52
|
+
**Cryptographic IAM for AI agents** -- scoped, signed, time-limited permissions with a tamper-evident audit trail.
|
|
53
|
+
|
|
54
|
+
[](LICENSE)
|
|
55
|
+
[](https://www.python.org/downloads/)
|
|
56
|
+
[]()
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## The Problem
|
|
61
|
+
|
|
62
|
+
AI agents operate with all-or-nothing permissions. If an agent has an API key, it can do anything with that credential. Traditional auth (OAuth, RBAC, JWT) assumes a human clicked a button -- agents don't click buttons.
|
|
63
|
+
|
|
64
|
+
Authority Runtime creates **cryptographically signed permission envelopes** that scope exactly what an agent can do, enforced at runtime, with a complete audit trail.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Parent Envelope Child Envelope
|
|
68
|
+
|- scopes: [read, write, delete] |- scopes: [read] <- narrowed
|
|
69
|
+
|- context: [user, email, history] |- context: [email] <- narrowed
|
|
70
|
+
|- ttl: 10 minutes |- ttl: 5 minutes <- narrowed
|
|
71
|
+
'- signature: Ed25519(...) '- signature: Ed25519(...)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**The child cannot exceed the parent. Cryptographically enforced.**
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Install
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install authority-runtime
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Quick Start
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from authority_runtime import generate_key_pair, create_simple_envelope, check_envelope
|
|
90
|
+
|
|
91
|
+
# Generate Ed25519 identity
|
|
92
|
+
private_key, public_key = generate_key_pair()
|
|
93
|
+
|
|
94
|
+
# Create a scoped, signed, time-limited envelope
|
|
95
|
+
envelope = create_simple_envelope(
|
|
96
|
+
agent_id="my-agent",
|
|
97
|
+
scopes=["read:users", "write:users"],
|
|
98
|
+
private_key=private_key,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Verify access -- passes
|
|
102
|
+
check_envelope(envelope, public_key, required_scope="read:users")
|
|
103
|
+
|
|
104
|
+
# Verify access -- raises PermissionDenied
|
|
105
|
+
check_envelope(envelope, public_key, required_scope="delete:users")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
See [docs/QUICKSTART.md](docs/QUICKSTART.md) for more examples including `EnforcedTool` runtime blocking and HTML compliance reports.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## What It Does
|
|
113
|
+
|
|
114
|
+
1. **Scope** -- Define exactly which tools and data an agent can access
|
|
115
|
+
2. **Sign** -- Ed25519 signatures make permissions tamper-proof
|
|
116
|
+
3. **Expire** -- TTLs ensure permissions don't persist forever
|
|
117
|
+
4. **Enforce** -- `EnforcedTool` blocks unauthorized actions at runtime
|
|
118
|
+
5. **Audit** -- Every action logged with cryptographic proof
|
|
119
|
+
6. **Verify** -- SHA-256 hash chain on audit trail detects tampering and deletions
|
|
120
|
+
|
|
121
|
+
### Key Features
|
|
122
|
+
|
|
123
|
+
- **YAML policy engine** -- define agent permissions in declarative YAML
|
|
124
|
+
- **Constraint enforcement** -- require_purpose, denied_resources, max_records, require_approval
|
|
125
|
+
- **Wildcard scope matching** -- `vault:*:read` matches `vault:finance:read`
|
|
126
|
+
- **HTML compliance reports** -- negative attestation ("agent never accessed X")
|
|
127
|
+
- **Tamper-evident audit trail** -- SHA-256 hash chain, `carryall audit --verify`
|
|
128
|
+
- **Schema migrations** -- versioned, with automatic backup
|
|
129
|
+
- **MCP server** -- HTTP and stdio transports with Bearer auth + rate limiting
|
|
130
|
+
- **LangGraph integration** -- graph-based agents with automatic permission narrowing
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## CLI
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
carryall init # Initialize ~/.carryall/
|
|
138
|
+
carryall keys generate --agent-id bot # Generate Ed25519 keypair
|
|
139
|
+
carryall mcp serve --transport http # Start MCP server
|
|
140
|
+
carryall audit query # Query audit trail
|
|
141
|
+
carryall audit --verify # Verify hash chain integrity
|
|
142
|
+
carryall compliance report # Generate HTML compliance report
|
|
143
|
+
carryall policy validate policy.yaml # Validate YAML policy
|
|
144
|
+
carryall db status # Check database + migrations
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Edtech FERPA Demo
|
|
150
|
+
|
|
151
|
+
A complete multi-agent demo showing FERPA compliance:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
git clone https://github.com/tronmongoose/carryall-edtech-pilot.git
|
|
155
|
+
cd carryall-edtech-pilot
|
|
156
|
+
pip install authority-runtime
|
|
157
|
+
python -m demo.run
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Demonstrates: agent identity, least privilege, access denial, negative attestation, compliance export. No API keys needed.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Architecture
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Agent Request
|
|
168
|
+
|
|
|
169
|
+
v
|
|
170
|
+
Root Envelope (Ed25519 signed, scoped, time-bounded)
|
|
171
|
+
|
|
|
172
|
+
v
|
|
173
|
+
Policy Engine (YAML policies, constraints, scope matching)
|
|
174
|
+
|
|
|
175
|
+
v
|
|
176
|
+
EnforcedTool (validates signature, checks TTL, verifies scope)
|
|
177
|
+
|
|
|
178
|
+
v
|
|
179
|
+
Audit Trail (SQLite, hash chain, compliance export)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Design Constraints
|
|
185
|
+
|
|
186
|
+
1. **Envelopes are immutable** -- create new ones, don't modify existing
|
|
187
|
+
2. **Children subset Parents** -- authority only narrows, never expands
|
|
188
|
+
3. **TTLs only decrease** -- child can't outlive parent (60s-24h range)
|
|
189
|
+
4. **Signatures are mandatory** -- no unsigned envelopes
|
|
190
|
+
5. **Enforcement is cryptographic** -- can't bypass without private key
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Documentation
|
|
195
|
+
|
|
196
|
+
| Doc | Description |
|
|
197
|
+
|-----|-------------|
|
|
198
|
+
| [Getting Started](docs/QUICKSTART.md) | 5-minute tutorial with 3 progressive examples |
|
|
199
|
+
| [Deployment](docs/DEPLOYMENT.md) | Local, Docker Compose, and Kubernetes |
|
|
200
|
+
| [Configuration](docs/CONFIGURATION.md) | Environment variables, YAML policies, logging |
|
|
201
|
+
| [Changelog](CHANGELOG.md) | Release history |
|
|
202
|
+
| [Security](SECURITY.md) | Vulnerability reporting + architecture |
|
|
203
|
+
| [Contributing](CONTRIBUTING.md) | Development setup + PR process |
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Test Suite
|
|
208
|
+
|
|
209
|
+
182 tests across 15 test files covering envelope operations, scope matching, constraint enforcement, policy engine, compliance reports, hash chain integrity, schema migrations, MCP auth, and structured logging.
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
pytest # Run all tests
|
|
213
|
+
pytest -v -x # Verbose, stop on first failure
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
Business Source License 1.1 - See [LICENSE](LICENSE). Converts to Apache 2.0 after 4 years.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Authority Runtime
|
|
2
|
+
|
|
3
|
+
**Cryptographic IAM for AI agents** -- scoped, signed, time-limited permissions with a tamper-evident audit trail.
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[]()
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The Problem
|
|
12
|
+
|
|
13
|
+
AI agents operate with all-or-nothing permissions. If an agent has an API key, it can do anything with that credential. Traditional auth (OAuth, RBAC, JWT) assumes a human clicked a button -- agents don't click buttons.
|
|
14
|
+
|
|
15
|
+
Authority Runtime creates **cryptographically signed permission envelopes** that scope exactly what an agent can do, enforced at runtime, with a complete audit trail.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Parent Envelope Child Envelope
|
|
19
|
+
|- scopes: [read, write, delete] |- scopes: [read] <- narrowed
|
|
20
|
+
|- context: [user, email, history] |- context: [email] <- narrowed
|
|
21
|
+
|- ttl: 10 minutes |- ttl: 5 minutes <- narrowed
|
|
22
|
+
'- signature: Ed25519(...) '- signature: Ed25519(...)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**The child cannot exceed the parent. Cryptographically enforced.**
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install authority-runtime
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from authority_runtime import generate_key_pair, create_simple_envelope, check_envelope
|
|
41
|
+
|
|
42
|
+
# Generate Ed25519 identity
|
|
43
|
+
private_key, public_key = generate_key_pair()
|
|
44
|
+
|
|
45
|
+
# Create a scoped, signed, time-limited envelope
|
|
46
|
+
envelope = create_simple_envelope(
|
|
47
|
+
agent_id="my-agent",
|
|
48
|
+
scopes=["read:users", "write:users"],
|
|
49
|
+
private_key=private_key,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Verify access -- passes
|
|
53
|
+
check_envelope(envelope, public_key, required_scope="read:users")
|
|
54
|
+
|
|
55
|
+
# Verify access -- raises PermissionDenied
|
|
56
|
+
check_envelope(envelope, public_key, required_scope="delete:users")
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
See [docs/QUICKSTART.md](docs/QUICKSTART.md) for more examples including `EnforcedTool` runtime blocking and HTML compliance reports.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## What It Does
|
|
64
|
+
|
|
65
|
+
1. **Scope** -- Define exactly which tools and data an agent can access
|
|
66
|
+
2. **Sign** -- Ed25519 signatures make permissions tamper-proof
|
|
67
|
+
3. **Expire** -- TTLs ensure permissions don't persist forever
|
|
68
|
+
4. **Enforce** -- `EnforcedTool` blocks unauthorized actions at runtime
|
|
69
|
+
5. **Audit** -- Every action logged with cryptographic proof
|
|
70
|
+
6. **Verify** -- SHA-256 hash chain on audit trail detects tampering and deletions
|
|
71
|
+
|
|
72
|
+
### Key Features
|
|
73
|
+
|
|
74
|
+
- **YAML policy engine** -- define agent permissions in declarative YAML
|
|
75
|
+
- **Constraint enforcement** -- require_purpose, denied_resources, max_records, require_approval
|
|
76
|
+
- **Wildcard scope matching** -- `vault:*:read` matches `vault:finance:read`
|
|
77
|
+
- **HTML compliance reports** -- negative attestation ("agent never accessed X")
|
|
78
|
+
- **Tamper-evident audit trail** -- SHA-256 hash chain, `carryall audit --verify`
|
|
79
|
+
- **Schema migrations** -- versioned, with automatic backup
|
|
80
|
+
- **MCP server** -- HTTP and stdio transports with Bearer auth + rate limiting
|
|
81
|
+
- **LangGraph integration** -- graph-based agents with automatic permission narrowing
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## CLI
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
carryall init # Initialize ~/.carryall/
|
|
89
|
+
carryall keys generate --agent-id bot # Generate Ed25519 keypair
|
|
90
|
+
carryall mcp serve --transport http # Start MCP server
|
|
91
|
+
carryall audit query # Query audit trail
|
|
92
|
+
carryall audit --verify # Verify hash chain integrity
|
|
93
|
+
carryall compliance report # Generate HTML compliance report
|
|
94
|
+
carryall policy validate policy.yaml # Validate YAML policy
|
|
95
|
+
carryall db status # Check database + migrations
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Edtech FERPA Demo
|
|
101
|
+
|
|
102
|
+
A complete multi-agent demo showing FERPA compliance:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git clone https://github.com/tronmongoose/carryall-edtech-pilot.git
|
|
106
|
+
cd carryall-edtech-pilot
|
|
107
|
+
pip install authority-runtime
|
|
108
|
+
python -m demo.run
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Demonstrates: agent identity, least privilege, access denial, negative attestation, compliance export. No API keys needed.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Architecture
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Agent Request
|
|
119
|
+
|
|
|
120
|
+
v
|
|
121
|
+
Root Envelope (Ed25519 signed, scoped, time-bounded)
|
|
122
|
+
|
|
|
123
|
+
v
|
|
124
|
+
Policy Engine (YAML policies, constraints, scope matching)
|
|
125
|
+
|
|
|
126
|
+
v
|
|
127
|
+
EnforcedTool (validates signature, checks TTL, verifies scope)
|
|
128
|
+
|
|
|
129
|
+
v
|
|
130
|
+
Audit Trail (SQLite, hash chain, compliance export)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Design Constraints
|
|
136
|
+
|
|
137
|
+
1. **Envelopes are immutable** -- create new ones, don't modify existing
|
|
138
|
+
2. **Children subset Parents** -- authority only narrows, never expands
|
|
139
|
+
3. **TTLs only decrease** -- child can't outlive parent (60s-24h range)
|
|
140
|
+
4. **Signatures are mandatory** -- no unsigned envelopes
|
|
141
|
+
5. **Enforcement is cryptographic** -- can't bypass without private key
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Documentation
|
|
146
|
+
|
|
147
|
+
| Doc | Description |
|
|
148
|
+
|-----|-------------|
|
|
149
|
+
| [Getting Started](docs/QUICKSTART.md) | 5-minute tutorial with 3 progressive examples |
|
|
150
|
+
| [Deployment](docs/DEPLOYMENT.md) | Local, Docker Compose, and Kubernetes |
|
|
151
|
+
| [Configuration](docs/CONFIGURATION.md) | Environment variables, YAML policies, logging |
|
|
152
|
+
| [Changelog](CHANGELOG.md) | Release history |
|
|
153
|
+
| [Security](SECURITY.md) | Vulnerability reporting + architecture |
|
|
154
|
+
| [Contributing](CONTRIBUTING.md) | Development setup + PR process |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Test Suite
|
|
159
|
+
|
|
160
|
+
182 tests across 15 test files covering envelope operations, scope matching, constraint enforcement, policy engine, compliance reports, hash chain integrity, schema migrations, MCP auth, and structured logging.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pytest # Run all tests
|
|
164
|
+
pytest -v -x # Verbose, stop on first failure
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
Business Source License 1.1 - See [LICENSE](LICENSE). Converts to Apache 2.0 after 4 years.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "authority-runtime"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "IAM + Context Control Plane for AI Agents — cryptographic policy enforcement with Ed25519 signed envelopes"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Authority Runtime", email = "hello@authority-runtime.dev" }
|
|
12
|
+
]
|
|
13
|
+
license = { text = "BSL-1.1" }
|
|
14
|
+
requires-python = ">=3.9"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: Other/Proprietary License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Security",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
# Core dependencies — enough for envelope signing, enforcement, CLI, and in-memory backend
|
|
30
|
+
dependencies = [
|
|
31
|
+
"pynacl>=1.5.0", # Ed25519 signing
|
|
32
|
+
"pydantic>=2.0.0", # Type validation
|
|
33
|
+
"typer>=0.9.0", # CLI framework
|
|
34
|
+
"rich>=13.0.0", # CLI formatting
|
|
35
|
+
"aiohttp>=3.9.0", # HTTP transport for MCP server
|
|
36
|
+
"pyyaml>=6.0", # YAML policy files
|
|
37
|
+
"pyrage>=1.2.0", # age-x25519 encryption at rest for vault documents
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
carryall = "authority_runtime.cli:app"
|
|
42
|
+
|
|
43
|
+
[project.optional-dependencies]
|
|
44
|
+
llm = [
|
|
45
|
+
"openai>=1.10.0,<2.0.0",
|
|
46
|
+
"anthropic>=0.7.0",
|
|
47
|
+
]
|
|
48
|
+
langchain = [
|
|
49
|
+
"langchain>=1.0.0",
|
|
50
|
+
"langchain-core>=1.0.0",
|
|
51
|
+
"langchain-openai>=1.0.0",
|
|
52
|
+
"langgraph>=0.2.0",
|
|
53
|
+
]
|
|
54
|
+
all = [
|
|
55
|
+
"authority-runtime[llm,langchain]",
|
|
56
|
+
]
|
|
57
|
+
dev = [
|
|
58
|
+
"authority-runtime[all]",
|
|
59
|
+
"pytest>=7.0.0",
|
|
60
|
+
"pytest-asyncio>=0.21.0",
|
|
61
|
+
"pytest-cov>=4.0.0",
|
|
62
|
+
"black>=23.0.0",
|
|
63
|
+
"mypy>=1.0.0",
|
|
64
|
+
"ruff>=0.1.0",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[project.urls]
|
|
68
|
+
Homepage = "https://github.com/tronmongoose/agent.carryall"
|
|
69
|
+
Repository = "https://github.com/tronmongoose/agent.carryall"
|
|
70
|
+
|
|
71
|
+
[tool.setuptools.packages.find]
|
|
72
|
+
where = ["src"]
|
|
73
|
+
|
|
74
|
+
[tool.black]
|
|
75
|
+
line-length = 100
|
|
76
|
+
target-version = ['py39']
|
|
77
|
+
|
|
78
|
+
[tool.ruff]
|
|
79
|
+
line-length = 100
|
|
80
|
+
target-version = "py39"
|
|
81
|
+
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
testpaths = ["tests"]
|
|
84
|
+
python_files = "test_*.py"
|
|
85
|
+
python_classes = "Test*"
|
|
86
|
+
python_functions = "test_*"
|
|
87
|
+
addopts = "-v --tb=short"
|
|
88
|
+
|
|
89
|
+
[tool.mypy]
|
|
90
|
+
python_version = "3.9"
|
|
91
|
+
warn_return_any = true
|
|
92
|
+
warn_unused_configs = true
|