Quick Start

Install the Dead Simple Email package with CrewAI support:

terminal
pip install deadsimple[crewai] crewai

Import the tools and assign them to your agents. Each function is decorated with CrewAI's @tool decorator, so they work out of the box:

quick_start.py
from crewai import Agent
from deadsimple.integrations.crewai import send_email, read_emails, create_inbox

agent = Agent(
    role="Email Assistant",
    goal="Handle email communication",
    tools=[send_email, read_emails, create_inbox],
)

Set your API key as an environment variable and the tools will pick it up automatically:

terminal
export DSE_API_KEY="dse_your_api_key"

Available Tools

Six @tool-decorated functions covering the core email workflow. Import only what your agents need.

Tool Description
send_email Send an email from an inbox
read_emails Read recent emails from an inbox
read_email Read a single email with full body
reply_to_email Reply to an email (threading automatic)
create_inbox Create a new email inbox
list_inboxes List all email inboxes

Each tool function includes docstrings and type hints that CrewAI uses to generate parameter schemas for the underlying LLM. No extra configuration required.

Full Example

Here is a complete multi-agent crew where one agent manages inboxes and another handles reading and responding to email. This is the pattern CrewAI is built for: specialized agents collaborating on a workflow.

crewai_agent.py
import os
from crewai import Agent, Task, Crew
from deadsimple.integrations.crewai import (
    send_email, read_emails, read_email, reply_to_email,
    create_inbox, list_inboxes,
)

os.environ["DSE_API_KEY"] = "dse_your_api_key"

# Agent 1: Manages inbox creation and organization
inbox_manager = Agent(
    role="Inbox Manager",
    goal="Create and organize email inboxes",
    tools=[create_inbox, list_inboxes],
)

# Agent 2: Reads and responds to messages
email_handler = Agent(
    role="Email Handler",
    goal="Read and respond to emails",
    tools=[read_emails, read_email, reply_to_email, send_email],
)

# Task 1: Set up a support inbox
setup_task = Task(
    description="Create an inbox called 'Support Bot' for handling customer inquiries.",
    agent=inbox_manager,
)

# Task 2: Process incoming messages
respond_task = Task(
    description="Check the inbox for new messages and draft replies.",
    agent=email_handler,
)

# Assemble the crew and run
crew = Crew(agents=[inbox_manager, email_handler], tasks=[setup_task, respond_task])
result = crew.kickoff()
print(result)

When this crew runs, the inbox manager will create the "Support Bot" inbox first, then the email handler will check it for messages and reply to any it finds. CrewAI handles the handoff between agents automatically.

Single-Agent Setup

Not every workflow needs multiple agents. Here is a simpler single-agent pattern for straightforward email tasks:

single_agent.py
from crewai import Agent, Task, Crew
from deadsimple.integrations.crewai import (
    send_email, read_emails, read_email,
    reply_to_email, create_inbox, list_inboxes,
)

email_agent = Agent(
    role="Email Assistant",
    goal="Manage email inboxes and handle all email communication",
    backstory="You are a reliable email assistant. You create inboxes, send messages, read incoming mail, and reply promptly.",
    tools=[send_email, read_emails, read_email, reply_to_email, create_inbox, list_inboxes],
)

task = Task(
    description="List all inboxes, then check each one for unread messages and summarize them.",
    agent=email_agent,
)

crew = Crew(agents=[email_agent], tasks=[task])
result = crew.kickoff()
print(result)

Ready to build?

Create a free account and start integrating in minutes.

API Reference Get Started Free