> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sentfrom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CrewAI

> Give a CrewAI agent email tools backed by SentFromAI.

CrewAI exposes tools via the `@tool` decorator; attach them to an agent.

## Install

```bash theme={null}
pip install crewai crewai-tools requests
```

## Define the tools and crew

```python theme={null}
import os, requests
from crewai import Agent, Task, Crew
from crewai.tools import tool

API = "https://api.sentfrom.ai/v1"
H = {"Authorization": f"Bearer {os.environ['SENTFROMAI_API_KEY']}"}

@tool("Send email")
def send_email(inbox_id: str, to: str, subject: str, body: str) -> str:
    """Send an email from an inbox to a recipient."""
    r = requests.post(f"{API}/messages", headers=H,
        json={"inbox_id": inbox_id, "to": [to], "subject": subject, "text": body}).json()
    return f"sent: {r.get('id')}"

@tool("Check inbox")
def check_inbox(inbox_id: str) -> list:
    """List recent messages in an inbox."""
    return requests.get(f"{API}/messages", headers=H,
        params={"inbox_id": inbox_id, "limit": 10}).json()["messages"]

concierge = Agent(
    role="Email concierge",
    goal="Handle the inbox and reply to customers",
    backstory="You are a fast, friendly support agent.",
    tools=[send_email, check_inbox],
)

task = Task(description="Check inbox inb_123 and draft replies.", agent=concierge, expected_output="A summary of actions taken.")
print(Crew(agents=[concierge], tasks=[task]).kickoff())
```

<Tip>CrewAI also supports MCP — the [SentFromAI MCP server](/guides/mcp) gives you these tools with no wrappers.</Tip>
