Agent Skills
为 AI Agent 添加邮箱验证技能,在 AI 工作流和自动化管道中集成真实 SMTP 邮箱验证能力。
Agent Skills 是预构建的功能,可以添加到 AI Agent 以扩展其功能。BillionVerify 为流行的 AI Agent 框架提供邮箱验证技能,关键优势是真正的 SMTP 验证。
为什么 SMTP 验证对 AI Agent 至关重要
大多数邮箱验证方法会失败,因为它们只检查语法和 DNS。这会遗漏 20-40% 的无效邮箱。SMTP 验证是唯一可靠的方法,因为它:
- 通过 25 端口直接连接邮件服务器
- 确认特定邮箱是否存在
- 提供 99.9% 的准确率,而非猜测
为什么你无法自己实现 SMTP 验证:
- 云服务商(AWS、GCP、Azure)封锁 25 端口
- 建立 IP 信誉需要数月时间
- 反垃圾邮件系统会检测并拦截验证尝试
- 需要跨多个地区的专用基础设施
BillionVerify 运营专用基础设施,拥有白名单 IP,让 AI Agent 能够使用真正的 SMTP 验证。
什么是 Agent Skills?
Agent Skills 是模块化、可重用的组件,为 AI Agent 提供特定功能:
- 即插即用:无需编写验证逻辑即可向 Agent 添加技能
- 标准化接口:适用于不同的 Agent 框架
- 内置最佳实践:包含错误处理、速率限制和缓存
- 真正的 SMTP 验证:不只是语法检查,而是真正的邮箱确认
获取 BillionVerify Skill
为你的 AI 编程助手安装 BillionVerify 邮箱验证技能:
- ClawHub: clawhub.ai/billionverifier/billionverify-skill
- GitHub: github.com/BillionVerify/billionverify-skill
支持的代理框架
| 框架 | 技能类型 | 状态 |
|---|---|---|
| Claude Agent SDK | 工具 | 支持 |
| AutoGPT | 插件 | 支持 |
| LangChain Agents | 工具 | 支持 |
| CrewAI | 工具 | 支持 |
| SuperAGI | 工具 | 即将推出 |
Claude Agent SDK
Claude Agent SDK 使构建自定义 AI 代理变得简单。将邮箱验证添加为工具:
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const tools: Anthropic.Tool[] = [
{
name: "verify_email",
description: `Verify if an email address is valid and deliverable.
Returns:
- status: "valid", "invalid", or "unknown"
- deliverable: whether the email can receive messages
- disposable: whether it's a temporary email service
- role: whether it's a role-based address (info@, support@)
- score: confidence score from 0 to 1`,
input_schema: {
type: "object",
properties: {
email: {
type: "string",
description: "The email address to verify",
},
},
required: ["email"],
},
},
];
async function verifyEmail(email: string) {
const response = await fetch("https://api.billionverify.com/v1/verify/single", {
method: "POST",
headers: {
'BV-API-KEY': process.env.BV_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ email }),
});
return response.json();
}
async function processToolCall(
toolName: string,
toolInput: Record<string, string>
) {
if (toolName === "verify_email") {
return await verifyEmail(toolInput.email);
}
throw new Error(`Unknown tool: ${toolName}`);
}
async function agentLoop(userMessage: string) {
const messages: Anthropic.MessageParam[] = [
{ role: "user", content: userMessage },
];
while (true) {
const response = await client.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 4096,
tools,
messages,
});
// Check if we need to process tool calls
if (response.stop_reason === "tool_use") {
const toolUseBlocks = response.content.filter(
(block): block is Anthropic.ToolUseBlock => block.type === "tool_use"
);
const toolResults: Anthropic.ToolResultBlockParam[] = [];
for (const toolUse of toolUseBlocks) {
const result = await processToolCall(
toolUse.name,
toolUse.input as Record<string, string>
);
toolResults.push({
type: "tool_result",
tool_use_id: toolUse.id,
content: JSON.stringify(result),
});
}
messages.push({ role: "assistant", content: response.content });
messages.push({ role: "user", content: toolResults });
} else {
// Agent is done
const textBlock = response.content.find(
(block): block is Anthropic.TextBlock => block.type === "text"
);
return textBlock?.text;
}
}
}
// Usage
const result = await agentLoop(
"I have a list of emails to verify: john@google.com, test@mailinator.com, support@microsoft.com. Check each one and tell me which are safe to use."
);
console.log(result);CrewAI 集成
将邮箱验证添加到您的 CrewAI 代理:
from crewai import Agent, Task, Crew
from crewai_tools import tool
import requests
import os
@tool("Email Verification Tool")
def verify_email(email: str) -> str:
"""Verify if an email address is valid and deliverable.
Args:
email: The email address to verify
Returns:
Verification result with status, deliverability, and risk flags
"""
response = requests.post(
'https://api.billionverify.com/v1/verify/single',
headers={
'BV-API-KEY': os.environ["BV_API_KEY"],
'Content-Type': 'application/json',
},
json={'email': email}
)
result = response.json()
return f"Email: {email}, Status: {result['status']}, Score: {result['score']}"
# Create an agent with the verification skill
data_quality_agent = Agent(
role='Data Quality Specialist',
goal='Ensure all email addresses in the database are valid and deliverable',
backstory='Expert in data validation and email deliverability',
tools=[verify_email],
verbose=True
)
# Create a task
verification_task = Task(
description='Verify the following email addresses and report which ones are invalid: {emails}',
expected_output='A report of all emails with their verification status',
agent=data_quality_agent
)
# Run the crew
crew = Crew(
agents=[data_quality_agent],
tasks=[verification_task]
)
result = crew.kickoff(inputs={
'emails': 'john@google.com, fake@invalid.xyz, test@mailinator.com'
})
print(result)AutoGPT 插件
为邮箱验证创建 AutoGPT 插件:
# autogpt_plugins/billionverify/__init__.py
from typing import Any, Dict, List, Optional, Tuple, TypeVar
import requests
import os
PromptGenerator = TypeVar("PromptGenerator")
class BillionVerifyPlugin:
def __init__(self):
self.api_key = os.environ.get("BV_API_KEY")
@staticmethod
def get_name() -> str:
return "BillionVerify Email Verification"
def can_handle_post_prompt(self) -> bool:
return True
def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"verify_email",
"Verify if an email is valid",
{"email": "<email_address>"},
self.verify_email
)
return prompt
def verify_email(self, email: str) -> str:
response = requests.post(
'https://api.billionverify.com/v1/verify/single',
headers={
'BV-API-KEY': self.api_key,
'Content-Type': 'application/json',
},
json={'email': email}
)
result = response.json()
if result['status'] == 'valid':
return f"✅ {email} is valid (score: {result['score']})"
elif result['status'] == 'invalid':
return f"❌ {email} is invalid"
else:
return f"⚠️ {email} status unknown"最佳实践
1. 技能描述
编写清晰的描述,让代理知道何时使用技能:
description: `Verify if an email address is valid and deliverable.
Use this skill when:
- User asks to check an email address
- Validating contact information before saving
- Cleaning email lists
- Checking if an email is disposable or role-based
Returns: status, deliverability, disposable flag, role flag, confidence score`2. 错误处理
在技能中构建健壮的错误处理:
@tool("Email Verification")
def verify_email(email: str) -> str:
try:
response = requests.post(
'https://api.billionverify.com/v1/verify/single',
headers={
'BV-API-KEY': os.environ["BV_API_KEY"],
'Content-Type': 'application/json',
},
json={'email': email},
timeout=30
)
if response.status_code == 429:
return "Rate limit exceeded. Please try again later."
response.raise_for_status()
return response.json()
except requests.exceptions.Timeout:
return "Verification timed out. Please try again."
except Exception as e:
return f"Verification failed: {str(e)}"3. 批量操作
对于多个邮箱,使用批量端点:
const verifyBulkSkill = {
name: "verify_emails_bulk",
description: "Verify multiple email addresses at once. More efficient for lists.",
input_schema: {
type: "object",
properties: {
emails: {
type: "array",
items: { type: "string" },
description: "Array of emails to verify (max 100)",
},
},
required: ["emails"],
},
};