Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [0.4.0] — 2025-02-28

### Added
- OpenClaw email skill — installable `commune-email` skill with companion CLI helpers and an automated install script.
- `openclaw-email-sms/` — Email & SMS skills for OpenClaw agents. Includes two installable skills (`commune-email`, `commune-sms`) with companion CLI helpers and an automated install script.
- `capabilities/phone-numbers/` — Full phone number management guide: provisioning, toll-free vs local, allow/block lists, MMS
- `capabilities/sms/` — SMS capability deep-dive: send, receive webhooks, two-way conversations

### Changed
- Master README reorganized with three sections: Platforms, Use Cases, Capabilities
Expand All @@ -29,11 +31,11 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Added
- `use-cases/` section — five use case categories with working examples:
- `customer-support/` — email agent, omnichannel
- `hiring-and-recruiting/` — candidate outreach, interview scheduler
- `sales-and-marketing/` — cold email sequences, newsletter
- `customer-support/` — email agent, SMS bot, omnichannel
- `hiring-and-recruiting/` — SMS worker dispatch, candidate outreach, interview scheduler
- `sales-and-marketing/` — cold email sequences, SMS lead qualification, newsletter
- `research/` — email research agent
- `notifications-and-alerts/` — incident alerts
- `notifications-and-alerts/` — incident alerts, transactional SMS
- `capabilities/` section — six capability deep-dives:
- `quickstart/`, `email-threading/`, `extraction/`, `search/`, `webhooks/`

Expand All @@ -43,15 +45,16 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Added
- `typescript/` — Webhook handler and multi-agent coordination in TypeScript
- `mcp-server/` — MCP server with Claude Desktop + Cursor configuration
- `sms/` — SMS alert agent and two-way SMS conversation handler
- `mcp-server/` — 13-tool MCP server with Claude Desktop + Cursor configuration

---

## [0.1.0] — 2025-02-20

### Added
- Initial release with examples for four platforms:
- `langchain/` — customer support, lead outreach
- `langchain/` — customer support, lead outreach, email+SMS tools
- `crewai/` — support crew, outreach crew
- `openai-agents/` — support agent, multi-agent handoff
- `claude/` — support agent, extraction agent
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Contributing to email-for-agents

Thanks for contributing! This repo exists to help developers give their AI agents a real email address — the more examples and frameworks covered, the more useful it is for everyone.
Thanks for contributing! This repo exists to help developers give their AI agents a real email address and phone number — the more examples and frameworks covered, the more useful it is for everyone.

## What we welcome

- **New platform integrations** — AutoGen, Pydantic AI, Haystack, Dify, n8n, Flowise, etc.
- **New use-case examples** — real problems AI agents solve using email
- **New use-case examples** — real problems AI agents solve using email and SMS
- **Bug fixes** — if an example is broken, out of date, or uses the wrong API
- **Capability demos** — showing off specific Commune features (threading, extraction, vector search, webhooks)
- **Better documentation** — clearer READMEs, more helpful `.env.example` files
Expand All @@ -24,7 +24,7 @@ Thanks for contributing! This repo exists to help developers give their AI agent

- Python: `ruff` for linting (`pip install ruff && ruff check .`)
- TypeScript: strict mode, `tsc --noEmit` should pass
- No real API keys or email addresses in committed files
- No real API keys, email addresses, or phone numbers in committed files
- Every `.env.example` uses obvious placeholders (`your_api_key_here`, not `sk-abc123`)

