Skip to main content
Glama

⚡ AgentBox

AI 代理的邮件与身份层

CI npm version npm downloads GitHub Release Rust MCP License: MIT

AgentBox 为任何自主 AI 代理(Claude Code、Cursor、Antigravity、OpenAI Swarm)提供其专属的机器原生邮件身份、收件箱、外发通信、身份验证和事件驱动的邮件能力——自托管、自主可控、极速高效。

快速开始 • 核心抽象 • 代理身份与安全 • 应用场景 • 性能基准 • MCP 工具 • 架构


💡 核心问题

自主 AI 代理需要一种与人类世界及彼此交互的方式。如今,电子邮件是所有软件和平台通用的通信协议:

  • 浏览器代理如何验证其在 GitHub 或 AWS 上的账户?电子邮件。

  • 客户如何联系你的 AI 支持助手?电子邮件。

  • 外部 QA 代理如何将缺陷报告委派给编码代理?电子邮件。

  • 研究代理如何接收 arXiv 摘要和行业警报?电子邮件。

没有机器原生的邮件基础设施,开发者被迫使用脆弱的 API 轮询、破解个人 Gmail 收件箱,或手动点击验证链接。

AgentBox 彻底解决了这一问题。

                    ┌─────────────────────────┐
                    │        AGENTBOX         │
                    └────────────┬────────────┘
                                 │
              ┌──────────────────┴──────────────────┐
              ▼                                     ▼
        🧑🚀 IDENTITY                         📬 COMMUNICATION
  • User-Defined Name & Email           • Inbound Inbox (SMTP/IMAP/HTTP)
  • Persistent Agent ID                 • Outbound SMTP Relay
  • Scoped Capability Matrix            • Realtime Event Bus (<0.001ms)
  • Object-Level Ownership              • OTP Isolator & SafeLink Engine
              │                                     │
              └──────────────────┬──────────────────┘
                                 │
                                 ▼
                     Autonomous AI Agent

Related MCP server: Mailgent MCP Server

🧑🚀 代理身份与安全模型

AgentBox 不规定你的代理是谁。由你定义代理的名称、电子邮件和能力策略:

# 1. Create a Support Agent with a custom company email
npx agentbox-mail agent create support \
  --email support@mycompany.com \
  --capabilities "inbox.read,email.send"

# 2. Create an Autonomous Coding Agent
npx agentbox-mail agent create coder \
  --email coder@mycompany.com \
  --capabilities "inbox.read,task.claim,task.update,otp.read"

# 3. Create a Browser QA Agent with standard verification permissions
npx agentbox-mail agent create browser-qa \
  --capabilities "inbox.read,otp.read,links.read"
╔══════════════════════════════════════════════════════════════════╗
║             🧑‍🚀 AGENT IDENTITY PROVISIONED                      ║
╠══════════════════════════════════════════════════════════════════╣
║  Agent ID     : agent_coder_7f92a1                               ║
║  Name         : coder                                            ║
║  Email        : coder@mycompany.com                              ║
║  Auth Token   : agb_92d7e8f1c3a04b12                             ║
║  Capabilities : ["inbox.read", "task.claim", "otp.read"]        ║
║  Status       : active                                           ║
╚══════════════════════════════════════════════════════════════════╝
⚠️  NOTE: Store this auth_token securely. It is only displayed once upon creation.

🔐 多层安全执行:

  1. 令牌认证:验证代理身份和状态(active 与 revoked)。

  2. 能力范围:验证所需权限(inbox.read、email.send、otp.read、task.claim)。

  3. 对象级邮箱所有权:拥有 otp.read 的代理 A 被严格限制在其自身分配的邮箱(owner_agent_id)内。尝试跨代理访问将返回明确的 AccessDenied 错误。

  4. 凭据卫生:公共查询(get_agent_identity、list_agent_identities)使用经过净化的结构体,绝不暴露令牌。


🌐 多样化应用场景

AgentBox 提供了基础的邮件身份层。以下是一些构建在其之上的最强大工作流:

1. 🤖 代理间工作委派与任务协议

外部 QA 或发现代理(如 Jules)发送一封包含缺陷或功能请求的电子邮件。AgentBox 内置的 TaskDetector 自动解析主题([TASK:BUG]),提取仓库、分支、优先级和行引用,创建 AgentTask,并通过事件总线唤醒编码代理:

   Jules (QA Agent)
          │
          │ 1. Sends email: "[TASK:BUG] Fix duplicate property filter in EstateFlow"
          │    Body: "Repository: RABNEER/EstateFlow\nPriority: high\nEvidence: tests/search.spec.ts:87"
          ▼
 ┌─────────────────┐
 │    AgentBox     │ ──► Auto-detects Work Order via `TaskDetector`
 └────────┬────────┘ ──► Provisions `AgentTask` & records audit event
          │
          │ 2. Realtime Event Bus Dispatch (<0.001ms) / SSE Daemon Bridge
          ▼
 Coder (Worker Agent / Claude Code)
          │ 3. Instantaneously claims task via `claim_agent_task`
          │ 4. Fixes code, opens GitHub PR, calls `update_task_progress`
          │ 5. Calls `complete_agent_task` with CI results
          ▼
 ┌─────────────────┐
 │    AgentBox     │ ──► Status: "completed" + Immutable Audit Lineage
 └────────┬────────┘
          │ 6. Emits completion notification to Jules / User
          ▼
   Jules closes ticket

