Skip to main content

Introduction

Laravel AgentMail is a Laravel package that provides a clean, typed interface to the AgentMail REST API.

What is AgentMail?

AgentMail provides programmatic email inboxes designed for AI agents. Instead of configuring a traditional email provider, you call an API to spin up inboxes on demand, route messages to your agents, and tear them down when done — all without managing mail servers.

Common use cases include:

  • Creating a dedicated inbox for each AI agent or conversation thread
  • Receiving email responses in automated pipelines
  • Isolating email activity per customer or client

What this package does

polkachu/laravel-agentmail wraps the AgentMail REST API for Laravel applications. It provides:

  • A Laravel Facade (Agentmail::) for ergonomic access from anywhere in your app
  • Typed DTOsInbox and InboxCollection — so you always get typed objects back, not raw arrays
  • Full inbox management — list, create, get, update, and delete inboxes
  • Pagination support with cursor-based page tokens
  • Structured error handling via AgentmailException, which surfaces the API's error name, message, and HTTP status code

Requirements

  • PHP 8.1 or higher
  • Laravel 10, 11, or 12