OpenClaw · Skill

Langchain Email Agent

The EmailAgent class provides an AI-powered email composition and sending capability using LangChain with OpenAI's GPT model. It includes human-in-the-loop middleware that requires approval before emails are sent.

Coding Agents & IDEs
v1.0.0
VirusTotal: Benign

Install

Start with the primary install command. Alternate entrypoints are included below for ClawHub and OpenClaw CLI users.

Primary command

clawhub install jawadsadiq01/langchain-email-agent

ClawHub installer

npx clawhub@latest install jawadsadiq01/langchain-email-agent

OpenClaw CLI

openclaw skills install jawadsadiq01/langchain-email-agent

Direct OpenClaw install

openclaw install jawadsadiq01/langchain-email-agent

What this skill does

The EmailAgent class provides an AI-powered email composition and sending capability using LangChain with OpenAI's GPT model. It includes human-in-the-loop middleware that requires approval before emails are sent.

Why it matters

The built-in approval gate prevents accidental sends, making it safer than fully autonomous email agents.

Typical use cases

  • Drafting outreach emails with tone instructions
  • Sending meeting requests with AI-written copy
  • Reviewing AI-composed emails before delivery
  • Composing follow-up emails from minimal input
  • Automating email drafts while keeping human oversight

Source instructions

EmailAgent README

Overview

The EmailAgent class provides an AI-powered email composition and sending capability using LangChain with OpenAI's GPT model. It includes human-in-the-loop middleware that requires approval before emails are sent.

Configuration

Environment Variables

VariableDefaultDescription
OPENAI_MODELgpt-4o-miniOpenAI model to use

Usage

import { EmailAgent } from './email.agent';
import { SendEmailDto } from '../dto/send-email.dto';

const agent = new EmailAgent();

const dto: SendEmailDto = {
  email: 'recipient@example.com',
  name: 'John Doe',
  subject: 'Meeting Request',      // optional
  body: 'Initial email content',   // optional
  instructions: 'Keep it formal'   // optional
};

const result = await agent.sendEmail(dto);

Human-in-the-Loop Middleware

The agent uses humanInTheLoopMiddleware which interrupts execution on the EmailTool before sending emails. This allows for:

  • approve - Send the email as composed
  • edit - Modify the email before sending
  • reject - Cancel the email operation

The readEmailTool is excluded from interruption (false), allowing read operations to proceed without approval.

Parameters

ParameterTypeRequiredDescription
emailstringYesRecipient email address
namestringYesRecipient name
subjectstringNoEmail subject line
bodystringNoInitial email body content
instructionsstringNoAI instructions for composing the email

Return Value

Returns the final message content from the agent as a string.

Related OpenClaw skills

Browse all →
Featured slot

Your product here

Reserve this slot to reach operators and coding-agent buyers.

Shown where builders are actively comparing tools and deployment options.

Advertise