2. 🔐 自主 SaaS 注册与 2FA / OTP 验证

浏览器代理(Puppeteer、Playwright、Stagehand)需要注册工具、验证电子邮件地址并解决 OTP 挑战:

  • 代理创建收件箱 create_agent_inbox(name: "signup-bot")。

  • 在平台上触发注册(例如 AWS、Stripe、Vercel)。

  • 调用 get_latest_otp()(通过正则表达式在 <0.14ms 内提取)或 get_verification_link()(经过反重定向与钓鱼防御检查)。

  • 账户在零人工干预的情况下自主完成验证。


3. 💬 自主入站支持与客户分流

为你的客户支持代理提供专属电子邮件地址(support@yourcompany.com):

  • 客户通过电子邮件向支持团队反馈问题。

  • AgentBox 通过原始 SMTP 或 IMAP 同步摄取电子邮件。

  • 实时 SSE 事件通知支持代理。

  • 代理分析查询、查阅内部文档,并通过 send_agent_email() 回复。


4. 🔬 研究与情报收集

为你的研究代理赋予身份(researcher@yourcompany.com):

  • 订阅行业通讯、安全公告(CVE)和 arXiv 摘要推送。

  • 代理使用 read_agent_inbox() 定期读取入站邮件。

  • 综合生成高管简报、总结发现,并将摘要转发给你的团队。


5. 🛡️ DevOps 告警与自动化事件响应

为你的事件响应代理赋予身份(oncall@yourcompany.com):

  • 接收来自 Datadog、Sentry 或 PagerDuty 的关键错误告警。

  • 实时事件钩子立即唤醒代理。

  • 代理查询日志、定位失败的提交,并向编码代理派发修复指令。


📊 可复现性能基准

AgentBox 包含完整的基准测试套件(tests/benchmark.rs),测量从原始字节到完整 JSON-RPC 输出的整个流水线:

cargo test --release --test benchmark -- --nocapture

⚡ 已验证的完整端到端 MCP 流水线(1,000 次循环):

测试流水线:Raw MIME Ingestion ➔ mail-parser ➔ SafeLink Analysis ➔ Regex OTP ➔ SQLite INSERT ➔ Broadcast Dispatch ➔ Authenticated MCP Tool Call (tools/call) ➔ JSON-RPC Result Output

流水线指标

实测延迟

吞吐量

平均值(均值)

451.9 µs(0.451 ms)

每秒 2,213 个完整 MCP 循环

p50 中位数

431.5 µs(0.431 ms)

—

p95

586.2 µs(0.586 ms)

—

p99

1.04 ms

—

⚡ 子组件微秒级延迟(10,000 次迭代):

  • 事件总线通道分发:0.216 µs(0.0002 ms)— 每秒 462 万事件

  • 链接安全与反重定向:0.652 µs(0.0007 ms)— 每秒 153 万次检查

  • OTP 正则提取:138.2 µs(0.138 ms)— 每秒 7,230 次提取


🛠️ MCP 工具参考

AgentBox 通过 stdio 实现 Model Context Protocol (MCP) 规范:

类别

工具

参数

描述

身份

create_agent_identity

name, email?, capabilities?

创建具有自定义/自动电子邮件地址的持久身份,并返回一次性认证令牌。

身份

get_agent_identity

agent_id

检索公共代理元数据(令牌已被净化)。

身份

list_agent_identities

—

列出所有已注册的公共代理身份和活动策略。

身份

revoke_agent_identity

agent_id

撤销代理身份并立即使其认证令牌失效。

邮箱

create_agent_inbox

name, address?, agent_token?

创建链接到调用代理身份的新虚拟邮箱。

邮箱

get_latest_otp

account_id, agent_token?

在 <0.14ms 内提取最新的 4–8 位验证码,并执行所有权检查。

邮箱

wait_for_email

account_id, timeout_secs?, agent_token?

事件驱动钩子:异步 Tokio 广播通道在 <0.001ms 内唤醒代理。

邮箱

get_verification_link

account_id, agent_token?

返回解析后的激活链接,具备深度链接安全与反重定向防御。

邮箱

read_agent_inbox

account_id, limit?, agent_token?

检索最近的消息、完整正文文本、HTML 和发件人元数据。

邮箱

send_agent_email

account_id, to, subject, body, agent_token?

通过 SMTP 中继发送外发邮件,并执行能力授权。

邮箱

delete_agent_inbox

account_id, agent_token?

删除临时邮箱并清除存储的消息。

任务协议

