Ultron

Email Agent

Read, classify, and auto-reply to incoming emails with AI-driven classification and outreach drafting.

Next.jsTypeScriptAgentMail

Capabilities

Draft and send intro/outreach emails through natural language
Read and summarize inbox messages with priority classification
Auto-reply to the latest inbound message or a specific thread
Handle multi-step email workflows in a single conversation
System Prompt
You are an email operations copilot for early-stage teams.

Core workflows:
1) Send intro email: draft concise outreach and call send_intro_email.
2) Review inbox: call read_inbox when user asks to check responses.
3) Auto-reply: call auto_reply to answer the latest inbound or a provided message ID.

Rules:
- Keep responses concise and execution-focused.
- Do not invent product claims or customer facts.
- If required input is missing (recipient or user intent), ask one targeted question.
- After each send_intro_email call, respond with one short status line.
- If any tool returns a failure payload, explain what to fix in plain language.
Agent Source
import { agent, tool } from "@agent-sdk"
import { z } from "zod"

const sendIntroEmailInput = z.object({
  to: z.string().email(),
  subject: z.string().min(3).max(200),
  text: z.string().min(10),
  html: z.string().optional(),
})

const readInboxInput = z.object({
  limit: z.number().int().min(1).max(50).optional(),
})

const autoReplyInput = z.object({
  text: z.string().min(3),
  html: z.string().optional(),
  messageId: z.string().optional(),
  replyAll: z.boolean().optional(),
})

export default agent({
  model: "claude-sonnet-4-6",
  permissionMode: "bypassPermissions",
  maxTurns: 12,
  systemPrompt: `...`, // see System Prompt section above
  tools: {
    send_intro_email: tool({
      description: "Send an intro/outreach email",
      inputSchema: sendIntroEmailInput,
      execute: async ({ to, subject, text, html }) => {
        // POST to /v0/inboxes/{id}/messages/send
      },
    }),
    read_inbox: tool({
      description: "Read recent inbox messages",
      inputSchema: readInboxInput,
      execute: async ({ limit = 10 }) => {
        // GET /v0/inboxes/{id}/messages?limit={limit}
      },
    }),
    auto_reply: tool({
      description: "Auto-reply to latest inbound or specific message",
      inputSchema: autoReplyInput,
      execute: async ({ text, html, messageId, replyAll }) => {
        // POST /v0/inboxes/{id}/messages/{messageId}/reply
      },
    }),
  },
})

File Structure

agents/
email-agent.ts
app/
page.tsx
layout.tsx
globals.css
app/api/agent/
sandbox/route.ts
threads/route.ts
token/route.ts
Setup
$ npm install
$ cp .env.example .env.local
# Add your API keys to .env.local
$ npm run deploy
$ npm run dev

Environment Variables

AGENT_API_KEYServer-side API key for token exchange
AGENTMAIL_API_KEYAgentMail API key for sending and reading emails
AGENTMAIL_INBOX_IDYour AgentMail sender inbox ID

Sell This Agent

Automate client outreach, inbox triage, and follow-ups. Most businesses spend 15+ hours/week on email ops.

Setup fee
$2,500
Monthly retainer
$400/mo
Target marketE-commerce, SaaS, Agencies

Included

Full agent source code
System prompt
Setup instructions
Connect to Ultron pipelineUnlock
Custom email templatesUnlock
Turn views into income.Drop your video link, get paid as the view count climbs.
Submit a video