An Open Source version of Perplexity Email Assistant powered by Composio's Tool Router, LangGraph, and MCP (Model Context Protocol).
- Real-time email trigger listening - Continuously monitors for new emails
- Automatic tool discovery - Finds and authenticates tools across 500+ apps with Composio's Tool Router
- LangGraph-based agentic workflow - Smart agent loop for complex tasks
- MCP integration - Standardized tool access via Model Context Protocol
- Install dependencies:
uv sync- Configure environment variables:
Create a
.envfile with:
OPENAI_API_KEY=your_openai_key
COMPOSIO_API_KEY=your_composio_key
- Set up email trigger in Composio Dashboard:
- Go to your Composio dashboard
- Connect your Gmail/email account
- Enable the
gmail_new_gmail_messagetrigger - Note: The trigger setup is done via the dashboard, not programmatically
Start the email trigger listener that continuously monitors for new emails:
cd trigger_setup
python agent.py listenThis will:
- Subscribe to email triggers from Composio
- Automatically process any emails sent to the monitored inbox
- Execute instructions found in email content
- Run continuously until stopped (Ctrl+C)
How it works:
- User sends an email to your monitored inbox
- Composio trigger fires and sends event to the listener
- Agent reads the email content
- Agent executes the instructions using tool router
- Agent can optionally reply back to sender
For testing the agent without email triggers:
cd trigger_setup
python agent.pyEnter your user ID when prompted, then chat with the agent directly.
Email → Composio Trigger → Subscription Listener → Tool Router Session → MCP Client → LangGraph Agent
↓
Tool Discovery
↓
Authentication
↓
Tool Execution
- Trigger Setup: Configure Gmail trigger in Composio dashboard to monitor an inbox
- Subscription: Agent subscribes to trigger events using Composio SDK
- Email Received: When someone sends email to monitored inbox, trigger fires
- Processing:
- Creates tool router session for the user
- Builds LangGraph workflow with MCP tools
- Agent analyzes email and determines required actions
- Uses meta tools (COMPOSIO_SEARCH_TOOLS, COMPOSIO_MANAGE_CONNECTIONS, COMPOSIO_MULTI_EXECUTE_TOOL)
- Executes the requested tasks
- Response: Optionally sends reply email back to sender
- "Create a GitHub issue titled 'Bug in login' with description 'Users cannot log in'"
- "Schedule a meeting with john@example.com tomorrow at 2pm"
- "Search Slack for messages about 'project deadline' and summarize them"
- "Add a task to my Notion board: 'Review PR #123'"
The agent automatically figures out which apps to use and executes the tasks!