agent-trust-sdk 0.1.0__tar.gz → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-trust-sdk
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Python client for the Agent Trust Verification API
5
5
  Home-page: https://github.com/your-org/agent-trust-infrastructure
6
6
  Author: Agent Trust Infrastructure
@@ -163,6 +163,53 @@ client.report_threat(
163
163
  )
164
164
  ```
165
165
 
166
+ ### Agent Verification
167
+
168
+ Verify ownership of your agent via email or domain DNS records:
169
+
170
+ #### Email Verification
171
+
172
+ ```python
173
+ # Step 1: Start email verification
174
+ result = client.start_email_verification(
175
+ agent_url="https://myagent.ai/agent",
176
+ email="owner@myagent.ai"
177
+ )
178
+ print(f"Verification email sent! Expires: {result['expires_at']}")
179
+
180
+ # Step 2: Confirm with token from email
181
+ confirmation = client.confirm_email_verification(
182
+ agent_url="https://myagent.ai/agent",
183
+ token="abc123..." # Token from verification email
184
+ )
185
+
186
+ if confirmation['success']:
187
+ print(f"✅ Email verified: {confirmation['verified_email']}")
188
+ ```
189
+
190
+ #### Domain Verification
191
+
192
+ ```python
193
+ # Step 1: Get DNS record instructions
194
+ result = client.start_domain_verification(
195
+ agent_url="https://myagent.ai/agent"
196
+ )
197
+
198
+ print("Add this DNS TXT record to your domain:")
199
+ print(f" Name: {result['record_name']}")
200
+ print(f" Value: {result['record_value']}")
201
+
202
+ # Step 2: After adding DNS record, check verification
203
+ status = client.check_domain_verification(
204
+ agent_url="https://myagent.ai/agent"
205
+ )
206
+
207
+ if status['verified']:
208
+ print(f"✅ Domain verified at {status['verified_at']}")
209
+ else:
210
+ print(f"⏳ DNS record not found yet. Expected: {status['expected_record']}")
211
+ ```
212
+
166
213
  ## Async Support
167
214
 
168
215
  For async/await usage:
@@ -126,6 +126,53 @@ client.report_threat(
126
126
  )
127
127
  ```
128
128
 
129
+ ### Agent Verification
130
+
131
+ Verify ownership of your agent via email or domain DNS records:
132
+
133
+ #### Email Verification
134
+
135
+ ```python
136
+ # Step 1: Start email verification
137
+ result = client.start_email_verification(
138
+ agent_url="https://myagent.ai/agent",
139
+ email="owner@myagent.ai"
140
+ )
141
+ print(f"Verification email sent! Expires: {result['expires_at']}")
142
+
143
+ # Step 2: Confirm with token from email
144
+ confirmation = client.confirm_email_verification(
145
+ agent_url="https://myagent.ai/agent",
146
+ token="abc123..." # Token from verification email
147
+ )
148
+
149
+ if confirmation['success']:
150
+ print(f"✅ Email verified: {confirmation['verified_email']}")
151
+ ```
152
+
153
+ #### Domain Verification
154
+
155
+ ```python
156
+ # Step 1: Get DNS record instructions
157
+ result = client.start_domain_verification(
158
+ agent_url="https://myagent.ai/agent"
159
+ )
160
+
161
+ print("Add this DNS TXT record to your domain:")
162
+ print(f" Name: {result['record_name']}")
163
+ print(f" Value: {result['record_value']}")
164
+
165
+ # Step 2: After adding DNS record, check verification
166
+ status = client.check_domain_verification(
167
+ agent_url="https://myagent.ai/agent"
168
+ )
169
+
170
+ if status['verified']:
171
+ print(f"✅ Domain verified at {status['verified_at']}")
172
+ else:
173
+ print(f"⏳ DNS record not found yet. Expected: {status['expected_record']}")
174
+ ```
175
+
129
176
  ## Async Support
130
177
 
131
178
  For async/await usage:
@@ -19,26 +19,31 @@ Usage:
19
19
  print(f"Agent blocked: {result.reasoning}")
