aiap-client 1.0.1__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.
@@ -0,0 +1,65 @@
1
+ # aiap-client License
2
+
3
+ Version 1.0, August 2026
4
+
5
+ **Copyright © 2026 Kanjani AI Research & Causum. All rights reserved.**
6
+
7
+ This package implements the AI Agency Protocol (AIAP), a proprietary
8
+ specification. It is **not** open source and **not** source available.
9
+ Publication to a public package index is a distribution convenience and does
10
+ not constitute an open-source grant. Commercial licensing is administered
11
+ exclusively by Causum.
12
+
13
+ ## Free use — Evaluation
14
+
15
+ You may, at no fee and without time limit:
16
+
17
+ - Read, study, and reference this package and the Protocol specification
18
+ - Install and run this package in non-production environments
19
+ - Prototype, experiment with, and test conformance of implementations
20
+ - Publish independent research concerning the Protocol, with attribution
21
+
22
+ "Evaluation Use" means use outside of production operation and not in support
23
+ of any revenue-generating product, service, or business process.
24
+
25
+ ## Paid use — Operating License required
26
+
27
+ You require an Operating License to derive Commercial Value from this package.
28
+ Commercial Value means economic benefit derived from the Protocol, **whether or
29
+ not the Protocol or any implementation of it is itself sold, licensed, or
30
+ otherwise transferred to any third party.** Operating this package in
31
+ production in support of any product, service, or internal business process
32
+ that generates revenue requires an Operating License.
33
+
34
+ Commercial resale of this package, agency-brokerage services whose primary
35
+ value proposition is the Protocol itself, or Protocol-as-a-Service offerings is
36
+ prohibited without a separate commercial license agreement.
37
+
38
+ ## Restrictions
39
+
40
+ You shall not fork, rebrand, or republish this package under a different name
41
+ or identity; remove or alter copyright notices, license headers, or attribution
42
+ statements; or use the names "AIAP" or "AI Agency Protocol" in a product name,
43
+ service name, or marketing material without prior written consent.
44
+
45
+ ## Reservation of rights
46
+
47
+ All patent rights are expressly reserved. No patent license is granted, whether
48
+ expressly, by implication, by estoppel, by publication, by package-index
49
+ distribution, or otherwise. All rights not expressly granted are reserved.
50
+
51
+ ## No warranty
52
+
53
+ THIS PACKAGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56
+ OWNER BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM USE OF
57
+ THIS PACKAGE.
58
+
59
+ ---
60
+
61
+ The full agreement, including the DFARS 252.227-7013 federal-grant carve-out,
62
+ governs this package and is available in the protocol repository:
63
+ https://gitlab.com/causum/aiap/-/blob/main/LICENSE.md
64
+
65
+ Licensing inquiries: owner@ai-governance-protocol.org or licensing@causum.com
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.5
2
+ Name: aiap-client
3
+ Version: 1.0.1
4
+ Summary: AI Agency Protocol (AIAP) client — identity, scope, and ephemeral authority for AI agents
5
+ Author-email: Kanjani AI Research & Causum <owner@ai-governance-protocol.org>
6
+ License: # aiap-client License
7
+
8
+ Version 1.0, August 2026
9
+
10
+ **Copyright © 2026 Kanjani AI Research & Causum. All rights reserved.**
11
+
12
+ This package implements the AI Agency Protocol (AIAP), a proprietary
13
+ specification. It is **not** open source and **not** source available.
14
+ Publication to a public package index is a distribution convenience and does
15
+ not constitute an open-source grant. Commercial licensing is administered
16
+ exclusively by Causum.
17
+
18
+ ## Free use — Evaluation
19
+
20
+ You may, at no fee and without time limit:
21
+
22
+ - Read, study, and reference this package and the Protocol specification
23
+ - Install and run this package in non-production environments
24
+ - Prototype, experiment with, and test conformance of implementations
25
+ - Publish independent research concerning the Protocol, with attribution
26
+
27
+ "Evaluation Use" means use outside of production operation and not in support
28
+ of any revenue-generating product, service, or business process.
29
+
30
+ ## Paid use — Operating License required
31
+
32
+ You require an Operating License to derive Commercial Value from this package.
33
+ Commercial Value means economic benefit derived from the Protocol, **whether or
34
+ not the Protocol or any implementation of it is itself sold, licensed, or
35
+ otherwise transferred to any third party.** Operating this package in
36
+ production in support of any product, service, or internal business process
37
+ that generates revenue requires an Operating License.
38
+
39
+ Commercial resale of this package, agency-brokerage services whose primary
40
+ value proposition is the Protocol itself, or Protocol-as-a-Service offerings is
41
+ prohibited without a separate commercial license agreement.
42
+
43
+ ## Restrictions
44
+
45
+ You shall not fork, rebrand, or republish this package under a different name
46
+ or identity; remove or alter copyright notices, license headers, or attribution
47
+ statements; or use the names "AIAP" or "AI Agency Protocol" in a product name,
48
+ service name, or marketing material without prior written consent.
49
+
50
+ ## Reservation of rights
51
+
52
+ All patent rights are expressly reserved. No patent license is granted, whether
53
+ expressly, by implication, by estoppel, by publication, by package-index
54
+ distribution, or otherwise. All rights not expressly granted are reserved.
55
+
56
+ ## No warranty
57
+
58
+ THIS PACKAGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
61
+ OWNER BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM USE OF
62
+ THIS PACKAGE.
63
+
64
+ ---
65
+
66
+ The full agreement, including the DFARS 252.227-7013 federal-grant carve-out,
67
+ governs this package and is available in the protocol repository:
68
+ https://gitlab.com/causum/aiap/-/blob/main/LICENSE.md
69
+
70
+ Licensing inquiries: owner@ai-governance-protocol.org or licensing@causum.com
71
+ License-File: LICENSE.md
72
+ Keywords: agency,agents,ai,aiap,credentials,identity,jit,protocol
73
+ Classifier: Development Status :: 4 - Beta
74
+ Classifier: Intended Audience :: Developers
75
+ Classifier: License :: Other/Proprietary License
76
+ Classifier: Programming Language :: Python :: 3
77
+ Classifier: Programming Language :: Python :: 3.11
78
+ Classifier: Programming Language :: Python :: 3.12
79
+ Classifier: Programming Language :: Python :: 3.13
80
+ Classifier: Topic :: Security
81
+ Requires-Python: >=3.11
82
+ Requires-Dist: httpx>=0.25.0
83
+ Requires-Dist: pydantic>=2.0
84
+ Provides-Extra: aws
85
+ Requires-Dist: boto3>=1.26.0; extra == 'aws'
86
+ Provides-Extra: cert
87
+ Requires-Dist: cryptography>=41.0; extra == 'cert'
88
+ Provides-Extra: dev
89
+ Requires-Dist: pytest; extra == 'dev'
90
+ Requires-Dist: pytest-asyncio; extra == 'dev'
91
+ Requires-Dist: respx; extra == 'dev'
92
+ Description-Content-Type: text/markdown
93
+
94
+ # aiap-client — AI Agency Protocol SDK
95
+
96
+ **Identity is persistent. Agency is ephemeral.**
97
+
98
+ Python SDK for the AI Agency Protocol (AIAP). Enables agents to request scoped, time-limited authority from a central broker.
99
+
100
+ ## Install
101
+
102
+ ```bash
103
+ pip install aiap-client
104
+ pip install aiap-client[aws] # + boto3 for credential sessions
105
+ pip install aiap-client[cert] # + cryptography for certificate auth
106
+ ```
107
+
108
+ ## Quick Start
109
+
110
+ ```python
111
+ from aiap_client import AgencyClient, AgencyLevel
112
+
113
+ client = AgencyClient(
114
+ broker_url="https://www.cyber-ai-scim.com",
115
+ agent_id="YXFQTW0VCL",
116
+ mac_secret="your-hmac-secret",
117
+ )
118
+
119
+ # Request JIT credentials
120
+ grant = await client.request_agency(
121
+ intent="Invoke underwriting model",
122
+ use_case="underwriting",
123
+ resources=["bedrock:InvokeModel"],
124
+ duration_seconds=900,
125
+ )
126
+
127
+ if grant.granted:
128
+ session = grant.to_boto3_session(region="us-east-1")
129
+ bedrock = session.client("bedrock-runtime")
130
+ # Invoke with scoped creds — expires in 15 min
131
+ else:
132
+ print(f"Denied: {grant.reason}")
133
+ ```
134
+
135
+ ## Mediated Execution (Level 2)
136
+
137
+ Agent never sees credentials:
138
+
139
+ ```python
140
+ result = await client.execute(
141
+ intent="Invoke model for risk assessment",
142
+ use_case="underwriting",
143
+ action="bedrock:InvokeModel",
144
+ parameters={"modelId": "anthropic.claude-sonnet-4-6", "body": {...}},
145
+ )
146
+ print(result.output) # Only the result
147
+ ```
148
+
149
+ ## Certificate Authentication
150
+
151
+ ```python
152
+ from aiap_client import AgencyClient, CertificateSigner
153
+
154
+ client = AgencyClient(
155
+ broker_url="https://www.cyber-ai-scim.com",
156
+ agent_id="YXFQTW0VCL",
157
+ signer=CertificateSigner(cert_path="agent.pem", key_path="agent-key.pem"),
158
+ )
159
+ ```
160
+
161
+ ## Protocol
162
+
163
+ See [RFC-001: AI Agency Protocol](../../../specification/RFC-001-AI-Agency-Protocol.md)
@@ -0,0 +1,70 @@
1
+ # aiap-client — AI Agency Protocol SDK
2
+
3
+ **Identity is persistent. Agency is ephemeral.**
4
+
5
+ Python SDK for the AI Agency Protocol (AIAP). Enables agents to request scoped, time-limited authority from a central broker.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install aiap-client
11
+ pip install aiap-client[aws] # + boto3 for credential sessions
12
+ pip install aiap-client[cert] # + cryptography for certificate auth
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ from aiap_client import AgencyClient, AgencyLevel
19
+
20
+ client = AgencyClient(
21
+ broker_url="https://www.cyber-ai-scim.com",
22
+ agent_id="YXFQTW0VCL",
23
+ mac_secret="your-hmac-secret",
24
+ )
25
+
26
+ # Request JIT credentials
27
+ grant = await client.request_agency(
28
+ intent="Invoke underwriting model",
29
+ use_case="underwriting",
30
+ resources=["bedrock:InvokeModel"],
31
+ duration_seconds=900,
32
+ )
33
+
34
+ if grant.granted:
35
+ session = grant.to_boto3_session(region="us-east-1")
36
+ bedrock = session.client("bedrock-runtime")
37
+ # Invoke with scoped creds — expires in 15 min
38
+ else:
39
+ print(f"Denied: {grant.reason}")
40
+ ```
41
+
42
+ ## Mediated Execution (Level 2)
43
+
44
+ Agent never sees credentials:
45
+
46
+ ```python
47
+ result = await client.execute(
48
+ intent="Invoke model for risk assessment",
49
+ use_case="underwriting",
50
+ action="bedrock:InvokeModel",
51
+ parameters={"modelId": "anthropic.claude-sonnet-4-6", "body": {...}},
52
+ )
53
+ print(result.output) # Only the result
54
+ ```
55
+
56
+ ## Certificate Authentication
57
+
58
+ ```python
59
+ from aiap_client import AgencyClient, CertificateSigner
60
+
61
+ client = AgencyClient(
62
+ broker_url="https://www.cyber-ai-scim.com",
63
+ agent_id="YXFQTW0VCL",
64
+ signer=CertificateSigner(cert_path="agent.pem", key_path="agent-key.pem"),
65
+ )
66
+ ```
67
+
68
+ ## Protocol
69
+
70
+ See [RFC-001: AI Agency Protocol](../../../specification/RFC-001-AI-Agency-Protocol.md)
@@ -0,0 +1,212 @@
1
+ # AIAP Python SDK — Specification
2
+
3
+ **Package:** `aiap-client`
4
+ **Version:** 1.0.0
5
+ **Python:** >=3.11
6
+ **Dependencies:** `httpx>=0.25.0`, `pydantic>=2.0`
7
+
8
+ ---
9
+
10
+ ## Purpose
11
+
12
+ The `aiap-client` SDK enables agents, applications, and helpers to:
13
+ 1. Request agency (JIT credentials or mediated execution)
14
+ 2. Authenticate with MAC or certificate
15
+ 3. Manage credential lifecycle (refresh, revoke)
16
+ 4. Record agency decisions for audit
17
+
18
+ ---
19
+
20
+ ## Public API
21
+
22
+ ```python
23
+ from aiap_client import (
24
+ # Core
25
+ AgencyClient,
26
+
27
+ # Models
28
+ AgencyRequest,
29
+ AgencyGrant,
30
+ AgencyDeny,
31
+ AgencyRevoke,
32
+ AgencyLevel,
33
+ SafetyTier,
34
+
35
+ # Credentials
36
+ AgencyCredentials,
37
+ CredentialSession,
38
+
39
+ # Authentication
40
+ MacSigner,
41
+ CertificateSigner,
42
+ )
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Usage
48
+
49
+ ### Basic: Request JIT Credentials
50
+
51
+ ```python
52
+ from aiap_client import AgencyClient, AgencyRequest, AgencyLevel
53
+
54
+ client = AgencyClient(
55
+ broker_url="https://www.cyber-ai-scim.com",
56
+ agent_id="YXFQTW0VCL",
57
+ mac_secret="d918eb5081ca19eaf6081882df70e3cd...",
58
+ )
59
+
60
+ # Request agency
61
+ grant = await client.request_agency(
62
+ intent="Invoke underwriting model for applicant risk assessment",
63
+ use_case="underwriting",
64
+ resources=["bedrock:InvokeModel"],
65
+ resource_arns=["arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-6"],
66
+ duration_seconds=900,
67
+ )
68
+
69
+ if grant.granted:
70
+ # Use the scoped credentials
71
+ session = grant.to_boto3_session()
72
+ bedrock = session.client("bedrock-runtime", region_name="us-east-1")
73
+ # ... invoke model with JIT creds
74
+ else:
75
+ print(f"Denied: {grant.reason}")
76
+ ```
77
+
78
+ ### Level 2: Mediated Execution
79
+
80
+ ```python
81
+ result = await client.execute(
82
+ intent="Invoke underwriting model",
83
+ use_case="underwriting",
84
+ action="bedrock:InvokeModel",
85
+ parameters={
86
+ "modelId": "anthropic.claude-sonnet-4-6",
87
+ "body": {"messages": [...]},
88
+ },
89
+ )
90
+ # Agent never sees credentials — only the result
91
+ print(result.output)
92
+ ```
93
+
94
+ ### Revoke
95
+
96
+ ```python
97
+ await client.revoke(decision_id="dec-a1b2c3d4e5f6")
98
+ ```
99
+
100
+ ### Certificate Authentication
101
+
102
+ ```python
103
+ from aiap_client import AgencyClient, CertificateSigner
104
+
105
+ signer = CertificateSigner(
106
+ cert_path="/path/to/agent-cert.pem",
107
+ key_path="/path/to/agent-key.pem",
108
+ )
109
+
110
+ client = AgencyClient(
111
+ broker_url="https://www.cyber-ai-scim.com",
112
+ agent_id="YXFQTW0VCL",
113
+ signer=signer,
114
+ )
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Module Design
120
+
121
+ ### `models.py`
122
+
123
+ ```python
124
+ class AgencyLevel(str, Enum):
125
+ JIT_CREDENTIALS = "JIT_CREDENTIALS"
126
+ MEDIATED = "MEDIATED"
127
+ DELEGATED = "DELEGATED"
128
+
129
+ class SafetyTier(str, Enum):
130
+ LOW = "LOW"
131
+ MEDIUM = "MEDIUM"
132
+ HIGH = "HIGH"
133
+ CRITICAL = "CRITICAL"
134
+
135
+ class AgencyRequest(BaseModel):
136
+ agent_id: str
137
+ credential: str # MAC hex or "cert:<base64>"
138
+ intent: str
139
+ use_case: str
140
+ resources: list[str]
141
+ resource_arns: list[str] = []
142
+ context: dict = {}
143
+ level: AgencyLevel = AgencyLevel.JIT_CREDENTIALS
144
+ duration_seconds: int = 900
145
+
146
+ class AgencyCredentials(BaseModel):
147
+ access_key_id: str
148
+ secret_access_key: str
149
+ session_token: str
150
+ expiration: str
151
+
152
+ class AgencyGrant(BaseModel):
153
+ granted: bool = True
154
+ decision_id: str
155
+ credentials: AgencyCredentials | None = None
156
+ source_identity: str = ""
157
+ session_name: str = ""
158
+ tags: dict = {}
159
+ scope: dict = {}
160
+ governance_checks: list[str] = []
161
+ expires_at: str = ""
162
+
163
+ class AgencyDeny(BaseModel):
164
+ granted: bool = False
165
+ decision_id: str
166
+ reason: str
167
+ governance_checks: list[str] = []
168
+ ```
169
+
170
+ ### `client.py`
171
+
172
+ ```python
173
+ class AgencyClient:
174
+ def __init__(self, broker_url, agent_id, mac_secret="", signer=None): ...
175
+ async def request_agency(self, intent, use_case, resources, **kwargs) -> AgencyGrant | AgencyDeny: ...
176
+ async def execute(self, intent, use_case, action, parameters, **kwargs) -> ExecutionResult: ...
177
+ async def revoke(self, decision_id) -> bool: ...
178
+ async def heartbeat(self, decision_id) -> bool: ...
179
+ async def list_sessions(self) -> list[dict]: ...
180
+ async def list_decisions(self, limit=20) -> list[dict]: ...
181
+ ```
182
+
183
+ ### `credentials.py`
184
+
185
+ ```python
186
+ class CredentialSession:
187
+ """Wraps AgencyCredentials with auto-refresh."""
188
+ def __init__(self, client, grant): ...
189
+ def to_boto3_session(self, region="us-east-1") -> boto3.Session: ...
190
+ async def refresh(self) -> None: ...
191
+ @property
192
+ def is_expired(self) -> bool: ...
193
+ @property
194
+ def expires_in_seconds(self) -> int: ...
195
+ ```
196
+
197
+ ### `signer.py`
198
+
199
+ ```python
200
+ class Signer(Protocol):
201
+ def sign(self, agent_id: str) -> str: ...
202
+
203
+ class MacSigner:
204
+ """HMAC-SHA256 signing (bootstrap/legacy)."""
205
+ def __init__(self, secret: str): ...
206
+ def sign(self, agent_id: str) -> str: ...
207
+
208
+ class CertificateSigner:
209
+ """X.509 certificate signing (production)."""
210
+ def __init__(self, cert_path: str, key_path: str): ...
211
+ def sign(self, agent_id: str) -> str: ...
212
+ ```
@@ -0,0 +1,45 @@
1
+ """AIAP Client v1.0.0 — AI Agency Protocol client.
2
+
3
+ Provides:
4
+ - Agency request/grant/deny lifecycle
5
+ - JIT credential management (auto-refresh, boto3 session)
6
+ - Mediated execution (Level 2 — agent never sees credentials)
7
+ - MAC and certificate authentication
8
+ - Session revocation
9
+ """
10
+
11
+ __version__ = "1.0.1"
12
+
13
+ from .client import AgencyClient
14
+ from .models import (
15
+ AgencyCredentials,
16
+ AgencyDeny,
17
+ AgencyGrant,
18
+ AgencyLevel,
19
+ AgencyRequest,
20
+ AgencyRevoke,
21
+ ExecutionResult,
22
+ MediatedRequest,
23
+ SafetyTier,
24
+ AgencyDecisionResult,
25
+ )
26
+ from .credentials import CredentialSession
27
+ from .signer import MacSigner, CertificateSigner, Signer
28
+
29
+ __all__ = [
30
+ "AgencyClient",
31
+ "AgencyCredentials",
32
+ "AgencyDeny",
33
+ "AgencyGrant",
34
+ "AgencyLevel",
35
+ "AgencyRequest",
36
+ "AgencyRevoke",
37
+ "ExecutionResult",
38
+ "MediatedRequest",
39
+ "SafetyTier",
40
+ "AgencyDecisionResult",
41
+ "CredentialSession",
42
+ "MacSigner",
43
+ "CertificateSigner",
44
+ "Signer",
45
+ ]