Skip to content
Back to skills

Langchain Email Agent

ASecurity

The EmailAgent class provides an AI-powered email composition and

  • 14 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 7, 2026
ai-agentstypescript

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill langchain-email-agent --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Langchain Email Agent?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Langchain Email Agent
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-langchain-email-agent/badge)](https://www.skillsdirectory.com/skills/modbender-langchain-email-agent)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: EmailAgent README
description: 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 ...
---

# 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

| Variable | Default | Description |
|----------|---------|-------------|
| `OPENAI_MODEL` | `gpt-4o-mini` | OpenAI model to use |

## Usage

```typescript
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

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `email` | string | Yes | Recipient email address |
| `name` | string | Yes | Recipient name |
| `subject` | string | No | Email subject line |
| `body` | string | No | Initial email body content |
| `instructions` | string | No | AI instructions for composing the email |

## Return Value

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

Files in this skill

  • SKILL.md2 KB
  • email.agent.ts1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…