agentmail-toolkit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AgentMail Toolkit

AgentMail 工具包

Pre-built email tools for popular agent frameworks. Instantly add inbox management, sending, receiving, and email automation to your agents.
为主流Agent框架打造的预构建邮件工具。可立即为你的Agent添加收件箱管理、邮件收发以及邮件自动化功能。

Installation

安装

bash
undefined
bash
undefined

TypeScript/Node

TypeScript/Node

npm install agentmail-toolkit
npm install agentmail-toolkit

Python

Python

pip install agentmail-toolkit
undefined
pip install agentmail-toolkit
undefined

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.

将你的API密钥设置为环境变量:
bash
export AGENTMAIL_API_KEY=your-api-key
console.agentmail.to获取你的API密钥。

TypeScript Frameworks

TypeScript 框架

Vercel AI SDK

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(),
});
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

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" });
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)

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);
}

适用于Clawdbot/Pi Agent集成。
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

Python 框架

OpenAI Agents SDK

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(),
)
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

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")
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

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(),
)

为语音AI Agent添加邮件功能。
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:
ToolDescription
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

所有框架均可使用以下工具:
工具名称功能描述
create_inbox
创建新的邮件收件箱
list_inboxes
列出所有收件箱
get_inbox
获取收件箱详情
delete_inbox
删除收件箱
send_message
发送邮件
reply_to_message
回复邮件
list_threads
列出邮件线程
get_thread
获取邮件线程详情
get_attachment
下载附件
update_message
更新邮件标签

Custom Configuration

自定义配置

Custom API Key

自定义API密钥

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

Python

Python

toolkit = AgentMailToolkit(api_key="your-api-key")
undefined
toolkit = AgentMailToolkit(api_key="your-api-key")
undefined

Custom Client

自定义客户端

python
undefined
python
undefined

Python - use existing AgentMail client

Python - 使用已有的AgentMail客户端

from agentmail import AgentMail from agentmail_toolkit.openai import AgentMailToolkit
client = AgentMail(api_key="your-api-key") toolkit = AgentMailToolkit(client=client)

---
from agentmail import AgentMail from agentmail_toolkit.openai import AgentMailToolkit
client = AgentMail(api_key="your-api-key") toolkit = AgentMailToolkit(client=client)

---

Framework Summary

框架汇总

FrameworkTypeScript ImportPython 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
框架名称TypeScript 导入路径Python 导入路径
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