agentboxd 0.1.0__py3-none-any.whl

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.
agentboxd/__init__.py ADDED
@@ -0,0 +1,376 @@
1
+ """Agentboxd: real email inboxes for AI agents.
2
+
3
+ from agentboxd import Agentboxd
4
+
5
+ mr = Agentboxd() # AGENTBOXD_API_KEY / AGENTBOXD_BASE_URL from the environment
6
+ inbox = mr.inboxes.create(client_id="support-agent")
7
+ mr.messages.send(inbox["id"], to="someone@example.com", subject="Hi", text="Hello!")
8
+ """
9
+
10
+ from ._attachments import attachment_from_bytes, attachment_from_path
11
+ from ._client import DEFAULT_BASE_URL, DEFAULT_TIMEOUT, Agentboxd, AsyncAgentboxd
12
+ from ._consume import ConsumeContext, consume_retry_delay
13
+ from ._errors import (
14
+ AgentboxdError,
15
+ APIConnectionError,
16
+ AuthenticationError,
17
+ BadRequestError,
18
+ InternalServerError,
19
+ MailroomError,
20
+ NotFoundError,
21
+ PermissionDeniedError,
22
+ RateLimitError,
23
+ UnprocessableEntityError,
24
+ )
25
+ from ._pagination import aiter_all, iter_all
26
+ from ._requests import NOT_GIVEN, NotGiven
27
+ from ._signup import Signup, solve_signup_challenge
28
+ from ._stream import EventStream, StreamClosedError
29
+ from ._types import (
30
+ Account,
31
+ AccountClaim,
32
+ AckResult,
33
+ AddAgentResult,
34
+ AgentAssurance,
35
+ AgentBundle,
36
+ AgentCard,
37
+ AgentCardInput,
38
+ AgentCardListing,
39
+ AgentCardSkill,
40
+ AgentCardStatus,
41
+ AgentCardVisibility,
42
+ AgentKey,
43
+ AgentKeyJwk,
44
+ AgentKeyList,
45
+ AgentMessaging,
46
+ AgentStatus,
47
+ AiDisclosure,
48
+ AiProcessing,
49
+ Attachment,
50
+ AttachmentExtraction,
51
+ AttachmentInput,
52
+ AttachmentText,
53
+ BounceReason,
54
+ BuiltinExtractionSchema,
55
+ BusiestDay,
56
+ ClaimRequestResult,
57
+ Contact,
58
+ ContactBulkDeleteResult,
59
+ ContactDomain,
60
+ ContactDomainList,
61
+ ContactKind,
62
+ ContactWithThreads,
63
+ Deliverability,
64
+ DeliverabilitySummary,
65
+ Direction,
66
+ DirectoryReportReason,
67
+ DirectoryReportResult,
68
+ DirectoryVerifyResult,
69
+ Domain,
70
+ DomainDkim,
71
+ DomainDns,
72
+ DomainDnsProvider,
73
+ DomainRecord,
74
+ DomainRecordKey,
75
+ DomainStatus,
76
+ DomainZoneFile,
77
+ Draft,
78
+ DraftApprover,
79
+ DraftAttachment,
80
+ DraftCitation,
81
+ DraftError,
82
+ DraftKeep,
83
+ DraftReply,
84
+ DraftSendResult,
85
+ DraftStatus,
86
+ EmergencyStopResult,
87
+ EnvelopeEventData,
88
+ EscalationContact,
89
+ EscalationSettings,
90
+ EscalationTrigger,
91
+ ExtendResult,
92
+ ExtractionError,
93
+ ExtractionMethod,
94
+ ExtractionStatus,
95
+ HeatmapDay,
96
+ Identity,
97
+ IdentityClient,
98
+ IdentityClientType,
99
+ IdentityClientWithSecret,
100
+ IdentityFlow,
101
+ IdentityScope,
102
+ IdentitySignIn,
103
+ IdentitySubjectType,
104
+ IdentityToken,
105
+ InboundQuality,
106
+ Inbox,
107
+ InboxEscalation,
108
+ InboxForward,
109
+ InboxIdentity,
110
+ InboxIdentityApp,
111
+ KnowledgeDoc,
112
+ KnowledgeListItem,
113
+ KnowledgeSearchResult,
114
+ KnowledgeSearchResults,
115
+ Lease,
116
+ LeaseClaim,
117
+ ListDirection,
118
+ ListEntries,
119
+ ListEntry,
120
+ ListKind,
121
+ LocalScreen,
122
+ LocalScreenReason,
123
+ LocalSpam,
124
+ Message,
125
+ MessageAgent,
126
+ MessageAi,
127
+ MessageAnalysis,
128
+ MessageApproval,
129
+ MessageAuthor,
130
+ MessageCategory,
131
+ MessageCategoryInfo,
132
+ MessageChannel,
133
+ MessageDelivery,
134
+ MessageEventData,
135
+ MessageRisk,
136
+ MessageScreening,
137
+ MessageStatus,
138
+ MessageType,
139
+ MessageUrgency,
140
+ MessageWithheld,
141
+ Metadata,
142
+ MetadataValue,
143
+ MetricCounts,
144
+ Metrics,
145
+ MetricsBucket,
146
+ MetricsPoint,
147
+ MinimalAgentCard,
148
+ NackResult,
149
+ Page,
150
+ PublicAgent,
151
+ PublicAgentCard,
152
+ PublicAgentKeys,
153
+ PublicCardUrls,
154
+ PublicHandle,
155
+ QueueMetrics,
156
+ QuietHours,
157
+ ResolvedAgent,
158
+ Resources,
159
+ ResumedInbox,
160
+ ScreeningReason,
161
+ ScreeningState,
162
+ SearchResult,
163
+ SignupChallenge,
164
+ SignupClaim,
165
+ SignupResult,
166
+ SignupWorkspace,
167
+ Streak,
168
+ StreamEvent,
169
+ StreamToken,
170
+ StructuredExtraction,
171
+ Thread,
172
+ ThreadWithMessages,
173
+ UnclaimedRestrictions,
174
+ UrgencyLevel,
175
+ VerificationInfo,
176
+ VerificationResult,
177
+ Webhook,
178
+ WebhookCatalogEntry,
179
+ WebhookEvent,
180
+ WebhookEventType,
181
+ WebhookPayload,
182
+ WebhookStats,
183
+ WebhookTestResult,
184
+ WorkspaceHandle,
185
+ )
186
+ from ._version import __version__
187
+ from ._webhooks import SIGNATURE_HEADER, TIMESTAMP_HEADER, compute_signature, verify_webhook
188
+
189
+ __all__ = [
190
+ "DEFAULT_BASE_URL",
191
+ "DEFAULT_TIMEOUT",
192
+ "NOT_GIVEN",
193
+ "SIGNATURE_HEADER",
194
+ "TIMESTAMP_HEADER",
195
+ "APIConnectionError",
196
+ "Account",
197
+ "AccountClaim",
198
+ "AckResult",
199
+ "AddAgentResult",
200
+ "AgentAssurance",
201
+ "AgentBundle",
202
+ "AgentCard",
203
+ "AgentCardInput",
204
+ "AgentCardListing",
205
+ "AgentCardSkill",
206
+ "AgentCardStatus",
207
+ "AgentCardVisibility",
208
+ "AgentKey",
209
+ "AgentKeyJwk",
210
+ "AgentKeyList",
211
+ "AgentMessaging",
212
+ "AgentStatus",
213
+ "Agentboxd",
214
+ "AgentboxdError",
215
+ "AiDisclosure",
216
+ "AiProcessing",
217
+ "AsyncAgentboxd",
218
+ "Attachment",
219
+ "AttachmentExtraction",
220
+ "AttachmentInput",
221
+ "AttachmentText",
222
+ "AuthenticationError",
223
+ "BadRequestError",
224
+ "BounceReason",
225
+ "BuiltinExtractionSchema",
226
+ "BusiestDay",
227
+ "ClaimRequestResult",
228
+ "ConsumeContext",
229
+ "Contact",
230
+ "ContactBulkDeleteResult",
231
+ "ContactDomain",
232
+ "ContactDomainList",
233
+ "ContactKind",
234
+ "ContactWithThreads",
235
+ "Deliverability",
236
+ "DeliverabilitySummary",
237
+ "Direction",
238
+ "DirectoryReportReason",
239
+ "DirectoryReportResult",
240
+ "DirectoryVerifyResult",
241
+ "Domain",
242
+ "DomainDkim",
243
+ "DomainDns",
244
+ "DomainDnsProvider",
245
+ "DomainRecord",
246
+ "DomainRecordKey",
247
+ "DomainStatus",
248
+ "DomainZoneFile",
249
+ "Draft",
250
+ "DraftApprover",
251
+ "DraftAttachment",
252
+ "DraftCitation",
253
+ "DraftError",
254
+ "DraftKeep",
255
+ "DraftReply",
256
+ "DraftSendResult",
257
+ "DraftStatus",
258
+ "EmergencyStopResult",
259
+ "EnvelopeEventData",
260
+ "EscalationContact",
261
+ "EscalationSettings",
262
+ "EscalationTrigger",
263
+ "EventStream",
264
+ "ExtendResult",
265
+ "ExtractionError",
266
+ "ExtractionMethod",
267
+ "ExtractionStatus",
268
+ "HeatmapDay",
269
+ "Identity",
270
+ "IdentityClient",
271
+ "IdentityClientType",
272
+ "IdentityClientWithSecret",
273
+ "IdentityFlow",
274
+ "IdentityScope",
275
+ "IdentitySignIn",
276
+ "IdentitySubjectType",
277
+ "IdentityToken",
278
+ "InboundQuality",
279
+ "Inbox",
280
+ "InboxEscalation",
281
+ "InboxForward",
282
+ "InboxIdentity",
283
+ "InboxIdentityApp",
284
+ "InternalServerError",
285
+ "KnowledgeDoc",
286
+ "KnowledgeListItem",
287
+ "KnowledgeSearchResult",
288
+ "KnowledgeSearchResults",
289
+ "Lease",
290
+ "LeaseClaim",
291
+ "ListDirection",
292
+ "ListEntries",
293
+ "ListEntry",
294
+ "ListKind",
295
+ "LocalScreen",
296
+ "LocalScreenReason",
297
+ "LocalSpam",
298
+ "MailroomError",
299
+ "Message",
300
+ "MessageAgent",
301
+ "MessageAi",
302
+ "MessageAnalysis",
303
+ "MessageApproval",
304
+ "MessageAuthor",
305
+ "MessageCategory",
306
+ "MessageCategoryInfo",
307
+ "MessageChannel",
308
+ "MessageDelivery",
309
+ "MessageEventData",
310
+ "MessageRisk",
311
+ "MessageScreening",
312
+ "MessageStatus",
313
+ "MessageType",
314
+ "MessageUrgency",
315
+ "MessageWithheld",
316
+ "Metadata",
317
+ "MetadataValue",
318
+ "MetricCounts",
319
+ "Metrics",
320
+ "MetricsBucket",
321
+ "MetricsPoint",
322
+ "MinimalAgentCard",
323
+ "NackResult",
324
+ "NotFoundError",
325
+ "NotGiven",
326
+ "Page",
327
+ "PermissionDeniedError",
328
+ "PublicAgent",
329
+ "PublicAgentCard",
330
+ "PublicAgentKeys",
331
+ "PublicCardUrls",
332
+ "PublicHandle",
333
+ "QueueMetrics",
334
+ "QuietHours",
335
+ "RateLimitError",
336
+ "ResolvedAgent",
337
+ "Resources",
338
+ "ResumedInbox",
339
+ "ScreeningReason",
340
+ "ScreeningState",
341
+ "SearchResult",
342
+ "Signup",
343
+ "SignupChallenge",
344
+ "SignupClaim",
345
+ "SignupResult",
346
+ "SignupWorkspace",
347
+ "Streak",
348
+ "StreamClosedError",
349
+ "StreamEvent",
350
+ "StreamToken",
351
+ "StructuredExtraction",
352
+ "Thread",
353
+ "ThreadWithMessages",
354
+ "UnclaimedRestrictions",
355
+ "UnprocessableEntityError",
356
+ "UrgencyLevel",
357
+ "VerificationInfo",
358
+ "VerificationResult",
359
+ "Webhook",
360
+ "WebhookCatalogEntry",
361
+ "WebhookEvent",
362
+ "WebhookEventType",
363
+ "WebhookPayload",
364
+ "WebhookStats",
365
+ "WebhookTestResult",
366
+ "WorkspaceHandle",
367
+ "__version__",
368
+ "aiter_all",
369
+ "attachment_from_bytes",
370
+ "attachment_from_path",
371
+ "compute_signature",
372
+ "consume_retry_delay",
373
+ "iter_all",
374
+ "solve_signup_challenge",
375
+ "verify_webhook",
376
+ ]
@@ -0,0 +1,43 @@
1
+ import base64
2
+ import mimetypes
3
+ import os
4
+ from typing import Optional, Union
5
+
6
+ from ._types import AttachmentInput
7
+
8
+ __all__ = ["attachment_from_bytes", "attachment_from_path"]
9
+
10
+ _DEFAULT_CONTENT_TYPE = "application/octet-stream"
11
+
12
+
13
+ def _guess(filename: str) -> str:
14
+ return mimetypes.guess_type(filename)[0] or _DEFAULT_CONTENT_TYPE
15
+
16
+
17
+ def attachment_from_bytes(
18
+ filename: str,
19
+ data: Union[bytes, bytearray, memoryview],
20
+ content_type: Optional[str] = None,
21
+ ) -> AttachmentInput:
22
+ """Build an attachment for ``messages.send`` / ``messages.reply`` from in-memory bytes.
23
+
24
+ ``content_type`` is guessed from ``filename`` when omitted.
25
+ """
26
+ return {
27
+ "filename": filename,
28
+ "content_type": content_type or _guess(filename),
29
+ "content_base64": base64.b64encode(bytes(data)).decode("ascii"),
30
+ }
31
+
32
+
33
+ def attachment_from_path(
34
+ path: Union[str, "os.PathLike[str]"],
35
+ content_type: Optional[str] = None,
36
+ *,
37
+ filename: Optional[str] = None,
38
+ ) -> AttachmentInput:
39
+ """Read a file and build an attachment. ``content_type`` is guessed from the name when omitted."""
40
+ name = filename or os.path.basename(os.fspath(path))
41
+ with open(path, "rb") as f:
42
+ data = f.read()
43
+ return attachment_from_bytes(name, data, content_type)