00:00:00This is AgentMail, an API platform built specifically for AI agents that gives them
00:00:05a unique email address and inbox which allows them to send, receive, read and act upon emails
00:00:11to do things like customer support, cold outreach or just to be somewhere to manage all your forgotten
00:00:17newsletters. It works through a Python or TypeScript SDK, it has its own MCP server and even has its own
00:00:24CLI with skills to support it. But what's the difference between AgentMail and me creating a
00:00:29Gmail account for my agent using an MCP server to manage all of the messages? Hit subscribe and
00:00:35let's find out. Last week I made a video about the Google Workspace CLI which lets your agent manage
00:00:44your calendar, documents and of course your email which is really cool. But while your agent can
00:00:50manage Gmail with its own account, Gmail wasn't built for agents it was built for humans so it
00:00:56won't have the greatest experience. Let me explain. Now I've already signed up to AgentMail as you can
00:01:02tell by this AgentMail dashboard and created an inbox with a unique name. Note this AgentMail
00:01:08domain over here is because I'm on the free plan but you can add your own custom domain
00:01:14if you upgrade your plan. I've also created an API key and have added it to the list of
00:01:19my shell environment variables which means with the AgentMail CLI installed I can use it with
00:01:24Claude code and personally I prefer to use CLIs with Claude code instead of MCP servers. Let's also
00:01:30install the AgentMail skill to prevent me from referencing it inside my prompt. And that's it,
00:01:35you're good to use AgentMail with Claude. I know I've mentioned this already but if you have seen
00:01:39my Google Workspace CLI video you'll see how much easier it is to set up AgentMail than to set up
00:01:46this CLI to use with Claude code. Okay let's continue and now I can ask Claude what AgentMail
00:01:51inboxes do I have which will load up the skill then use the CLI to give me a response. Now from
00:01:56here I can get Claude to do some really cool things like send an email from my AgentMail email address
00:02:01to my personal email giving me a list of the top three places to get Matcha from King's Cross and
00:02:07yes I am a huge fan of Matcha. Let me know in the comments if you are too. And while it does that I
00:02:12want to prove to you that I don't have any messages that I've faked and now that it's done I have a new
00:02:18email giving me a list of the best places to get Matcha from in King's Cross. But because my agent
00:02:23has its own email address I can do some really cool things like sign it up to newsletters and I
00:02:29can also ask it to complete the subscription which it's gone ahead and done. But if I did want to do
00:02:34it manually I do have access to the inbox for the agent and we can see that the verification email
00:02:40for Node Weekly is over here but the agent has already completed this step. I could even forward
00:02:45some of my existing emails to the agent and ask the agent to summarise those emails which it's
00:02:52actually done quite well. I could even use called code's new loop feature to check every minute for
00:02:56new emails and summarise them which is actually a pretty good use of that feature. Now I'm just
00:03:01scratching the surface of what can be done with AgentMail because even if we just were to focus
00:03:06on inboxes you can have multiple inboxes for different agents. So if you have called code,
00:03:12codex, gemini, cli each one can have its own inbox or you could have an inbox just for subscriptions
00:03:18one just for customer support and because you're not charged based on inbox like other platforms
00:03:25it actually works out to be quite cost effective and allows you to have some really cool workflows
00:03:30like having an agent send a message to another inbox based on its contents and also getting
00:03:36agents to create inboxes on demand and delete them when they're done. Now I've been using
00:03:41AgentMail with Claude code which is nice for personal use and for testing but really you'd
00:03:47want this to be on its own custom agent because you don't want the limitation of having three days
00:03:52which you'll find more about on my video on loops and you might want to poll much more frequently.
00:03:58So let me show you an example of building a custom agent using the Claude SDK
00:04:03and using AgentMail. So here is a super simple agent powered by the Claude SDK that is using
00:04:09this email address from AgentMail and checking for new emails every 30 seconds from the time
00:04:15that the script starts running. So I'm not going to go through all the code in detail
00:04:19but we can see here it processes the messages and it does this by looking through all the
00:04:23messages inside the inbox checking the labels that are unread and based on the time that it's received
00:04:31it will then trigger another function which is generate reply and if we scroll down the
00:04:36generate reply function over here writes a prompt and this user content prompt goes to the Claude
00:04:42model which is currently haiku and it's using this system prompt to respond. So if we start the script
00:04:48we can see it's already noticed 16 messages in the inbox. I've been testing this a lot and so let's
00:04:54give it a new email and see if it replies. So I've written an email to the agent saying just testing
00:05:00the system who are you and what do you do. Now the script is polling every 30 seconds for new emails
00:05:06and now it's got one it's processing the message then using Claude to generate a response and if we
00:05:11go back we have a new email and a response from Claude which is super surreal but here it replies
00:05:17saying it's an AI assistant helping to manage this inbox and because this code is designed to read
00:05:23through threads I can send it a response saying thanks for your reply tell me a joke about cats.
00:05:29The script waits for 30 seconds processes the whole thread with three messages and then sends a
00:05:34response why don't cats play poker in the jungle because there are too many cheaters. As usual there
00:05:40are so many other features this tool has to offer that I haven't been able to go through in this
00:05:45video like web sockets for streaming events which also allow for zero latency email checking pods
00:05:51which isolate data between different customers if you're planning on building a product that offers
00:05:55the Asian mail infrastructure to different users IMAP and SMTP support and so much more. Speaking
00:06:02of things I didn't get around to showing all the features of in a video if you'd like to make a
00:06:06desktop app that is small fast and powered by web technology then you should check out this video
00:06:12I've made about electrobahn which might just be the thing you're looking for.