agenttrustid 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.
Files changed (33) hide show
  1. agenttrustid-0.3.0/LICENSE +201 -0
  2. agenttrustid-0.3.0/PKG-INFO +423 -0
  3. agenttrustid-0.3.0/README.md +382 -0
  4. agenttrustid-0.3.0/agenttrustid/__init__.py +100 -0
  5. agenttrustid-0.3.0/agenttrustid/a2a.py +158 -0
  6. agenttrustid-0.3.0/agenttrustid/agentcard.py +87 -0
  7. agenttrustid-0.3.0/agenttrustid/autogen_callback.py +561 -0
  8. agenttrustid-0.3.0/agenttrustid/callback.py +229 -0
  9. agenttrustid-0.3.0/agenttrustid/client.py +703 -0
  10. agenttrustid-0.3.0/agenttrustid/crewai_callback.py +379 -0
  11. agenttrustid-0.3.0/agenttrustid/delegation.py +107 -0
  12. agenttrustid-0.3.0/agenttrustid/exceptions.py +41 -0
  13. agenttrustid-0.3.0/agenttrustid/federation.py +75 -0
  14. agenttrustid-0.3.0/agenttrustid/guard.py +133 -0
  15. agenttrustid-0.3.0/agenttrustid/mcp_client.py +127 -0
  16. agenttrustid-0.3.0/agenttrustid/models.py +578 -0
  17. agenttrustid-0.3.0/agenttrustid/streaming.py +94 -0
  18. agenttrustid-0.3.0/agenttrustid/telemetry.py +128 -0
  19. agenttrustid-0.3.0/agenttrustid.egg-info/PKG-INFO +423 -0
  20. agenttrustid-0.3.0/agenttrustid.egg-info/SOURCES.txt +31 -0
  21. agenttrustid-0.3.0/agenttrustid.egg-info/dependency_links.txt +1 -0
  22. agenttrustid-0.3.0/agenttrustid.egg-info/requires.txt +14 -0
  23. agenttrustid-0.3.0/agenttrustid.egg-info/top_level.txt +1 -0
  24. agenttrustid-0.3.0/pyproject.toml +77 -0
  25. agenttrustid-0.3.0/setup.cfg +4 -0
  26. agenttrustid-0.3.0/tests/test_agenttrust.py +508 -0
  27. agenttrustid-0.3.0/tests/test_autogen_callback.py +541 -0
  28. agenttrustid-0.3.0/tests/test_callback.py +289 -0
  29. agenttrustid-0.3.0/tests/test_client.py +346 -0
  30. agenttrustid-0.3.0/tests/test_crewai_callback.py +384 -0
  31. agenttrustid-0.3.0/tests/test_models.py +159 -0
  32. agenttrustid-0.3.0/tests/test_protocols.py +1093 -0
  33. agenttrustid-0.3.0/tests/test_telemetry.py +243 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Yaima Valdivia and AgentTrust contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,423 @@
1
+ Metadata-Version: 2.4
2
+ Name: agenttrustid
3
+ Version: 0.3.0
4
+ Summary: AgentTrust ID SDK — runtime authorization, opaque agent tokens, and Guardian checks for AI agents
5
+ Author-email: AgentTrust <contact@agenttrust.id>
6
+ Maintainer-email: AgentTrust <contact@agenttrust.id>
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://agenttrust.id
9
+ Project-URL: Documentation, https://agenttrust.id/docs
10
+ Project-URL: Source, https://github.com/agenttrustid/sdk
11
+ Project-URL: Repository, https://github.com/agenttrustid/sdk
12
+ Project-URL: Issues, https://github.com/agenttrustid/sdk/issues
13
+ Project-URL: Changelog, https://github.com/agenttrustid/sdk/releases
14
+ Keywords: ai,agents,authentication,authorization,security,mcp,a2a,opaque-tokens
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Security
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Provides-Extra: langchain
30
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
31
+ Provides-Extra: agent
32
+ Requires-Dist: duckduckgo-search>=7.0; extra == "agent"
33
+ Requires-Dist: schedule>=1.2.0; extra == "agent"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio; extra == "dev"
37
+ Requires-Dist: black; extra == "dev"
38
+ Requires-Dist: mypy; extra == "dev"
39
+ Requires-Dist: ruff; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # AgentTrust ID Python SDK
43
+
44
+ Authentication, authorization, and runtime security for AI agents.
45
+
46
+ [![PyPI](https://img.shields.io/pypi/v/agenttrustid)](https://pypi.org/project/agenttrustid/)
47
+ [![Python](https://img.shields.io/pypi/pyversions/agenttrustid)](https://pypi.org/project/agenttrustid/)
48
+
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ pip install agenttrustid
54
+
55
+ # With LangChain support:
56
+ pip install agenttrustid[langchain]
57
+ ```
58
+
59
+ ## Quick Start
60
+
61
+ ```python
62
+ from agenttrustid import AgentTrustClient
63
+
64
+ client = AgentTrustClient(base_url="http://localhost:8080", api_key="sk_live_...")
65
+
66
+ # Register an agent
67
+ agent = client.agents.create(
68
+ name="my-agent",
69
+ framework="langchain",
70
+ capabilities=["files:read", "web:search"]
71
+ )
72
+
73
+ # Issue a short-lived opaque token (prefix `at_`).
74
+ # Tokens are NOT JWTs - they are random opaque strings. They have no
75
+ # signature and cannot be validated client-side. To check a token, call
76
+ # `client.tokens.introspect(token)`.
77
+ token = client.tokens.issue(
78
+ agent_id=agent.id,
79
+ scopes=["files:read"],
80
+ ttl_seconds=300
81
+ )
82
+ print(token.token) # e.g. "at_xK3z9..."
83
+
84
+ # Server-side validation (for tool providers receiving a token):
85
+ result = client.tokens.introspect(token.token, target="mcp://filesystem")
86
+ if result.active:
87
+ # Token is valid; agent_id, org_id, scopes are populated
88
+ pass
89
+
90
+ # Check an action before executing
91
+ result = client.actions.check(
92
+ agent_id=agent.id,
93
+ action="tool_call",
94
+ tool_name="web_search",
95
+ tool_input_summary="AI news",
96
+ session_id="sess-123"
97
+ )
98
+ print(f"Allowed: {result.allowed}, Confidence: {result.confidence}")
99
+ ```
100
+
101
+ ## LangChain Integration
102
+
103
+ Add one callback to Guardian-protect every tool call:
104
+
105
+ ```python
106
+ from agenttrustid import AgentTrustClient
107
+ from agenttrustid.callback import AgentTrustCallbackHandler
108
+ from langchain.agents import AgentExecutor
109
+
110
+ client = AgentTrustClient.from_env() # reads AGENTTRUST_URL + AGENTTRUST_API_KEY
111
+ agent_info = client.agents.create(name="research-bot", framework="langchain")
112
+
113
+ guardian = AgentTrustCallbackHandler(
114
+ client=client,
115
+ agent_id=agent_info.id,
116
+ block_on_deny=True, # raise exception on denied actions
117
+ fail_open=False, # block if Guardian is unreachable
118
+ log_inputs=False, # don't send tool inputs (privacy default)
119
+ )
120
+
121
+ executor = AgentExecutor(agent=agent, tools=tools, callbacks=[guardian])
122
+ result = executor.invoke({"input": "Find AI safety papers"})
123
+ ```
124
+
125
+ ### How the Callback Works
126
+
127
+ ```
128
+ on_tool_start --> POST /api/v1/actions/check (Fast Guard, <15ms)
129
+ If denied + block_on_deny: raises AgentTrustError (code="ACTION_DENIED")
130
+ on_tool_end --> Buffers telemetry event (async, batched)
131
+ on_chain_end --> POST /api/v1/telemetry/report (flushes buffer)
132
+ ```
133
+
134
+ ## AgentTrustGuard (Non-LangChain Agents)
135
+
136
+ For agents using raw Anthropic/OpenAI SDKs:
137
+
138
+ ```python
139
+ from agenttrustid import AgentTrustClient
140
+ from agenttrustid.guard import AgentTrustGuard
141
+
142
+ client = AgentTrustClient.from_env()
143
+ guard = AgentTrustGuard(client, agent_id="your-agent-id")
144
+
145
+ # Before tool call -- raises AgentTrustError (code="ACTION_DENIED") if denied
146
+ guard.check("web_search", input_summary="AI news bay area")
147
+
148
+ # After tool call
149
+ guard.report("web_search", success=True, duration_ms=1200)
150
+
151
+ # When done
152
+ guard.close()
153
+ ```
154
+
155
+ AgentTrustGuard can also be used as a context manager:
156
+
157
+ ```python
158
+ with AgentTrustGuard(client, agent_id="agent-123") as guard:
159
+ guard.check("web_search")
160
+ # ... do tool call ...
161
+ guard.report("web_search", success=True, duration_ms=500)
162
+ ```
163
+
164
+ ## Configuration
165
+
166
+ ### Environment Variables
167
+
168
+ ```bash
169
+ export AGENTTRUST_URL=http://localhost:8080
170
+ export AGENTTRUST_API_KEY=sk_live_...
171
+ ```
172
+
173
+ ```python
174
+ client = AgentTrustClient.from_env()
175
+ ```
176
+
177
+ ### AgentTrustClient Constructor
178
+
179
+ ```python
180
+ client = AgentTrustClient(
181
+ base_url="http://localhost:8080", # Gateway URL
182
+ auth_url=None, # Auth service URL (derived from base_url)
183
+ audit_url=None, # Audit service URL (derived from base_url)
184
+ api_key="sk_live_...", # Organization API key
185
+ timeout=30, # Request timeout in seconds
186
+ verify_tls=True, # TLS certificate verification (disable only for local dev)
187
+ )
188
+ ```
189
+
190
+ ### AgentTrustCallbackHandler Options
191
+
192
+ | Parameter | Default | Description |
193
+ |-----------|---------|-------------|
194
+ | `client` | required | AgentTrustClient instance |
195
+ | `agent_id` | required | Agent UUID from registration |
196
+ | `block_on_deny` | `True` | Raise exception when Guardian denies |
197
+ | `fail_open` | `False` | Allow tool calls if Guardian is unreachable |
198
+ | `log_inputs` | `False` | Send truncated tool inputs (max 200 chars) |
199
+
200
+ ## Privacy
201
+
202
+ The SDK is private by default:
203
+
204
+ | Data | Sent? | Notes |
205
+ |------|-------|-------|
206
+ | Tool name | Yes | e.g., `web_search` |
207
+ | Tool input | No | Only with `log_inputs=True`, truncated to 200 chars |
208
+ | Tool output | Never | Only success/failure boolean |
209
+ | Duration | Yes | Milliseconds |
210
+ | Error type | Yes | Exception class name only |
211
+ | LLM prompts | Never | SDK has no access |
212
+
213
+ ## Error Handling
214
+
215
+ ```python
216
+ from agenttrustid.exceptions import (
217
+ AgentTrustError, # Base error (also used for ACTION_DENIED with code="ACTION_DENIED")
218
+ AuthenticationError, # Invalid API key (401)
219
+ AuthorizationError, # Insufficient permissions (403)
220
+ TokenExpiredError, # Token TTL exceeded
221
+ AgentRevokedError, # Agent revoked
222
+ NetworkError, # Gateway unreachable
223
+ ValidationError, # Request validation failed (400)
224
+ )
225
+
226
+ try:
227
+ result = client.actions.check(
228
+ agent_id=agent.id,
229
+ action="tool_call",
230
+ tool_name="delete_all",
231
+ tool_input_summary="delete everything",
232
+ session_id="sess-1"
233
+ )
234
+ except AuthorizationError:
235
+ print("Action denied by Guardian")
236
+ except NetworkError:
237
+ print("Gateway unreachable")
238
+ ```
239
+
240
+ `ValidationError` is also exported from the top-level `agenttrustid` package.
241
+
242
+ ## API Reference
243
+
244
+ ### AgentTrustClient
245
+
246
+ ```python
247
+ client = AgentTrustClient(base_url="...", api_key="...", verify_tls=True)
248
+ client = AgentTrustClient.from_env() # AGENTTRUST_URL + AGENTTRUST_API_KEY
249
+ client = AgentTrustClient.from_config("path") # JSON config file
250
+ ```
251
+
252
+ ### Agents
253
+
254
+ ```python
255
+ agent = client.agents.create(name, framework, capabilities, metadata)
256
+ agents = client.agents.list(org_id=None)
257
+ agent = client.agents.get(agent_id)
258
+ client.agents.revoke(agent_id, reason)
259
+ ```
260
+
261
+ ### Tokens
262
+
263
+ ```python
264
+ token = client.tokens.issue(agent_id, scopes, ttl_seconds=300, use_cache=True)
265
+ result = client.tokens.introspect(token_str, target=None, required_scopes=None)
266
+ client.tokens.revoke(token_str, reason)
267
+ client.tokens.clear_cache()
268
+ ```
269
+
270
+ Token fields: `token.token`, `token.agent_id`, `token.scopes`, `token.audience`,
271
+ `token.issued_at`, `token.expires_at`, `token.token_id`, `token.is_expired`,
272
+ `token.ttl_seconds`.
273
+
274
+ ### Actions
275
+
276
+ ```python
277
+ result = client.actions.check(
278
+ agent_id,
279
+ action="tool_call",
280
+ tool_name="",
281
+ tool_input_summary="",
282
+ session_id=""
283
+ )
284
+ # result.allowed, result.confidence, result.reason, result.guard_tier,
285
+ # result.check_id, result.latency_ms
286
+ ```
287
+
288
+ ### Telemetry
289
+
290
+ ```python
291
+ client.telemetry.report(agent_id, session_id, events)
292
+ # events: list of dicts with keys: event_type, tool_name, duration_ms, success, error_type, timestamp
293
+ # Automatic via AgentTrustCallbackHandler -- buffers and flushes every 5s or 10 events
294
+ ```
295
+
296
+ ### Agent Cards
297
+
298
+ ```python
299
+ card = client.agent_cards.generate(agent_id)
300
+ card = client.agent_cards.get(agent_id)
301
+ card = client.agent_cards.publish(agent_id)
302
+ card = client.agent_cards.get_public(agent_id)
303
+ # card.name, card.url, card.provider, card.version,
304
+ # card.capabilities, card.skills, card.security_policy
305
+ ```
306
+
307
+ ### A2A (Agent-to-Agent)
308
+
309
+ ```python
310
+ task = client.a2a.send_task(
311
+ source_agent_id="agent-123",
312
+ target_agent_id="agent-456",
313
+ message="Summarize the latest security report",
314
+ metadata={"priority": "high"}
315
+ )
316
+ task = client.a2a.get_task(task_id)
317
+ task = client.a2a.cancel_task(task_id)
318
+ # task.id, task.source_agent_id, task.target_agent_id, task.status (default: "pending"),
319
+ # task.message, task.artifacts (List[Dict]), task.metadata, task.created_at, task.updated_at
320
+ ```
321
+
322
+ ### MCP (Model Context Protocol)
323
+
324
+ ```python
325
+ server = client.mcp.register_server(
326
+ name="filesystem",
327
+ url="http://localhost:9000",
328
+ capabilities=["files:read", "files:write"]
329
+ )
330
+ servers = client.mcp.list_servers()
331
+ client.mcp.remove_server(server_id)
332
+ result = client.mcp.call_tool(server_id, method="tools/call", params={...})
333
+ # result is a dict (JSON-RPC result)
334
+ # server.id, server.name, server.url, server.capabilities, server.org_id, server.created_at
335
+ ```
336
+
337
+ ### Delegations
338
+
339
+ ```python
340
+ delegation = client.delegations.create(
341
+ from_agent_id="agent-123",
342
+ to_agent_id="agent-456",
343
+ scope=["files:read"],
344
+ ttl_seconds=3600,
345
+ restrictions={"paths": ["/tmp/*"]},
346
+ parent_delegation_id=None
347
+ )
348
+ delegations = client.delegations.list() # no parameters
349
+ client.delegations.revoke(delegation_id)
350
+ session = client.delegations.init_session(delegation_id)
351
+ # delegation.id, delegation.from_agent_id, delegation.to_agent_id,
352
+ # delegation.scope, delegation.restrictions, delegation.delegation_chain,
353
+ # delegation.expires_at, delegation.revoked_at, delegation.created_at
354
+ ```
355
+
356
+ ### Sessions
357
+
358
+ ```python
359
+ session = client.sessions.init_session(agent_id, server_id)
360
+ session = client.sessions.get_session(session_id)
361
+ session = client.sessions.init_api_session(token)
362
+ ```
363
+
364
+ ### Federation
365
+
366
+ ```python
367
+ provider = client.federation.register_provider(
368
+ issuer="https://issuer.example.com",
369
+ name="Example Workforce",
370
+ trust_level="high",
371
+ )
372
+ providers = client.federation.list_providers()
373
+ client.federation.delete_provider(provider.id)
374
+ result = client.federation.verify_token(token="eyJ...", issuer_hint=None)
375
+ session = client.federation.init_session(token="eyJ...", issuer_hint=None)
376
+ id_token = client.federation.issue_id_token(agent_id, audience=None, nonce=None, ttl=None)
377
+ ```
378
+
379
+ ### SIEM Streaming
380
+
381
+ ```python
382
+ destination = client.streaming.create(
383
+ name="Splunk HEC",
384
+ destination_type="splunk",
385
+ endpoint_url="https://splunk.example.com/services/collector",
386
+ auth_token="secret",
387
+ )
388
+ destinations = client.streaming.list()
389
+ destination = client.streaming.get(destination.id)
390
+ destination = client.streaming.update(destination.id, is_active=True)
391
+ client.streaming.delete(destination.id)
392
+ logs = client.streaming.delivery_log(destination.id)
393
+ client.streaming.test(destination.id)
394
+ ```
395
+
396
+ ## Models
397
+
398
+ The following models are exported from the top-level `agenttrustid` package:
399
+
400
+ - `Agent` -- Registered AI agent
401
+ - `Token` -- Opaque agent token
402
+ - `VerificationResult` -- Token verification result
403
+ - `ActionCheckResult` -- Pre-flight action authorization check result
404
+ - `AgentCard` -- Agent Card (A2A protocol)
405
+ - `A2ATask` -- Agent-to-agent task
406
+ - `MCPServer` -- Registered MCP server
407
+ - `Delegation` -- Agent-to-agent capability delegation
408
+ - `FederationProvider` -- Registered OIDC federation provider
409
+ - `VerifyFederatedTokenResult` -- Federated token verification result
410
+ - `SIEMDestination` -- SIEM audit-stream destination
411
+ - `SIEMDeliveryRecord` -- SIEM delivery attempt record
412
+
413
+ Protocol API classes are also exported: `A2AAPI`, `AgentCardsAPI`, `MCPAPI`, `DelegationsAPI`, `FederationAPI`, `StreamingAPI`.
414
+
415
+ ## Requirements
416
+
417
+ - Python >= 3.8
418
+ - No runtime dependencies (stdlib only)
419
+ - Optional: `langchain-core>=0.1.0` for LangChain callback
420
+
421
+ ## License
422
+
423
+ Apache License 2.0 - see [LICENSE](./LICENSE) in this directory.