Short answer
Wrap Commune’s Python client in twoBaseTool subclasses — CommuneSendEmailTool and CommuneReadThreadTool — and assign them to the agents that need email access. Agents without email tools stay isolated from the inbox. Inbound replies are handled via a FastAPI webhook that re-triggers the crew with reply context.
Step 1: Install and configure
.env:
Step 2: Create Commune tools
Define each tool as aBaseTool subclass with a Pydantic input schema. CrewAI uses the schema to validate agent inputs before calling _run.
Step 3: Assign tools to agents
Only give email tools to agents that need them. The researcher has no email access.Step 4: Run the crew
Step 5: Handle inbound replies
Set up a FastAPI webhook to receive inbound email events from Commune. When a reply arrives, extract the thread ID and re-trigger the crew in a background task.https://yourapp.com/webhook/email. See Webhooks for setup instructions.
Related
CrewAI Email Agent Example
End-to-end walkthrough building an outreach crew with researcher, sender, and reply-handler agents.
Inboxes
Manage inboxes and routing rules for multi-agent systems.
Webhooks
Receive and handle inbound email events in real time via webhook.

