Skip to main content
Give your agent email tools that call the OpenMail REST API directly — no CLI dependency needed.

Prerequisites

Set these environment variables before running any of the examples below:

Tools to implement


LangChain (Python)

Wire the agent


Vercel AI SDK (TypeScript)

Wire the agent


Generic (fetch)

For any framework that supports function calling — define these as your tool implementations.
Pass these functions as tool implementations in your framework’s tool-calling API. The JSON schemas for the LLM are:

Inbound email

The tools above let your agent poll for new mail with check_inbox. For real-time delivery, connect a WebSocket listener or configure a webhook — both push message.received events as they arrive. See the API integration guide — Step 4 for full WebSocket and webhook code examples with Node.js and Python.

API integration

Create inboxes, inject env vars, and handle inbound for multi-tenant apps.

API reference

Full endpoint documentation.

WebSockets

Real-time event streaming — no public URL needed.

Attachments

Sending and receiving files.