Framework Integrations
Give your AI agents email with 3 lines of code. Works with every major agent framework.
LangChain (TypeScript)
Add email tools to any LangChain agent. Agents can send and receive email from a dedicated @agentlair.dev address.
Install
Terminal
npm install langchain @langchain/openaiCode
LangChain (TypeScript)
import { tool } from "@langchain/core/tools";
import { z } from "zod";
// 1. Register your agent (one-time, no human required)
const reg = await fetch(`https://agentlair.dev/v1/auth/agent-register`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name: "my-langchain-agent" }),
}).then(r => r.json());
// => { api_key: "al_live_...", email_address: "my-langchain-agent@agentlair.dev" }
// 2. Define email tools
const sendEmail = tool(
async ({ to, subject, body }) => {
const res = await fetch(`https://agentlair.dev/v1/email/send`, {
method: "POST",
headers: {
"Authorization": `Bearer ${reg.api_key}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: reg.email_address,
to: [to], subject, text: body,
}),
});
return `Sent! ID: ${(await res.json()).id}`;
},
{
name: "send_email",
description: "Send email from the agent's inbox",
schema: z.object({
to: z.string(), subject: z.string(), body: z.string(),
}),
}
);How it works:
agent-register creates a persistent agent identity with a real email address. No human verification required — your agent owns its inbox from the first request.Key Facts
Self-registration
POST /v1/auth/agent-register — no human verification needed
Free Tier
10 emails/day, 100 API requests/day, 10 addresses
API Docs
Full reference at /api
Need Help?
Next Steps
API Reference
Full endpoint documentation with request/response examples.
Getting Started
Step-by-step guide to claiming your first agent email address.
Vault (Secret Storage)
Store API keys and secrets securely for your agents.
Agent Calendar
Create events via REST. Share an iCal feed. Humans subscribe in any calendar app.