home / skills / agentmail-to / agentmail-skills / agentmail-toolkit

agentmail-toolkit skill

/agentmail-toolkit

This skill adds email capabilities to AI agents across popular frameworks, enabling inbox management, sending, receiving, and automation.

npx playbooks add skill agentmail-to/agentmail-skills --skill agentmail-toolkit

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.8 KB
---
name: agentmail-toolkit
description: Add email capabilities to AI agents using popular frameworks. Provides pre-built tools for TypeScript and Python frameworks including Vercel AI SDK, LangChain, Clawdbot, OpenAI Agents SDK, and LiveKit Agents. Use when integrating AgentMail with agent frameworks that need email send/receive tools.
---

# AgentMail Toolkit

Pre-built email tools for popular agent frameworks. Instantly add inbox management, sending, receiving, and email automation to your agents.

## Installation

```bash
# TypeScript/Node
npm install agentmail-toolkit

# Python
pip install agentmail-toolkit
```

## Configuration

Set your API key as an environment variable:

```bash
export AGENTMAIL_API_KEY=your-api-key
```

Get your API key from [console.agentmail.to](https://console.agentmail.to).

---

## TypeScript Frameworks

### Vercel AI SDK

```typescript
import { AgentMailToolkit } from "agentmail-toolkit/ai-sdk";
import { streamText } from "ai";
import { openai } from "@ai-sdk/openai";

const toolkit = new AgentMailToolkit();

const result = await streamText({
  model: openai("gpt-4o"),
  messages,
  system: "You are an email agent that can send and receive emails.",
  tools: toolkit.getTools(),
});
```

### LangChain

```typescript
import { createAgent, HumanMessage, AIMessage } from "langchain";
import { AgentMailToolkit } from "agentmail-toolkit/langchain";

const agent = createAgent({
  model: "openai:gpt-4o",
  tools: new AgentMailToolkit().getTools(),
  systemPrompt: "You are an email agent that can send and receive emails.",
});

const result = await agent.stream({ messages }, { streamMode: "messages" });
```

### Clawdbot (Pi Agent)

For Clawdbot/Pi Agent integration.

```typescript
import { AgentMailToolkit } from "agentmail-toolkit/clawdbot";

const toolkit = new AgentMailToolkit();
const tools = toolkit.getTools();

// Each tool has: name, label, description, parameters, execute
for (const tool of tools) {
  agent.registerTool(tool);
}
```

---

## Python Frameworks

### OpenAI Agents SDK

```python
from agentmail_toolkit.openai import AgentMailToolkit
from agents import Agent

agent = Agent(
    name="Email Agent",
    instructions="You can send, receive, and manage emails.",
    tools=AgentMailToolkit().get_tools(),
)
```

### LangChain

```python
from langchain.agents import create_agent
from agentmail_toolkit.langchain import AgentMailToolkit

agent = create_agent(
    model="gpt-4o",
    system_prompt="You are an email agent that can send and receive emails.",
    tools=AgentMailToolkit().get_tools(),
)

result = agent.stream({"messages": messages}, stream_mode="messages")
```

### LiveKit Agents

For voice AI agents with email capabilities.

```python
from livekit.agents import Agent
from agentmail_toolkit.livekit import AgentMailToolkit

agent = Agent(
    name="Voice Email Agent",
    tools=AgentMailToolkit().get_tools(),
)
```

---

## Available Tools

All frameworks get access to these tools:

| Tool               | Description              |
| ------------------ | ------------------------ |
| `create_inbox`     | Create a new email inbox |
| `list_inboxes`     | List all inboxes         |
| `get_inbox`        | Get inbox details        |
| `delete_inbox`     | Delete an inbox          |
| `send_message`     | Send an email            |
| `reply_to_message` | Reply to an email        |
| `list_threads`     | List email threads       |
| `get_thread`       | Get thread details       |
| `get_attachment`   | Download an attachment   |
| `update_message`   | Update message labels    |

---

## Custom Configuration

### Custom API Key

```typescript
// TypeScript
const toolkit = new AgentMailToolkit({ apiKey: "your-api-key" });
```

```python
# Python
toolkit = AgentMailToolkit(api_key="your-api-key")
```

### Custom Client

```python
# Python - use existing AgentMail client
from agentmail import AgentMail
from agentmail_toolkit.openai import AgentMailToolkit

client = AgentMail(api_key="your-api-key")
toolkit = AgentMailToolkit(client=client)
```

---

## Framework Summary

| Framework         | TypeScript Import                    | Python Import                                              |
| ----------------- | ------------------------------------ | ---------------------------------------------------------- |
| Vercel AI SDK     | `from 'agentmail-toolkit/ai-sdk'`    | -                                                          |
| LangChain         | `from 'agentmail-toolkit/langchain'` | `from agentmail_toolkit.langchain import AgentMailToolkit` |
| Clawdbot          | `from 'agentmail-toolkit/clawdbot'`  | -                                                          |
| OpenAI Agents SDK | -                                    | `from agentmail_toolkit.openai import AgentMailToolkit`    |
| LiveKit Agents    | -                                    | `from agentmail_toolkit.livekit import AgentMailToolkit`   |

Overview

This skill adds email send/receive and inbox management capabilities to AI agents across popular TypeScript and Python agent frameworks. It supplies ready-made tools so agents can create inboxes, send and reply to messages, list threads, download attachments, and manage message labels. Setup is minimal: install the package and provide your AgentMail API key.

How this skill works

The toolkit exposes a consistent set of email tools that plug into framework-specific agent tool registries (Vercel AI SDK, LangChain, Clawdbot, OpenAI Agents SDK, LiveKit Agents). Each tool includes metadata and an execute interface so agents can call actions like create_inbox, send_message, get_thread, and get_attachment. You can configure the toolkit with an API key or pass an existing AgentMail client for custom setups.

When to use it

  • You need agents that send or receive email programmatically.
  • You want to add inbox management and thread handling to conversational agents.
  • You are integrating email workflows into voice agents or streaming agent sessions.
  • You need cross-framework compatibility between TypeScript and Python agent stacks.
  • You want pre-built, production-ready email actions without building an email layer from scratch.

Best practices

  • Store the AGENTMAIL_API_KEY securely in environment variables or a secrets manager.
  • Expose only required tools to the agent to reduce attack surface and accidental sends.
  • Use system prompts instructing the agent how to format outbound emails and handle user privacy.
  • Test email flows in a staging inbox before connecting to production addresses.
  • When using streaming models, handle tool responses and attachments asynchronously to avoid blocking the main conversation.

Example use cases

  • Customer support bot that reads inboxes, summarizes threads, and drafts replies.
  • Sales assistant that creates outreach sequences and logs sent messages to threads.
  • Voice agent that receives spoken commands to send or reply to emails during calls.
  • Automated workflow that creates inboxes for new projects and routes incoming messages to the right agent.
  • Monitoring agent that downloads attachments and forwards them to downstream processing services.

FAQ

How do I provide an API key?

Set AGENTMAIL_API_KEY in environment variables or pass api_key/client when constructing the toolkit.

Which tools are included?

Common tools include create_inbox, list_inboxes, get_inbox, delete_inbox, send_message, reply_to_message, list_threads, get_thread, get_attachment, and update_message.