20
20
  """
21
21
 
22
- from .client import AgentTrustClient
22
+ from .client import AgentTrustClient, AsyncAgentTrustClient, AgentTrustError, APIError
23
23
  from .models import (
24
24
  VerificationResult,
25
25
  AgentReputation,
26
26
  InteractionResult,
27
27
  ScoreBreakdown,
28
28
  ThreatMatch,
29
+ TextScanResult,
29
30
  Verdict,
30
31
  ThreatLevel,
31
32
  InteractionOutcome,
32
33
  )
33
34
 
34
- __version__ = "0.1.0"
35
+ __version__ = "0.2.0"
35
36
  __all__ = [
36
37
  "AgentTrustClient",
38
+ "AsyncAgentTrustClient",
39
+ "AgentTrustError",
40
+ "APIError",
37
41
  "VerificationResult",
38
42
  "AgentReputation",
39
43
  "InteractionResult",
40
44
  "ScoreBreakdown",
41
45
  "ThreatMatch",
46
+ "TextScanResult",
42
47
  "Verdict",
43
48
  "ThreatLevel",
44
49
  "InteractionOutcome",
@@ -366,6 +366,132 @@ class AgentTrustClient:
366
366
 
367
367
  return self._request("POST", "/threats/report", json=data)
368
368
 
369
+ # ========================================================================
370
+ # Agent Verification Endpoints
371
+ # ========================================================================
372
+
373
+ def start_email_verification(self, agent_url: str, email: str) -> dict:
374
+ """
375
+ Start email verification for an agent.
376
+
377
+ Initiates the email verification process by sending a verification
378
+ token to the specified email address.
379
+
380
+ Args:
381
+ agent_url: URL of the agent to verify
382
+ email: Email address to verify ownership of
383
+
384
+ Returns:
385
+ dict with verification token info:
386
+ - message: Status message
387
+ - email: The email address being verified
388
+ - expires_at: When the token expires (ISO format)
389
+ - token: The verification token (MVP only, for testing)
390
+
391
+ Example:
392
+ result = client.start_email_verification(
393
+ agent_url="https://myagent.ai/agent",
394
+ email="owner@myagent.ai"
395
+ )
396
+ print(f"Check your email! Token expires: {result['expires_at']}")
397
+ """
398
+ encoded_url = quote(agent_url, safe="")
399
+ data = {"email": email}
400
+ return self._request("POST", f"/agents/{encoded_url}/verify/email", json=data)
401
+
402
+ def confirm_email_verification(self, agent_url: str, token: str) -> dict:
403
+ """
404
+ Confirm email verification with the token.
405
+
406
+ Completes the email verification process using the token received
407
+ via email (or returned from start_email_verification in MVP mode).
408
+
409
+ Args:
410
+ agent_url: URL of the agent being verified
411
+ token: The verification token (64-character hex string)
412
+
413
+ Returns:
414
+ dict with confirmation result:
415
+ - success: Whether verification succeeded
416
+ - message: Status message
417
+ - agent_url: The verified agent URL
418
+ - verified_email: The email that was verified
419
+ - verified_at: When verification completed (ISO format)
420
+
421
+ Example:
422
+ result = client.confirm_email_verification(
423
+ agent_url="https://myagent.ai/agent",
424
+ token="abc123..."
425
+ )
426
+ if result['success']:
427
+ print(f"Email verified: {result['verified_email']}")
428
+ """
429
+ encoded_url = quote(agent_url, safe="")
430
+ return self._request("GET", f"/agents/{encoded_url}/verify/email/{token}")
431
+
432
+ def start_domain_verification(self, agent_url: str) -> dict:
433
+ """
434
+ Start domain verification for an agent.
435
+
436
+ Generates a DNS TXT record challenge that must be added to the
437
+ agent's domain to prove ownership.
438
+
439
+ Args:
440
+ agent_url: URL of the agent to verify
441
+
442
+ Returns:
443
+ dict with DNS record instructions:
444
+ - message: Status message
445
+ - domain: The domain being verified
446
+ - record_type: DNS record type (TXT)
447
+ - record_name: Where to add the record (e.g., _trustagents.domain.com)
448
+ - record_value: The value to set (e.g., trustagents-verify=<token>)
449
+ - instructions: Human-readable setup instructions
450
+ - expires_at: When the challenge expires (ISO format)
451
+
452
+ Example:
453
+ result = client.start_domain_verification(
454
+ agent_url="https://myagent.ai/agent"
455
+ )
456
+ print(f"Add this DNS record:")
457
+ print(f" Type: {result['record_type']}")
458
+ print(f" Name: {result['record_name']}")
459
+ print(f" Value: {result['record_value']}")
460
+ """
461
+ encoded_url = quote(agent_url, safe="")
462
+ return self._request("POST", f"/agents/{encoded_url}/verify/domain")
463
+
464
+ def check_domain_verification(self, agent_url: str) -> dict:
465
+ """
466
+ Check if domain verification DNS record exists.
467
+
468
+ Performs a DNS lookup to verify that the required TXT record
469
+ has been properly configured.
470
+
471
+ Args:
472
+ agent_url: URL of the agent being verified
473
+
474
+ Returns:
475
+ dict with verification status:
476
+ - verified: Whether the domain is verified
477
+ - message: Status message
478
+ - domain: The domain being checked
479
+ - expected_record: The expected DNS record value
480
+ - found_records: List of TXT records found (if any)
481
+ - verified_at: When verification completed (if verified)
482
+
483
+ Example:
484
+ result = client.check_domain_verification(
485
+ agent_url="https://myagent.ai/agent"
486
+ )
487
+ if result['verified']:
488
+ print(f"Domain verified at {result['verified_at']}")
489
+ else:
490
+ print(f"Record not found. Expected: {result['expected_record']}")
491
+ """
492
+ encoded_url = quote(agent_url, safe="")
493
+ return self._request("GET", f"/agents/{encoded_url}/verify/domain/check")
494
+
369
495
  # ========================================================================
370
496
  # Utility Methods
371
497
  # ========================================================================
@@ -543,3 +669,58 @@ class AsyncAgentTrustClient:
543
669
  async def health_check(self) -> dict:
544
670
  """Check API health status."""
545
671
  return await self._request("GET", "/health")
672
+
673
+ async def start_email_verification(self, agent_url: str, email: str) -> dict:
674
+ """
675
+ Start email verification for an agent.
676
+
677
+ Args:
678
+ agent_url: URL of the agent to verify
679
+ email: Email address to verify ownership of
680
+
681
+ Returns:
682
+ dict with verification token info
683
+ """
684
+ encoded_url = quote(agent_url, safe="")
685
+ data = {"email": email}
686
+ return await self._request("POST", f"/agents/{encoded_url}/verify/email", json=data)
687
+
688
+ async def confirm_email_verification(self, agent_url: str, token: str) -> dict:
689
+ """
690
+ Confirm email verification with the token.
691
+
692
+ Args:
693
+ agent_url: URL of the agent being verified
694
+ token: The verification token
695
+
696
+ Returns:
697
+ dict with confirmation result
698
+ """
699
+ encoded_url = quote(agent_url, safe="")
700
+ return await self._request("GET", f"/agents/{encoded_url}/verify/email/{token}")
701
+
702
+ async def start_domain_verification(self, agent_url: str) -> dict:
703
+ """
704
+ Start domain verification for an agent.
705
+
706
+ Args:
707
+ agent_url: URL of the agent to verify
708
+
709
+ Returns:
710
+ dict with DNS record instructions
711
+ """
712
+ encoded_url = quote(agent_url, safe="")
713
+ return await self._request("POST", f"/agents/{encoded_url}/verify/domain")
714
+
715
+ async def check_domain_verification(self, agent_url: str) -> dict:
716
+ """
717
+ Check if domain verification DNS record exists.
718
+
719
+ Args:
720
+ agent_url: URL of the agent being verified
721
+
722
+ Returns:
723
+ dict with verification status
724
+ """
725
+ encoded_url = quote(agent_url, safe="")
726
+ return await self._request("GET", f"/agents/{encoded_url}/verify/domain/check")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-trust-sdk
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Python client for the Agent Trust Verification API
5
5
  Home-page: https://github.com/your-org/agent-trust-infrastructure
6
6
  Author: Agent Trust Infrastructure
@@ -163,6 +163,53 @@ client.report_threat(
163
163
  )
164
164
  ```
165
165
 
166
+ ### Agent Verification
167
+
168
+ Verify ownership of your agent via email or domain DNS records:
169
+
170
+ #### Email Verification
171
+
172
+ ```python
173
+ # Step 1: Start email verification
174
+ result = client.start_email_verification(
175
+ agent_url="https://myagent.ai/agent",
176
+ email="owner@myagent.ai"
177
+ )
178
+ print(f"Verification email sent! Expires: {result['expires_at']}")
179
+
180
+ # Step 2: Confirm with token from email
181
+ confirmation = client.confirm_email_verification(
182
+ agent_url="https://myagent.ai/agent",
183
+ token="abc123..." # Token from verification email
184
+ )
185
+
186
+ if confirmation['success']:
187
+ print(f"✅ Email verified: {confirmation['verified_email']}")
188
+ ```
189
+
190
+ #### Domain Verification
191
+
192
+ ```python
193
+ # Step 1: Get DNS record instructions
194
+ result = client.start_domain_verification(
195
+ agent_url="https://myagent.ai/agent"
196
+ )
197
+
198
+ print("Add this DNS TXT record to your domain:")
199
+ print(f" Name: {result['record_name']}")
200
+ print(f" Value: {result['record_value']}")
201
+
202
+ # Step 2: After adding DNS record, check verification
203
+ status = client.check_domain_verification(
204
+ agent_url="https://myagent.ai/agent"
205
+ )
206
+
207
+ if status['verified']:
208
+ print(f"✅ Domain verified at {status['verified_at']}")
209
+ else:
210
+ print(f"⏳ DNS record not found yet. Expected: {status['expected_record']}")
211
+ ```
212
+
166
213
  ## Async Support
167
214
 
168
215
  For async/await usage:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agent-trust-sdk"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Python client for the Agent Trust Verification API"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as f:
9
9
 
10
10
  setup(
11
11
  name="agent-trust-sdk",
12
- version="0.1.0",
12
+ version="0.2.0",
13
13
  author="Agent Trust Infrastructure",
14
14
  author_email="hello@agenttrust.dev",
15
15
  description="Python client for the Agent Trust Verification API",