← Back to Blog

How to Run an AI Email Automation Agent with OE Runtime

Read your inbox, prioritise what needs a reply, and send professional follow-up emails automatically. OE Runtime lets you run a local AI email agent over SMTP — works with Gmail, Outlook, or any mail server.

📧
Step 1
Read Inbox
Fetch the 10 most recent unread emails with sender, subject, date, and a one-sentence summary.
Step 2
Draft & Send Reply
Identify the most urgent email and send a professional acknowledgement reply via SMTP.
Step 3
Report
Summarise emails found, which was replied to, and confirm delivery with timestamp.

The Agent YAML

Create a file called agent.yaml inside an email/ directory:

name: Email Assistant
description: Summarize inbox and send a follow-up email
instructions: |
  You are an email assistant. Read the inbox via IMAP and send emails via SMTP.
  Draft professional, concise messages. Never send without confirming recipient and subject.
  Complete all steps fully before writing your report.
steps:
  - name: Read Inbox
    content: |
      Fetch the 10 most recent unread emails from the inbox.
      For each email note: sender, subject, date, and a one-sentence summary of the body.
  - name: Draft and Send Reply
    content: |
      From the unread emails, identify the one that most urgently needs a reply.
      Draft a professional acknowledgement reply and send it via SMTP.
      Subject: Re: [original subject]
      Body: acknowledge receipt and state that a full response will follow within 24 hours.
  - name: Report
    content: |
      Summarize what was done:
      - Number of unread emails found
      - Brief summary of each email (sender, subject, urgency level)
      - Which email was replied to and why
      - Confirm the reply was sent successfully
connectors:
  - connection_name: My Email
    connection_type: smtp

The Config File

Create oe-config.json in the same directory:

{
  "llm": {
    "provider": "openai",
    "model": "gpt-4o",
    "apiKey": "YOUR_OPENAI_API_KEY"
  },
  "server": {
    "enabled": false,
    "port": 3333,
    "apiKey": "your-secret-api-key"
  },
  "connectors": [
    {
      "connection_name": "My Email",
      "connection_type": "smtp",
      "host": "smtp.gmail.com",
      "port": 587,
      "user": "[email protected]",
      "password": "YOUR_APP_PASSWORD",
      "from": "[email protected]"
    }
  ]
}

For Gmail, generate an App Password at myaccount.google.com/apppasswords (requires 2FA enabled). For Outlook use smtp.office365.com port 587. For other providers update host, port, and credentials accordingly.

Download OE Runtime

OE Runtime — Direct Downloads

Run the Agent

Windows

# Run the agent
oe-runtime-win.exe email/agent.yaml --config email/oe-config.json

macOS

# Make executable (first time only)
chmod +x oe-runtime-macos

# Run the agent
oe-runtime-macos email/agent.yaml --config email/oe-config.json

Linux

# Make executable (first time only)
chmod +x oe-runtime-linux

# Run the agent
oe-runtime-linux email/agent.yaml --config email/oe-config.json

macOS Gatekeeper: On first run, macOS may block the binary. Go to System Settings → Privacy & Security → click "Allow Anyway" next to oe-runtime-macos.

Running as an API Server

Add --serve to start OE Runtime as an HTTP server on port 3333:

oe-runtime-win.exe --serve --config email/oe-config.json

Then send a request:

curl -X POST http://localhost:3333/run \
  -H "Content-Type: application/json" \
  -d '{"yaml": "email/agent.yaml", "params": {}}'

Or import the Postman collection (download above) to test all endpoints visually.

Use Cases

Build your own agents with OE Runtime

Download OE Runtime and run any AI agent locally or as a server — no cloud required.

Get OE Runtime →