Combine Pydantic AI's type safety and dependency injection with MultiMail's email infrastructure for validated, reliable email agents with human oversight.
Pydantic AI is an agent framework built on Pydantic that brings type safety and validation to LLM interactions. It uses dependency injection for tools and provides structured, validated outputs from agents. MultiMail provides the email infrastructure that Pydantic AI agents need to actually send, receive, and manage messages with production reliability.
By integrating MultiMail with Pydantic AI, you get type-safe email operations where tool inputs and outputs are validated by Pydantic models. The dependency injection pattern makes it clean to pass MultiMail API credentials and configuration to your tools without global state. MultiMail's gated_send mode adds human judgment on top of type validation.
Connect Pydantic AI to MultiMail by defining tool functions with type-annotated parameters and using dependency injection to provide API configuration. The framework validates all inputs and outputs automatically.
Pydantic AI validates tool inputs with Pydantic models. Define typed schemas for email recipients, subjects, and bodies, ensuring your agent always sends well-structured API requests to MultiMail.
Pass MultiMail API keys, mailbox IDs, and configuration through Pydantic AI's dependency injection system. No global state or environment variable hacks — clean, testable configuration management.
Pydantic AI's result validators ensure structured output, but cannot prevent a well-structured but inappropriate email. MultiMail's oversight adds human judgment at the delivery layer, catching what validators miss.
Define result types for email operations — classification results, draft summaries, delivery status — all validated by Pydantic models. Your application code gets typed objects, not raw strings.
Pydantic AI's dependency injection makes it easy to test email agents with mock MultiMail responses. Swap the real API client for a test double without changing agent logic.
No code, no dashboard. Paste this to your AI agent — it connects MultiMail, creates an inbox, and builds the flow for you.
Sign up at multimail.dev, create a mailbox, and generate an API key. Your key will start with mm_live_.
Install Pydantic AI and requests for calling the MultiMail API.
Create a dataclass for email dependencies (API key, mailbox ID) and a Pydantic model for structured results.
Decorate functions with @agent.tool that accept RunContext[EmailDeps] and call MultiMail API endpoints with the injected configuration.
Execute the agent with your dependencies. Review pending emails in the MultiMail dashboard when using gated_send mode.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a hosted MCP server. Formally verified in Lean 4.