Mailgent for LangChain
Add Mailgent tools to your LangChain agent and it gains a real inbox and identity — usable as standard tools in chains, agents, and LangGraph workflows.
LangChain agents act through tools, and Mailgent maps cleanly onto that model. Wrap the Mailgent API as LangChain tools — or load them via an MCP adapter — and your agent can send mail, manage secrets, and more.
It works the same across chains, the agent executor, and LangGraph: the tools are just functions the agent can call, gated by the agent's scoped key.
Wrap Mailgent as tools
Define each Mailgent capability as a tool with a clear description and schema. The agent decides when to call it; the call hits the Mailgent API with the agent's key.
If you use an MCP-to-LangChain adapter, you can load the whole toolset at once instead of defining each by hand.
from langchain_core.tools import tool
import requests
@tool
def mail_send(to: str, subject: str, text: str) -> str:
"""Send an email from the agent's inbox."""
r = requests.post("https://api.mailgent.dev/v0/mail/send",
headers={"Authorization": f"Bearer {KEY}"},
json={"to": to, "subject": subject, "text": text})
return r.textFits chains, agents, and graphs
Because the tools are ordinary LangChain tools, they drop into any agent topology — a simple ReAct agent, a tool-calling agent, or a LangGraph node — without special handling.
FAQ
Python or JS?
Both. Wrap the REST API as tools in either LangChain SDK, or use an MCP adapter where available.
Does it work with LangGraph?
Yes. The tools are standard, so they work in LangGraph nodes like any other tool.
Give your agent an inbox.
A real email address, a vault, 2FA, and an identity in one API call.