dispatch_agent_task

action, description, repository?, branch?, priority?, target_agent?, evidence?, acceptance_criteria?, agent_token?

将一个代理的结构化工作指令派发给另一个代理。

任务协议

claim_agent_task

task_id, agent_token

原子性地锁定并将任务分配给认领的工作代理。

任务协议

update_task_progress

task_id, status, commit_sha?, pr_url?, test_results?, note?, agent_token

更新任务状态(running、testing、pr_opened)并记录审计日志。

任务协议

complete_agent_task

task_id, summary, commit_sha?, pr_url?, test_results?, agent_token

以完成详情关闭任务并发出完成事件。

任务协议

list_agent_tasks

status?, agent_token?, limit?

按生命周期状态或代理身份筛选列出任务。

任务协议

get_task_audit_trail

task_id, agent_token?

检索任务的不可变审计日志和生命周期历史。


🚀 快速开始

1. 无头 NPM CLI(零配置)

在 1 秒内即时自动配置你的 AI 工具:

# 1-Click Auto-Install MCP Server & AI Skill into Claude Code, Cursor, Antigravity
npx agentbox-mail init

# Start MCP stdio server with live daemon SSE event bridge
npx agentbox-mail mcp

# Create an Agent Identity with scoped capabilities
npx agentbox-mail agent create support --email support@mycompany.com --capabilities "inbox.read,email.send"

# Retrieve latest OTP code
npx agentbox-mail otp agent@yourdomain.com

# Launch Web Dashboard
npx agentbox-mail ui

2. 原生 Electron 桌面应用

# Clone the repository
git clone https://github.com/RABNEER/AgentBox.git
cd AgentBox

# Install dependencies and start Desktop App
npm install
npm run app

3. 高速 Rust 核心守护进程

# Build the optimized production binary
cargo build --release

# Start all-in-one daemon (HTTP Port 3000 + SMTP Port 2525)
./target/release/agentbox-mail server --port 3000

🏗️ 架构

                                  ┌───────────────────────────┐
                                  │   Inbound Emails & Tasks  │
                                  └─────────────┬─────────────┘
                                                │
                 ┌──────────────────────────────┼──────────────────────────────┐
                 │                              │                              │
                 ▼                              ▼                              ▼
     ┌───────────────────────┐      ┌───────────────────────┐      ┌───────────────────────┐
     │ Hostinger / Titan /   │      │ Raw SMTP Listener     │      │ Inbound HTTP Webhook  │
     │ Google IMAP TLS (993) │      │ (0.0.0.0:2525)        │      │ (POST /v1/inbound)    │
     └───────────┬───────────┘      └───────────┬───────────┘      └───────────┬───────────┘
                 │                              │                              │
                 └──────────────────────────────┼──────────────────────────────┘
                                                │
                                                ▼
                                 ┌─────────────────────────────┐
                                 │   High-Speed Parser Engine  │
                                 │  • 4–8 Digit OTP Isolator   │
                                 │  • Link Safety Engine       │
                                 │  • TaskDetector (Work Order)│
                                 └──────────────┬──────────────┘
                                                │
                                                ▼
                                 ┌─────────────────────────────┐
                                 │ Embedded SQLite Storage     │
                                 │       (`agentbox.db`)       │
                                 │  • Identities & Auth Tokens │
                                 │  • Mailboxes & Messages     │
                                 │  • Resource Ownership Graph │
                                 │  • Agent Tasks & Audit Logs │
                                 └──────────────┬──────────────┘
                                                │
                 ┌──────────────────────────────┼──────────────────────────────┐
                 │                              │                              │
                 ▼                              ▼                              ▼
     ┌───────────────────────┐      ┌───────────────────────┐      ┌───────────────────────┐
     │ Realtime SSE Bus      │      │ MCP Server (stdio)    │      │ Native Desktop App /  │
     │ (`GET /v1/events`)    │      │ Full Tool Interface   │      │ Web Dashboard (:3000) │
     │ (Live Daemon Bridge)  │      │ Object-Level Auth     │      │                       │
     └───────────────────────┘      └───────────────────────┘      └───────────────────────┘

📄 许可证

基于 MIT 许可证 分发。更多信息请参阅 LICENSE。

由 RABNEER 与 AgentBox 开源社区用 🖤 打造

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    C
    maintenance
    Disposable email MCP server for autonomous AI agents. Create labeled temporary inboxes, wait for verification emails, extract OTP codes and confirmation links — zero human intervention required.
    6
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Provides identity infrastructure for AI agents to manage email communications, including sending, replying, and organizing messages. It also includes a secure vault for managing credentials and generating TOTP codes.
    9 npm
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    An MCP server that provides AI agents with a persistent, agent-native email mailbox for sending, receiving, and managing emails through bounded-context retrieval, idempotent operations, and explicit acknowledgement.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Disposable email for humans and AI agents. Enables AI agents to create mailboxes and receive verification emails through an MCP server.
    37
    MIT