You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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.
> 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! });
0 commit comments