Skip to content

feat: add commune tool for email and SMS#359

Open
shanjairaj7 wants to merge 2 commits intoagentstack-ai:mainfrom
shanjairaj7:feat/commune-tool
Open

feat: add commune tool for email and SMS#359
shanjairaj7 wants to merge 2 commits intoagentstack-ai:mainfrom
shanjairaj7:feat/commune-tool

Conversation

@shanjairaj7
Copy link

Summary

This PR adds a Commune tool to AgentStack, giving agents a programmable email and SMS layer built specifically for AI workflows.

What is Commune?

Commune is not SMTP, not a human webmail client — it's an API-first communication platform designed for agents. Each project gets a dedicated email address and phone-capable inbox that the agent reads and writes programmatically. Think of it as the agent's own mailbox and phone line, accessible via a clean Python SDK.

Tools added (agentstack/_tools/commune/)

Tool What it does
send_email(to, subject, body) Sends an email from the agent's Commune address and returns a confirmation with the message ID
read_inbox(limit=10) Fetches recent emails from the inbox and returns a numbered, human-readable list with sender, subject, timestamp, and body preview
send_sms(to, body) Sends an SMS to an E.164 phone number, with client-side format validation before the API call

What this enables

  • Agents that send transactional emails or status reports (e.g. "run finished, here are the results")
  • Agents that poll their inbox and respond to incoming instructions or approvals
  • Agents that fire SMS alerts for time-sensitive events (on-call notifications, OTP codes, confirmations)

Quick example

from agentstack._tools.commune import send_email, read_inbox, send_sms

# Agent sends a report
send_email(
    to="team@example.com",
    subject="Nightly analysis complete",
    body="The pipeline finished at 03:14 UTC. 0 errors. Full report attached in the dashboard."
)

# Agent checks for replies before proceeding
messages = read_inbox(limit=5)
print(messages)

# Agent fires an SMS alert
send_sms(to="+15551234567", body="Pipeline alert: anomaly detected in sensor data. Check dashboard.")

Checklist

  • __init__.py with 3 tool functions, each with full docstrings
  • config.json with name, url, category, env, dependencies, tools, cta
  • E.164 validation on send_sms before API call
  • Follows same structure as exa and agentmail tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant