Welcome to the forefront of conversational AI as we explore the fascinating world of AI chatbots in our dedicated blog series. Discover the latest advancements, applications, and strategies that propel the evolution of chatbot technology. From enhancing customer interactions to streamlining business processes, these articles delve into the innovative ways artificial intelligence is shaping the landscape of automated conversational agents. Whether you’re a business owner, developer, or simply intrigued by the future of interactive technology, join us on this journey to unravel the transformative power and endless possibilities of AI chatbots.
I’m Geoff Cox, a hands-on engineering leader in Seattle. I lead engineering teams, and I still write code.
I’m Geoff Cox, a hands-on engineering leader in Seattle. I lead engineering teams, and I still write code.
I’m Geoff Cox, a hands-on engineering leader in Seattle. I lead engineering teams, and I still write code.
This is a step-by-step guide to setting up your first AI agent that runs on its own every day. The example is the bot that reads our kids’ school email, which I wrote about in my post on the school email bot. It reads the school mail and messages, and every afternoon it sends my wife Mimi and me one short email with what we need to do. You don’t need to write any code. If you can paste a long block of text and click through some account settings, you can do this.
The same steps work for any inbox you can’t keep up with, e.g. a sports league, a homeowners’ association or a volunteer group. School email is just the example I know best.
Setting up our bot took about an hour. Getting it to where it was mostly right took about a week of checking its work. Then, over the next several weeks, reading the digests turned up edge cases that only show up over time, and each one became a new rule. That’s a realistic budget, and the week of checking matters most, because that’s where the bot becomes something you can trust.
The rest of this post explains why each step matters.
Every afternoon, the bot reads the new school email and any school app you use, follows the links to the full newsletters, and writes one digest. The must-dos come first, every event has a time (or says “time not listed”), and anything that isn’t already on your calendar gets an “Add to calendar” link that takes one click. On Saturday evenings, a second email looks ahead at the next two to three weeks.
In our house, that replaced 30-plus school emails a week and a separate school app. That being said, it doesn’t make the information go away. Mimi is often overwhelmed by how much the schools send, and she reads the digests when she has the headspace for it. Even the digests can feel like a lot. So, keep your digest short, and put the few things that really need doing at the very top. The template asks for the three most important must-dos in a short list before anything else.
The bot needs to read your email, and it needs to send the digest. If it sent from your account, one bad run could email a teacher in your name. So, give it its own account, and only let it send from that one. Create a new Gmail account, e.g. with your family name and “school-bot” in it, and turn on 2-step verification.
Then create the shared list. In Google Groups, create a group and add yourself and your partner. It works as one shared email address that forwards every email to both of you. Ours lets anyone post to it, which is the simplest setting, since the bot’s new address can send to it without any extra steps. Send a test email from the bot’s account and check that both of you get it.
Create a new bot in your service, and connect three things to it.
When you connect your own Gmail and calendar, choose read-only access if your service offers it. A rule in the prompt is good, but a permission the bot doesn’t have is better, because it can’t be talked out of it. You can check what you granted in your Google account, under Third-party apps and services. For our bot, it lists “View your email messages and settings” and “See and download any calendar you can access”, which are both read-only.
Check there rather than asking the bot. While writing this post, I asked ours what it was allowed to do, and it said its connections offered tools to send email and change calendar events. The tools show up, but Google would refuse them, since the permissions behind them are read-only. In other words, the bot doesn’t know its own permissions, and the only place to find out is the permission page.
The prompt is the most important part, and it’s where most of the tuning happens. The full version, for both the daily digest and the Saturday look-ahead, is in the template, with a table that explains each blank. Here’s a shortened version, so you can see its shape:
The blanks are where your family’s details go: the kids’ grades and schools, the addresses school mail comes from (e.g. the district, the PTA, the after-school club), and the noise to leave out. In our case, the noise is mostly the kids’ sports team apps, which sent 120 emails in the same six weeks that the schools sent about 200.
Most of the rules are about what the bot can’t do, and each one has a reason:
You don’t need to get all of these right on day one. You’ll find your own the same way I found mine, in the next step.
Before you put the bot on a schedule, run it by hand once a day for about a week, and check every digest against the original emails. You’re looking for anything it missed, anything it got wrong and anything it made up. Every time you find one, add a rule to the prompt that would have prevented it.
A crash is easy to spot, since no digest shows up. A digest that looks complete but isn’t is much worse, because you trust it. Here are a few things from our bot’s last few weeks, more than two months after we started:
The first one is worth knowing about before you start. If the digest says something different today than it did yesterday, don’t assume today’s is right. Check the source.
Once a week goes by without a new mistake that matters, put it on a schedule. You don’t need to find a button for this. In Grok Bot, I asked the bot in chat to set up a daily routine and a Saturday routine, and they show up in the Routines list when you click the bot’s name. Ours runs every day at about 4 PM, after the schools have sent their mail, and the look-ahead runs on Saturdays at about 5 PM.
One rule I changed after about eight weeks: send an email every day, even when nothing is new. At first, our bot stayed silent on quiet days, so that an email from it always meant there was something to read. The trouble is that a quiet day looked exactly the same as a broken bot. Since November 2, a quiet day gets a short “nothing new” email that lists what the bot checked: the email, the school app and the calendars. The one exception is a quiet Saturday, because the weekly look-ahead covers it.
Our schools also use TalkingPoints, an app for announcements and teacher messages that never reaches email. It has no API, i.e. no official way for a program to read it, so the bot reads it the way a person would, in the web browser on its own cloud computer, and it stays signed in between runs.
Signing in takes a code sent by text message to a phone number the school manages. When the session runs out, the bot puts a note at the top of the digest asking me to sign in, and still sends what it found in email. In Grok Bot, I click “Open computer”, take over the bot’s screen, type in the code from my phone and hand control back. If your school uses an app like this, start with email only, and add the app once the email digest is working.
Keep a copy of the prompt somewhere outside the service, e.g. in a document, and update it every time you add a rule. If the service changes or goes away, the prompt is the bot. Without it, you’d be rebuilding a few weeks of lessons from memory.
If the bot turns into something you rely on, and you’re comfortable with git (a tool that keeps the full history of every change to a folder of files), you can go a step further. My bots each have a profile in a repo, with the prompt, what the bot can access and every lesson so far. I wrote about that in my post on the memex, and the memex-template repo has a starting point.
Thanks for reading.
Why Thousands of Tests Couldn't Catch the Bugs in My AI Trading Bot
I’m Geoff Cox, a hands-on engineering leader in Seattle. I lead engineering teams, and I still write code.