Ch 14: Automations and Background Work
Imagine your office building has a night watchman. You go home at 6 PM, but the building does not sleep. Deliveries arrive at the loading dock. Pipes might burst. A window might be left unlocked. The night watchman does not wait for your phone call to act. They patrol on a schedule. They respond to alarms. They handle deliveries when the truck shows up. If something goes wrong, they fix what they can and leave you a note for the morning.
Until now, your helper has been like a building with no watchman. Nothing happens unless you walk through the door and give an order. A package sits at the loading dock all night. A door stays unlocked for hours. A dripping pipe turns into a flooded hallway because nobody checked.
Automations are your night watchman. They watch for things that happen in the building — a delivery arriving, a door opening after hours, a timer going off at midnight — and they respond on their own. No phone call needed. No waiting. The building takes care of itself.
A real system does not wait to be told — it watches, responds, and works while you sleep.
Waiting vs. Watching
Until this chapter, your helper has been waiting. You ask a question. The helper answers. You give an instruction. The helper follows it. Nothing moves unless you speak first.
Automations flip this around. Instead of waiting, your helper is watching. Something happens in the building, and the helper responds on its own.
Here are three examples from the building:
A delivery truck arrives at the loading dock. Nobody called to say it was coming. But the watchman hears the truck pull up, walks to the dock, checks the delivery slip, and signs for the package. The delivery is handled because the watchman was watching, not because someone asked them to go check.
Every night at midnight, the watchman checks all the locks. Nobody sends a reminder. The clock hits twelve, and the watchman walks the halls, testing every door. This is a scheduled patrol — it happens at the same time every night, rain or shine, whether anyone remembers or not.
A smoke detector goes off on the third floor. The watchman does not wait for a phone call. The alarm itself is the signal. They rush to the third floor, find the source, and deal with it — maybe it is a real fire, maybe someone left a toaster on. Either way, the response is immediate because the alarm triggered it automatically.
The pattern is always the same: something happens, the watchman notices, the watchman responds, and the result gets written down. The only difference from your earlier chapters is who starts the action. Before, it was always you. Now, it is the world around the building.
You are the night watchman in a ten-story office building. It is 11 PM. Everyone else went home hours ago. Let us see how you handle what the night brings.
Order the watchman's nightly routine
Drag to reorder, or use Tab + Enter + Arrow keys.
- The building manager posts standing orders for the watchman
- The watchman memorizes each order and what triggers it
- Something happens in the building — a door is found open
- The watchman matches the event to the right standing order and acts
- The result is written in the log for the morning crew
Key Insight
There is a difference between a tool and a system. A tool sits on a shelf. It does nothing until someone picks it up. A flashlight does not turn itself on when the lights go out. A fire extinguisher does not spray when it smells smoke. Tools wait.
A system is different. A system watches, responds, and works while you sleep. The night watchman does not sit in a chair waiting for a phone call. They patrol the hallways, check the locks, respond to alarms, and handle deliveries — all on their own. And when they find something, they do not just fix it and move on. They write it in the log. They leave a note for the morning crew. They know the difference between something they can handle quietly and something that needs to be reported right away.
That is what makes the watchman more than just a person with a flashlight. The flashlight is a tool. The watchman is a system — alert, responsive, reliable, and always keeping records. Your helper, with automations, becomes the same kind of system. It does not wait for you to ask. It watches the building, responds to what happens, and makes sure you find a clean report every morning.
What's Next
You have skills that inject capabilities on demand and automations that run workflows in response to events. But your agent still lives in a closed world — it only knows the tools you hard-coded into the registry. Real production systems need to connect to external tools dynamically.
In Chapter 15, you will learn the Model Context Protocol (MCP) — an open standard that lets your agent discover and connect to external tool servers at runtime. Your ToolRegistry becomes a gateway to an ecosystem of capabilities.