## Example structure
Expand Down
80 changes: 64 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
[![LangChain](https://img.shields.io/badge/LangChain-compatible-green)](langchain/)
[![CrewAI](https://img.shields.io/badge/CrewAI-compatible-orange)](crewai/)
[![MCP](https://img.shields.io/badge/MCP-server-purple)](mcp-server/)
[![OpenClaw](https://img.shields.io/badge/OpenClaw-skills-orange)](openclaw-email-quickstart/)
[![OpenClaw](https://img.shields.io/badge/OpenClaw-skills-orange)](openclaw-email-sms/)

# Email for AI Agents
# Email & SMS for AI Agents

**Give your AI agent a real email address. Production-ready examples for LangChain, CrewAI, OpenAI Agents SDK, Claude, MCP, OpenClaw, and agent-to-agent networks. Powered by [Commune](https://commune.email).**
**Give your AI agent a real email address and phone number. Production-ready examples for LangChain, CrewAI, OpenAI Agents SDK, Claude, MCP, OpenClaw, and agent-to-agent networks. Powered by [Commune](https://commune.email).**

---

Expand Down Expand Up @@ -50,20 +50,21 @@ That's a real, deliverable inbox. Your agent can now send replies, search its th

## OpenClaw

> **OpenClaw users:** install the Commune email skill in 30 seconds. Your agent gets a real inbox it can use from WhatsApp, Telegram, or wherever it lives.
> **OpenClaw users:** install the Commune email + SMS skills in 30 seconds. Your agent gets a real inbox and phone number it can use from WhatsApp, Telegram, or wherever it lives.

```bash
git clone https://github.com/commune-dev/commune-openclaw-email-quickstart
cd commune-openclaw-email-quickstart
git clone https://github.com/shanjai-raj/commune-openclaw-email-sms-quickstart
cd commune-openclaw-email-sms-quickstart
bash install.sh
```

The installer copies the skill into `~/.openclaw/workspace/skills/`:
The installer copies two skills into `~/.openclaw/workspace/skills/`:
- **`commune-email`** — send, receive, search, and manage email threads
- **`commune-sms`** — send SMS, read conversations, manage phone numbers

Once installed, your agent understands natural-language commands like "check my email" and "reply to that thread about the contract."
Once installed, your agent understands natural-language commands like "check my email", "reply to that thread about the contract", and "text Alex that I'm running late."

[→ Dedicated repo with use cases](https://github.com/commune-dev/commune-openclaw-email-quickstart)
[→ Full OpenClaw setup guide](openclaw-email-sms/) · [→ Dedicated repo with use cases](https://github.com/shanjai-raj/commune-openclaw-email-sms-quickstart)

---

Expand Down Expand Up @@ -112,6 +113,7 @@ No shared database. No coordination layer. The thread IS the task context.
| Customer Support Agent | [✅](langchain/) | [✅](crewai/) | [✅](openai-agents/) | [✅](claude/) | [✅](mcp-server/) | [✅](typescript/) | — |
| Lead Outreach | [✅](langchain/) | [✅](crewai/) | — | [✅](claude/) | — | — | — |
| Multi-Agent Coordination | — | [✅](crewai/) | — | — | — | [✅](typescript/) | [✅](agent-to-agent/) |
| SMS Notifications | — | — | — | — | [✅](mcp-server/) | [✅](typescript/) | — |
| Structured Extraction | — | — | — | [✅](claude/) | [✅](mcp-server/) | — | — |
| Webhook Handler | — | — | — | — | — | [✅](typescript/) | — |
| Task Delegation | — | — | — | — | — | — | [✅](agent-to-agent/) |
Expand All @@ -120,11 +122,12 @@ No shared database. No coordination layer. The thread IS the task context.

## Why email for agents?

Most agent frameworks are great at reasoning — but stop short when it comes to communicating with the outside world asynchronously. Email fills that gap:
Most agent frameworks are great at reasoning — but stop short when it comes to communicating with the outside world asynchronously. Email and SMS fill that gap:

- **Agents are async by nature.** A task might take minutes or hours. Email is the right protocol for async handoffs — your agent sends, the user replies when ready, the thread stays intact.
- **Email is the universal protocol.** Every system on the planet speaks SMTP. Your agent can talk to any user, any tool, any service — no integration required.
- **Threading keeps context.** `In-Reply-To` and `References` headers (RFC 5322) tie every message to its thread. Your agent never loses the conversation history.
- **SMS adds the urgency channel.** Some things need immediate attention. Two-way SMS lets your agent escalate, notify, and confirm — all from a real phone number.
- **Agent-to-agent is next.** Agents will increasingly communicate with other agents — delegating tasks, routing results, building mesh networks. Email is the right protocol: async, persistent, addressable, universally supported.

### What Commune adds on top of bare SMTP
Expand Down Expand Up @@ -188,9 +191,16 @@ Every example is self-contained: install, set your key, run.

### OpenClaw

OpenClaw is the most popular open-source personal agent framework. Commune provides a first-party email skill — install once, and your OpenClaw agent can manage a real inbox from any chat interface.
OpenClaw is the most popular open-source personal agent framework. Commune provides first-party skills for email and SMS — install once, and your OpenClaw agent can manage a real inbox from any chat interface.

[→ Dedicated quickstart repo](https://github.com/commune-dev/commune-openclaw-email-quickstart)
| Example | Description |
|---------|-------------|
| [Personal Assistant](openclaw-email-sms/use-cases/personal-assistant/) | Agent manages your personal email — check, reply, summarize from WhatsApp |
| [Company Agent](openclaw-email-sms/use-cases/company-assistant/) | Agent handles customer email: triage, draft replies, SMS escalation |
| [Skill: commune-email](openclaw-email-sms/skills/) | Full email skill: create inboxes, read threads, send, reply, search |
| [Skill: commune-sms](openclaw-email-sms/skills/) | SMS skill: send, receive, list phone numbers |

[→ See all OpenClaw examples](openclaw-email-sms/) · [→ Dedicated quickstart repo](https://github.com/shanjai-raj/commune-openclaw-email-sms-quickstart)

---

Expand All @@ -210,7 +220,7 @@ Each agent gets its own inbox address. Agents delegate tasks by sending emails,

### LangChain

LangChain tools wrap Commune with the `@tool` decorator. Your chain gains `send_email`, `read_inbox`, and `search_threads` as first-class tools — callable by any LLM in the chain.
LangChain tools wrap Commune with the `@tool` decorator. Your chain gains `send_email`, `read_inbox`, `search_threads`, and `send_sms` as first-class tools — callable by any LLM in the chain.

| Example | Description |
|---------|-------------|
Expand Down Expand Up @@ -268,6 +278,7 @@ Run `commune-mcp` as a local MCP server and connect it to Claude Desktop, Cursor
| Example | Description |
|---------|-------------|
| [Customer Support via MCP](mcp-server/) | Full support workflow through Claude Desktop |
| [SMS Notifications via MCP](mcp-server/) | Provision a number and send SMS from within a chat session |
| [Structured Extraction via MCP](mcp-server/) | Define schemas and extract structured data from inbound mail |

[→ See all MCP examples](mcp-server/)
Expand All @@ -276,12 +287,13 @@ Run `commune-mcp` as a local MCP server and connect it to Claude Desktop, Cursor

### TypeScript

Full end-to-end TypeScript examples: webhook handlers with HMAC verification and multi-agent coordination with typed payloads — all typed against the `commune-ai` SDK.
Full end-to-end TypeScript examples: webhook handlers with HMAC verification, multi-agent coordination with typed payloads, and SMS flows — all typed against the `commune-ai` SDK.

| Example | Description |
|---------|-------------|
| [Customer Support Agent](typescript/) | Express webhook handler + Commune reply flow |
| [Multi-Agent Coordination](typescript/) | Two agents hand off tasks over email with typed thread payloads |
| [SMS Notifications](typescript/) | Provision a number, send SMS, handle inbound replies |
| [Webhook Handler](typescript/) | Reference implementation with `verifyCommuneWebhook` and retry-safe handling |

[→ See all TypeScript examples](typescript/)
Expand All @@ -295,9 +307,12 @@ Browse examples by what you want to build:
| Use Case | Channel | Complexity |
|----------|---------|------------|
| [AI Email Support Agent](use-cases/customer-support/email-support-agent/) | Email | Beginner |
| [SMS Worker Dispatch](use-cases/hiring-and-recruiting/sms-worker-dispatch/) | SMS | Intermediate |
| [Candidate Outreach Sequence](use-cases/hiring-and-recruiting/candidate-email-outreach/) | Email | Intermediate |
| [Cold Email Outreach](use-cases/sales-and-marketing/cold-outreach-sequences/) | Email | Intermediate |
| [Incident Alert System](use-cases/notifications-and-alerts/incident-alerts/) | Email | Advanced |
| [SMS Lead Qualification](use-cases/sales-and-marketing/sms-lead-qualification/) | SMS | Intermediate |
| [Omnichannel Support](use-cases/customer-support/omnichannel-support/) | Email + SMS | Advanced |
| [Incident Alert System](use-cases/notifications-and-alerts/incident-alerts/) | Email + SMS | Advanced |
| [Multi-Agent Coordination](typescript/multi-agent/) | Email | Advanced |
| [Agent-to-Agent Task Delegation](agent-to-agent/) | Email | Advanced |

Expand All @@ -311,16 +326,41 @@ Reference examples for every Commune feature:

| Capability | What it does | Get started |
|-----------|-------------|-------------|
| [Quickstart](capabilities/quickstart/) | Give your agent an email address | 3 lines of code |
| [Quickstart](capabilities/quickstart/) | Give your agent an email + phone | 3 lines of code |
| [Email Threading](capabilities/email-threading/) | Reply in the same thread | RFC 5322 explained |
| [Structured Extraction](capabilities/structured-extraction/) | Auto-parse email fields to JSON | Zero extra LLM calls |
| [Semantic Search](capabilities/semantic-search/) | Natural language inbox search | Vector embeddings |
| [Webhook Delivery](capabilities/webhook-delivery/) | Receive emails in real time | HMAC verified, 8 retries |
| [Phone Numbers](capabilities/phone-numbers/) | Agent phone number management | Provision + SMS + voice |
| [SMS](capabilities/sms/) | Send, receive, broadcast SMS | Quickstart → mass SMS |

→ [Browse all capabilities](capabilities/)

---

### SMS

Your agent can also send and receive SMS.

```python
# Provision a real phone number
phone = commune.phoneNumbers.provision()
print(phone.number) # → +14155552671

# Send an SMS
commune.sms.send(
to="+14155551234",
body="Your order has shipped.",
phone_number_id=phone.id,
)
```

Two-way conversations. Semantic search across SMS and email in a single unified index. Escalation from email thread to SMS with one method call.

[→ See SMS examples](sms/)

---

## Key capabilities

<details>
Expand Down Expand Up @@ -380,6 +420,8 @@ for thread in results:
print(thread.subject, thread.score)
```

SMS messages are indexed in the same vector store. One query surfaces relevant context regardless of channel.

</details>

<details>
Expand Down Expand Up @@ -436,6 +478,9 @@ app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
| `commune.threads.messages(thread_id)` | Get all messages in a thread |
| `commune.search.threads({ query, inbox_id })` | Semantic search across threads |
| `commune.threads.set_status(thread_id, status)` | Update thread status |
| `commune.sms.send({ to, body, phone_number_id })` | Send an SMS |
| `commune.phone_numbers.provision()` | Provision a real phone number |

### TypeScript (`commune-ai`)

| Method | Description |
Expand All @@ -446,6 +491,9 @@ app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
| `commune.threads.messages(threadId)` | Get all messages in a thread |
| `commune.search.threads({ query, inboxId })` | Semantic search across threads |
| `commune.threads.setStatus(threadId, status)` | Update thread status |
| `commune.sms.send({ to, body, phoneNumberId })` | Send an SMS |
| `commune.phoneNumbers.provision()` | Provision a real phone number |

---

## Interactive Notebooks
Expand Down
2 changes: 1 addition & 1 deletion agent-to-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,5 @@ python orchestrator.py

- [Full capability reference: extraction schemas](../capabilities/extraction/)
- [Full capability reference: webhook delivery](../capabilities/webhooks/)
- [OpenClaw personal agent setup](https://github.com/commune-dev/commune-openclaw-email-quickstart)
- [OpenClaw personal agent setup](../openclaw-email-sms/)
- [TypeScript multi-agent patterns](../typescript/)
10 changes: 7 additions & 3 deletions capabilities/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Deep dives on each Commune capability. Start here to understand how features wor
| [Structured Extraction](structured-extraction/) | Auto-parse email fields to JSON schema | Support tickets, orders, applications |
| [Semantic Search](semantic-search/) | Natural language search across history | Retrieving context before replying |
| [Webhook Delivery](webhook-delivery/) | Real-time delivery with 8-retry guarantee | Production agents needing reliability |
| [Phone Numbers](phone-numbers/) | Provision and manage real phone numbers | SMS-capable agents |
| [SMS](sms/) | Send, receive, broadcast SMS messages | Urgent notifications, lead qualification |

## Architecture overview

Expand All @@ -22,10 +24,10 @@ Your AI Agent
├── Inbox Management (create, configure, delete)
├── Email Engine (inbound processing, outbound delivery)
├── Thread Store (RFC 5322 threading, history)
├── Vector Index (semantic search across email)
├── Vector Index (semantic search across email + SMS)
├── Extraction Engine (JSON schema parsing, zero extra LLM calls)
├── Webhook Dispatcher (HMAC-signed, 8 retries, circuit breaker)
└── Webhook Dispatcher (HMAC-signed, 8 retries, circuit breaker)
└── SMS Gateway (provision, send, receive, search)
```

## Recommended path
Expand All @@ -34,7 +36,7 @@ Your AI Agent
quickstart/ → email-threading/ → structured-extraction/ → webhook-delivery/
```

1. **[quickstart/](quickstart/)** — provision an inbox, send your first message. Covers Python and TypeScript. Takes under 60 seconds.
1. **[quickstart/](quickstart/)** — provision an inbox and phone number, send your first message. Covers Python and TypeScript. Takes under 60 seconds.

2. **[email-threading/](email-threading/)** — learn how to keep replies in the correct thread. Covers `In-Reply-To` / `References` headers (RFC 5322) and the `thread_id` pattern.

Expand All @@ -45,6 +47,8 @@ quickstart/ → email-threading/ → structured-extraction/ → webhook-delivery
After those four, explore based on what you need:

- **[semantic-search/](semantic-search/)** — natural language search across your agent's entire inbox history using vector embeddings.
- **[phone-numbers/](phone-numbers/)** — provision and manage real phone numbers programmatically.
- **[sms/](sms/)** — send, receive, and broadcast SMS from a real phone number.

## Security layers

Expand Down
Loading
Loading