mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
Format agent mail blocks to 50 character line limit
This commit is contained in:
@@ -81,7 +81,9 @@ class AgentMailGetMessageAttachmentBlock(Block):
|
||||
message_id=input_data.message_id,
|
||||
attachment_id=input_data.attachment_id,
|
||||
)
|
||||
encoded = base64.b64encode(data).decode() if isinstance(data, bytes) else str(data)
|
||||
encoded = (
|
||||
base64.b64encode(data).decode() if isinstance(data, bytes) else str(data)
|
||||
)
|
||||
|
||||
yield "content_base64", encoded
|
||||
yield "attachment_id", input_data.attachment_id
|
||||
@@ -103,9 +105,7 @@ class AgentMailGetThreadAttachmentBlock(Block):
|
||||
inbox_id: str = SchemaField(
|
||||
description="Inbox ID or email address the thread belongs to"
|
||||
)
|
||||
thread_id: str = SchemaField(
|
||||
description="Thread ID containing the attachment"
|
||||
)
|
||||
thread_id: str = SchemaField(description="Thread ID containing the attachment")
|
||||
attachment_id: str = SchemaField(
|
||||
description="Attachment ID to download (from a message's attachments array within the thread)"
|
||||
)
|
||||
@@ -137,7 +137,9 @@ class AgentMailGetThreadAttachmentBlock(Block):
|
||||
thread_id=input_data.thread_id,
|
||||
attachment_id=input_data.attachment_id,
|
||||
)
|
||||
encoded = base64.b64encode(data).decode() if isinstance(data, bytes) else str(data)
|
||||
encoded = (
|
||||
base64.b64encode(data).decode() if isinstance(data, bytes) else str(data)
|
||||
)
|
||||
|
||||
yield "content_base64", encoded
|
||||
yield "attachment_id", input_data.attachment_id
|
||||
|
||||
@@ -46,20 +46,20 @@ class AgentMailCreateDraftBlock(Block):
|
||||
to: list[str] = SchemaField(
|
||||
description="Recipient email addresses (e.g. ['user@example.com'])"
|
||||
)
|
||||
subject: str = SchemaField(
|
||||
description="Email subject line", default=""
|
||||
)
|
||||
text: str = SchemaField(
|
||||
description="Plain text body of the draft", default=""
|
||||
)
|
||||
subject: str = SchemaField(description="Email subject line", default="")
|
||||
text: str = SchemaField(description="Plain text body of the draft", default="")
|
||||
html: str = SchemaField(
|
||||
description="Rich HTML body of the draft", default="", advanced=True
|
||||
)
|
||||
cc: list[str] = SchemaField(
|
||||
description="CC recipient email addresses", default_factory=list, advanced=True
|
||||
description="CC recipient email addresses",
|
||||
default_factory=list,
|
||||
advanced=True,
|
||||
)
|
||||
bcc: list[str] = SchemaField(
|
||||
description="BCC recipient email addresses", default_factory=list, advanced=True
|
||||
description="BCC recipient email addresses",
|
||||
default_factory=list,
|
||||
advanced=True,
|
||||
)
|
||||
in_reply_to: str = SchemaField(
|
||||
description="Message ID this draft replies to, for threading follow-up drafts",
|
||||
@@ -73,7 +73,9 @@ class AgentMailCreateDraftBlock(Block):
|
||||
)
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
draft_id: str = SchemaField(description="Unique identifier of the created draft")
|
||||
draft_id: str = SchemaField(
|
||||
description="Unique identifier of the created draft"
|
||||
)
|
||||
send_status: str = SchemaField(
|
||||
description="'scheduled' if send_at was set, empty otherwise. Values: scheduled, sending, failed.",
|
||||
default="",
|
||||
@@ -147,9 +149,7 @@ class AgentMailGetDraftBlock(Block):
|
||||
send_at: str = SchemaField(
|
||||
description="Scheduled send time (ISO 8601) if set", default=""
|
||||
)
|
||||
result: dict = SchemaField(
|
||||
description="Complete draft object with all fields"
|
||||
)
|
||||
result: dict = SchemaField(description="Complete draft object with all fields")
|
||||
error: str = SchemaField(description="Error message if the operation failed")
|
||||
|
||||
def __init__(self):
|
||||
@@ -271,12 +271,8 @@ class AgentMailUpdateDraftBlock(Block):
|
||||
description="Updated recipient email addresses (replaces existing list)",
|
||||
default_factory=list,
|
||||
)
|
||||
subject: str = SchemaField(
|
||||
description="Updated subject line", default=""
|
||||
)
|
||||
text: str = SchemaField(
|
||||
description="Updated plain text body", default=""
|
||||
)
|
||||
subject: str = SchemaField(description="Updated subject line", default="")
|
||||
text: str = SchemaField(description="Updated plain text body", default="")
|
||||
html: str = SchemaField(
|
||||
description="Updated HTML body", default="", advanced=True
|
||||
)
|
||||
@@ -288,12 +284,8 @@ class AgentMailUpdateDraftBlock(Block):
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
draft_id: str = SchemaField(description="The updated draft ID")
|
||||
send_status: str = SchemaField(
|
||||
description="Updated send status", default=""
|
||||
)
|
||||
result: dict = SchemaField(
|
||||
description="Complete updated draft object"
|
||||
)
|
||||
send_status: str = SchemaField(description="Updated send status", default="")
|
||||
result: dict = SchemaField(description="Complete updated draft object")
|
||||
error: str = SchemaField(description="Error message if the operation failed")
|
||||
|
||||
def __init__(self):
|
||||
@@ -358,9 +350,7 @@ class AgentMailSendDraftBlock(Block):
|
||||
thread_id: str = SchemaField(
|
||||
description="Thread ID the sent message belongs to"
|
||||
)
|
||||
result: dict = SchemaField(
|
||||
description="Complete sent message object"
|
||||
)
|
||||
result: dict = SchemaField(description="Complete sent message object")
|
||||
error: str = SchemaField(description="Error message if the operation failed")
|
||||
|
||||
def __init__(self):
|
||||
@@ -402,7 +392,9 @@ class AgentMailDeleteDraftBlock(Block):
|
||||
inbox_id: str = SchemaField(
|
||||
description="Inbox ID or email address the draft belongs to"
|
||||
)
|
||||
draft_id: str = SchemaField(description="Draft ID to delete (also cancels scheduled sends)")
|
||||
draft_id: str = SchemaField(
|
||||
description="Draft ID to delete (also cancels scheduled sends)"
|
||||
)
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
success: bool = SchemaField(
|
||||
|
||||
@@ -7,6 +7,7 @@ AgentMail API. You can create thousands of inboxes on demand.
|
||||
"""
|
||||
|
||||
from agentmail import AgentMail
|
||||
from agentmail.inboxes.types import CreateInboxRequest
|
||||
|
||||
from backend.sdk import (
|
||||
APIKeyCredentials,
|
||||
@@ -42,14 +43,17 @@ class AgentMailCreateInboxBlock(Block):
|
||||
username: str = SchemaField(
|
||||
description="Local part of the email address (e.g. 'support' for support@domain.com). Leave empty to auto-generate.",
|
||||
default="",
|
||||
advanced=False,
|
||||
)
|
||||
domain: str = SchemaField(
|
||||
description="Email domain (e.g. 'mydomain.com'). Defaults to agentmail.to if empty.",
|
||||
default="",
|
||||
advanced=False,
|
||||
)
|
||||
display_name: str = SchemaField(
|
||||
description="Friendly name shown in the 'From' field of sent emails (e.g. 'Support Agent')",
|
||||
default="",
|
||||
advanced=False,
|
||||
)
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
@@ -85,7 +89,7 @@ class AgentMailCreateInboxBlock(Block):
|
||||
if input_data.display_name:
|
||||
params["display_name"] = input_data.display_name
|
||||
|
||||
inbox = client.inboxes.create(**params)
|
||||
inbox = client.inboxes.create(request=CreateInboxRequest(**params))
|
||||
result = inbox.__dict__ if hasattr(inbox, "__dict__") else {}
|
||||
|
||||
yield "inbox_id", inbox.inbox_id
|
||||
@@ -111,9 +115,7 @@ class AgentMailGetInboxBlock(Block):
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
inbox_id: str = SchemaField(description="Unique identifier of the inbox")
|
||||
email_address: str = SchemaField(
|
||||
description="Full email address of the inbox"
|
||||
)
|
||||
email_address: str = SchemaField(description="Full email address of the inbox")
|
||||
display_name: str = SchemaField(
|
||||
description="Friendly name shown in the 'From' field", default=""
|
||||
)
|
||||
|
||||
@@ -143,7 +143,9 @@ class AgentMailCreateListEntryBlock(Block):
|
||||
)
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
entry: str = SchemaField(description="The email address or domain that was added")
|
||||
entry: str = SchemaField(
|
||||
description="The email address or domain that was added"
|
||||
)
|
||||
result: dict = SchemaField(description="Complete entry object")
|
||||
error: str = SchemaField(description="Error message if the operation failed")
|
||||
|
||||
@@ -191,12 +193,12 @@ class AgentMailGetListEntryBlock(Block):
|
||||
list_type: ListType = SchemaField(
|
||||
description="'allow' for whitelist, 'block' for blacklist"
|
||||
)
|
||||
entry: str = SchemaField(
|
||||
description="Email address or domain to look up"
|
||||
)
|
||||
entry: str = SchemaField(description="Email address or domain to look up")
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
entry: str = SchemaField(description="The email address or domain that was found")
|
||||
entry: str = SchemaField(
|
||||
description="The email address or domain that was found"
|
||||
)
|
||||
result: dict = SchemaField(description="Complete entry object with metadata")
|
||||
error: str = SchemaField(description="Error message if the operation failed")
|
||||
|
||||
|
||||
@@ -45,9 +45,7 @@ class AgentMailSendMessageBlock(Block):
|
||||
to: str = SchemaField(
|
||||
description="Recipient email address (e.g. 'user@example.com')"
|
||||
)
|
||||
subject: str = SchemaField(
|
||||
description="Email subject line"
|
||||
)
|
||||
subject: str = SchemaField(description="Email subject line")
|
||||
text: str = SchemaField(
|
||||
description="Plain text body of the email. Always provide this as a fallback for email clients that don't render HTML."
|
||||
)
|
||||
@@ -214,9 +212,7 @@ class AgentMailGetMessageBlock(Block):
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
message_id: str = SchemaField(description="Unique identifier of the message")
|
||||
thread_id: str = SchemaField(
|
||||
description="Thread this message belongs to"
|
||||
)
|
||||
thread_id: str = SchemaField(description="Thread this message belongs to")
|
||||
subject: str = SchemaField(description="Email subject line")
|
||||
text: str = SchemaField(
|
||||
description="Full plain text body (may include quoted reply history)"
|
||||
@@ -225,9 +221,7 @@ class AgentMailGetMessageBlock(Block):
|
||||
description="Just the new reply content with quoted history stripped. Best for AI processing.",
|
||||
default="",
|
||||
)
|
||||
html: str = SchemaField(
|
||||
description="HTML body of the email", default=""
|
||||
)
|
||||
html: str = SchemaField(description="HTML body of the email", default="")
|
||||
result: dict = SchemaField(
|
||||
description="Complete message object with all fields including sender, recipients, attachments, labels"
|
||||
)
|
||||
@@ -279,9 +273,7 @@ class AgentMailReplyToMessageBlock(Block):
|
||||
message_id: str = SchemaField(
|
||||
description="Message ID to reply to (e.g. '<abc123@agentmail.to>')"
|
||||
)
|
||||
text: str = SchemaField(
|
||||
description="Plain text body of the reply"
|
||||
)
|
||||
text: str = SchemaField(description="Plain text body of the reply")
|
||||
html: str = SchemaField(
|
||||
description="Rich HTML body of the reply",
|
||||
default="",
|
||||
@@ -292,9 +284,7 @@ class AgentMailReplyToMessageBlock(Block):
|
||||
message_id: str = SchemaField(
|
||||
description="Unique identifier of the reply message"
|
||||
)
|
||||
thread_id: str = SchemaField(
|
||||
description="Thread ID the reply was added to"
|
||||
)
|
||||
thread_id: str = SchemaField(description="Thread ID the reply was added to")
|
||||
result: dict = SchemaField(
|
||||
description="Complete reply message object with all metadata"
|
||||
)
|
||||
@@ -344,12 +334,8 @@ class AgentMailForwardMessageBlock(Block):
|
||||
inbox_id: str = SchemaField(
|
||||
description="Inbox ID or email address to forward from"
|
||||
)
|
||||
message_id: str = SchemaField(
|
||||
description="Message ID to forward"
|
||||
)
|
||||
to: str = SchemaField(
|
||||
description="Email address to forward the message to"
|
||||
)
|
||||
message_id: str = SchemaField(description="Message ID to forward")
|
||||
to: str = SchemaField(description="Email address to forward the message to")
|
||||
subject: str = SchemaField(
|
||||
description="Override the subject line (defaults to 'Fwd: <original subject>')",
|
||||
default="",
|
||||
@@ -425,9 +411,7 @@ class AgentMailUpdateMessageBlock(Block):
|
||||
inbox_id: str = SchemaField(
|
||||
description="Inbox ID or email address the message belongs to"
|
||||
)
|
||||
message_id: str = SchemaField(
|
||||
description="Message ID to update labels on"
|
||||
)
|
||||
message_id: str = SchemaField(description="Message ID to update labels on")
|
||||
add_labels: list[str] = SchemaField(
|
||||
description="Labels to add (e.g. ['read', 'processed', 'high-priority'])",
|
||||
default_factory=list,
|
||||
|
||||
@@ -226,9 +226,7 @@ class AgentMailListPodInboxesBlock(Block):
|
||||
credentials: CredentialsMetaInput = agent_mail.credentials_field(
|
||||
description="AgentMail API key from https://console.agentmail.to"
|
||||
)
|
||||
pod_id: str = SchemaField(
|
||||
description="Pod ID to list inboxes from"
|
||||
)
|
||||
pod_id: str = SchemaField(description="Pod ID to list inboxes from")
|
||||
limit: int = SchemaField(
|
||||
description="Maximum number of inboxes to return per page (1-100)",
|
||||
default=20,
|
||||
@@ -292,9 +290,7 @@ class AgentMailListPodThreadsBlock(Block):
|
||||
credentials: CredentialsMetaInput = agent_mail.credentials_field(
|
||||
description="AgentMail API key from https://console.agentmail.to"
|
||||
)
|
||||
pod_id: str = SchemaField(
|
||||
description="Pod ID to list threads from"
|
||||
)
|
||||
pod_id: str = SchemaField(description="Pod ID to list threads from")
|
||||
limit: int = SchemaField(
|
||||
description="Maximum number of threads to return per page (1-100)",
|
||||
default=20,
|
||||
@@ -364,9 +360,7 @@ class AgentMailListPodDraftsBlock(Block):
|
||||
credentials: CredentialsMetaInput = agent_mail.credentials_field(
|
||||
description="AgentMail API key from https://console.agentmail.to"
|
||||
)
|
||||
pod_id: str = SchemaField(
|
||||
description="Pod ID to list drafts from"
|
||||
)
|
||||
pod_id: str = SchemaField(description="Pod ID to list drafts from")
|
||||
limit: int = SchemaField(
|
||||
description="Maximum number of drafts to return per page (1-100)",
|
||||
default=20,
|
||||
@@ -430,9 +424,7 @@ class AgentMailCreatePodInboxBlock(Block):
|
||||
credentials: CredentialsMetaInput = agent_mail.credentials_field(
|
||||
description="AgentMail API key from https://console.agentmail.to"
|
||||
)
|
||||
pod_id: str = SchemaField(
|
||||
description="Pod ID to create the inbox in"
|
||||
)
|
||||
pod_id: str = SchemaField(description="Pod ID to create the inbox in")
|
||||
username: str = SchemaField(
|
||||
description="Local part of the email address (e.g. 'support'). Leave empty to auto-generate.",
|
||||
default="",
|
||||
@@ -450,9 +442,7 @@ class AgentMailCreatePodInboxBlock(Block):
|
||||
inbox_id: str = SchemaField(
|
||||
description="Unique identifier of the created inbox"
|
||||
)
|
||||
email_address: str = SchemaField(
|
||||
description="Full email address of the inbox"
|
||||
)
|
||||
email_address: str = SchemaField(description="Full email address of the inbox")
|
||||
result: dict = SchemaField(
|
||||
description="Complete inbox object with all metadata"
|
||||
)
|
||||
|
||||
@@ -87,9 +87,7 @@ class AgentMailListInboxThreadsBlock(Block):
|
||||
if input_data.labels:
|
||||
params["labels"] = input_data.labels
|
||||
|
||||
response = client.inboxes.threads.list(
|
||||
inbox_id=input_data.inbox_id, **params
|
||||
)
|
||||
response = client.inboxes.threads.list(inbox_id=input_data.inbox_id, **params)
|
||||
threads = [
|
||||
t.__dict__ if hasattr(t, "__dict__") else t
|
||||
for t in getattr(response, "threads", [])
|
||||
@@ -116,9 +114,7 @@ class AgentMailGetInboxThreadBlock(Block):
|
||||
inbox_id: str = SchemaField(
|
||||
description="Inbox ID or email address the thread belongs to"
|
||||
)
|
||||
thread_id: str = SchemaField(
|
||||
description="Thread ID to retrieve"
|
||||
)
|
||||
thread_id: str = SchemaField(description="Thread ID to retrieve")
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
thread_id: str = SchemaField(description="Unique identifier of the thread")
|
||||
@@ -173,9 +169,7 @@ class AgentMailDeleteInboxThreadBlock(Block):
|
||||
inbox_id: str = SchemaField(
|
||||
description="Inbox ID or email address the thread belongs to"
|
||||
)
|
||||
thread_id: str = SchemaField(
|
||||
description="Thread ID to permanently delete"
|
||||
)
|
||||
thread_id: str = SchemaField(description="Thread ID to permanently delete")
|
||||
|
||||
class Output(BlockSchemaOutput):
|
||||
success: bool = SchemaField(
|
||||
|
||||
Reference in New Issue
Block a user