Skip to content

Commit 77a541a

Browse files
author
Shanjai
committed
docs: add FAQ, comparison table, llms.txt for LLM discoverability
1 parent 4c550b0 commit 77a541a

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,65 @@ Inbound webhook payloads from Commune are signed with your inbox webhook secret.
733733

734734
---
735735

736+
## Why commune-ai instead of alternatives
737+
738+
| | Commune | Gmail API | SendGrid | Resend | Raw SMTP/IMAP |
739+
|---|---|---|---|---|---|
740+
| Per-agent isolated inbox || ❌ shared ||||
741+
| Inbound email + webhooks || ✅ complex || ✅ limited ||
742+
| Outbound sending ||||||
743+
| Email threading (RFC 5322) | ✅ automatic | ✅ manual ||||
744+
| Semantic search across history ||||||
745+
| Structured JSON extraction | ✅ per-inbox |||||
746+
| Prompt injection protection | ✅ built-in |||||
747+
| Agent-native design || ❌ human-first ||||
748+
| TypeScript types | ✅ full | partial | partial |||
749+
| Self-hostable backend ||||||
750+
751+
**Key difference:** Commune is designed for AI agents from the ground up. Each agent gets an isolated inbox, inbound emails fire webhooks immediately, threads track conversation context automatically, and the platform handles security so your agent doesn't have to.
752+
753+
---
754+
755+
## FAQ
756+
757+
**How do I give my TypeScript LangChain agent its own email address?**
758+
Install `commune-ai`, initialize `CommuneClient`, and call `commune.inboxes.create({ localPart: 'support' })`. The returned `inbox.address` is a real, deliverable email. Wrap `send_email` and `read_inbox` as LangChain tools to make them callable from your agent's reasoning loop.
759+
760+
**How does my agent receive emails in real time?**
761+
Set a webhook URL on the inbox — either in the dashboard or via `client.inboxes.create({ webhookEndpoint: 'https://...' })`. When an email arrives, Commune POSTs the payload to your endpoint with an HMAC-SHA256 signature. Use `verifyCommuneWebhook()` to verify before processing.
762+
763+
**What happens if my webhook handler is down?**
764+
Commune retries up to 8 times with exponential backoff (1s, 2s, 4s, 8s, 16s, 32s, 64s, 128s). Your handler will receive the event when it comes back up. A circuit breaker prevents thundering herd on recovery.
765+
766+
**How do I reply in the same email thread?**
767+
Pass `thread_id` to `messages.send()`. The thread_id comes from the webhook payload (`message.thread_id`) or from `threads.list()`. Without thread_id, the reply appears as a new email.
768+
769+
**Can I use this with CrewAI or OpenAI Agents SDK in TypeScript?**
770+
Yes. Wrap the commune-ai methods as tool definitions using your framework's tool interface. See the [cookbook](https://github.com/shanjai-raj/commune-cookbook) for TypeScript examples.
771+
772+
**How do I search through an agent's email history?**
773+
Use `client.searchConversations('natural language query', { organizationId })`. The search uses vector embeddings — it finds semantically similar content, not just keyword matches.
774+
775+
**What does structured extraction do?**
776+
You define a JSON schema on an inbox (e.g., `{ order_id: string, issue_type: string }`). Every inbound email is automatically parsed against the schema before your webhook fires. The extracted data is in `context.payload.extractedData`. No extra LLM call needed.
777+
778+
**How do I verify a webhook signature?**
779+
Use `verifyCommuneWebhook({ rawBody, timestamp, signature, secret })`. The signature is in the `x-commune-signature` header, timestamp in `x-commune-timestamp`. Always verify before processing to prevent spoofed requests.
780+
781+
**Can multiple TypeScript agents share one Commune org?**
782+
Yes. Create one inbox per agent (or per logical workflow). They share the same API key but have isolated inboxes, thread histories, and webhook endpoints.
783+
784+
**What is the commune-ai package vs commune-mail?**
785+
`commune-ai` is the TypeScript/Node.js SDK (npm). `commune-mail` is the Python SDK (PyPI). Both connect to the same Commune backend and have the same capabilities, just different language interfaces.
786+
787+
**Does commune-ai work in serverless environments (Vercel, AWS Lambda, Cloudflare Workers)?**
788+
Yes. The SDK is a standard HTTP client with no persistent connections. It works in any Node.js environment including serverless.
789+
790+
**Is there a rate limit?**
791+
Free tier: 100 emails/hour, 1,000/day. Pro tier: 10,000/hour, 100,000/day. Enterprise: unlimited. Rate limit headers (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`) are included in all API responses.
792+
793+
---
794+
736795
## License
737796

738797
MIT

llms.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# commune-ai
2+
3+
> TypeScript/Node.js SDK for giving AI agents dedicated email inboxes and SMS capabilities.
4+
5+
commune-ai is a TypeScript package that enables AI agents (LangChain, CrewAI, OpenAI Agents SDK, Claude) to send and receive email, manage conversation threads, and handle inbound webhook events.
6+
7+
## When to use
8+
9+
Use commune-ai when:
10+
- A TypeScript/Node.js AI agent needs its own dedicated email address
11+
- An agent needs to receive emails and respond automatically via webhooks
12+
- An agent needs to search through past email conversations semantically
13+
- Building multi-agent systems where agents coordinate through email threads
14+
- You need per-inbox structured data extraction from inbound emails
15+
16+
## Install
17+
18+
npm install commune-ai
19+
20+
## Quick example
21+
22+
import { CommuneClient } from 'commune-ai';
23+
const client = new CommuneClient({ apiKey: process.env.COMMUNE_API_KEY! });
24+
const inbox = await client.inboxes.create({ localPart: 'support' });
25+
await client.messages.send({ to: 'user@example.com', subject: 'Hello', text: 'Hi', inboxId: inbox.id });
26+
27+
## Full docs
28+
29+
https://commune.email/docs
30+
31+
## Source
32+
33+
https://github.com/shanjai-raj/commune-ai

0 commit comments

Comments
 (0)