How To Schedule Your AI Agent With Cron Jobs 24/7
Blog

How To Schedule Your AI Agent With Cron Jobs 24/7

Make your OpenClaw agent truly proactive by setting up heartbeats for awareness checks, cron jobs for scheduled tasks, and coded automations for multi-step workflows. This guide covers all three mechanisms so your AI agent works around the clock.

TL;DR
  • Heartbeats wake your agent every 30 minutes to check a monitoring list you define
  • Cron jobs run specific tasks at exact times β€” morning briefings, backups, SEO posts
  • Coded automations handle multi-step workflows like lead research and outreach
  • Use /cron to see your running jobs and audit your heartbeat document
  • Host your agent on OpenClaw Direct for true 24/7 operation
OpenClaw Direct Team ·

Your AI agent is probably sitting there right now, waiting for you to tell it what to do. And that’s fine — but what if it could wake itself up, check on your business, run scheduled tasks, and send you a heads-up when something needs your attention? That’s exactly what you get when you schedule your AI agent with cron jobs, heartbeats, and automations in OpenClaw, and the whole setup takes about ten minutes.

Why Your Agent Shouldn’t Just Sit There

Most people set up their OpenClaw agent, have a great conversation with it, maybe get it to do a few tasks — and then it goes quiet. It’s waiting for you. And sure, that’s useful, but you’re leaving a lot of value on the table. The thing is, OpenClaw has built-in features that let your agent work proactively around the clock, and once you understand the three mechanisms behind it, you’ll wonder why you didn’t set them up sooner. Those three mechanisms are heartbeats, cron jobs, and coded automations, and each one serves a different purpose depending on what you need.

Heartbeats: Your Agent’s Awareness Check

A heartbeat is the simplest way to make your AI agent proactive. Every 30 minutes by default (though you can change the interval), your agent wakes up and reads a document called HEARTBEAT.md — think of it as a checklist of things it should keep an eye on. Maybe it’s checking your email for urgent messages, glancing at your calendar for upcoming meetings, monitoring your website’s uptime, or even reminding you to post that video you’ve been putting off.

What makes the heartbeat clever is that it doesn’t just blindly execute tasks. It reads the checklist, assesses what’s happening, and makes a judgment call about whether anything actually needs your attention. If everything looks fine, it stays quiet — the Gateway strips out the response and you never even know it ran. But if something comes up, like an email from a client that needs a fast reply or a calendar conflict, it sends you a message proactively through whatever channel you’re using — Telegram, Slack, Discord, or WhatsApp.

OpenClaw is also smart about how it spends your tokens here. Before calling the AI model, it runs cheap deterministic checks first — API queries, shell commands, simple pattern matches. The model only gets involved when there’s actually something worth thinking about, which keeps your costs down even if the heartbeat fires every half hour.

To see what’s currently in your agent’s heartbeat, just ask it to send you the heartbeat file. You can edit it anytime by telling your agent what you want it to monitor, and it’ll update the document accordingly. Want it to keep you accountable for posting on YouTube? Add that to the heartbeat. Want it to scan your inbox every cycle? Same thing. The intelligence lives in the checklist, not in the scheduling mechanism, so you can make it as simple or as comprehensive as you like.

Cron Jobs: When Timing Matters

If heartbeats are about awareness, cron jobs are about precision. An AI agent cron job runs a specific task at an exact time you define — every morning at 9 AM, every two hours, once a week on Mondays, whatever schedule makes sense for the task at hand. Unlike heartbeats, which make a judgment call about what to do, cron jobs execute a set task every single time they fire.

The classic use case people start with is a morning briefing. You connect your agent to a few APIs — Google Analytics, Google Search Console, your YouTube analytics, your CRM — and then set up a cron job that runs at, say, 7 AM every day. When it fires, your agent pulls fresh data from all those sources, puts together a report, and sends it to you before you’ve even finished your coffee. No manual prompting, no logging into dashboards, just a clear summary of where things stand waiting in your Telegram chat.

OpenClaw gives you a few ways to schedule these. You can use standard five-field cron expressions if you’re comfortable with that syntax (minute, hour, day of month, month, day of week), or you can set a fixed interval in milliseconds, or even a one-shot timestamp for tasks that only need to run once. The scheduler uses the croner library under the hood, and jobs persist in ~/.openclaw/cron/ so they survive restarts.

One of the more interesting things about OpenClaw’s cron implementation is that you get two execution modes. A cron job can either run in the main session, where it has full access to your conversation context and history, or in an isolated session with its own clean context. Isolated mode is great for background tasks you don’t want cluttering up your chat — things like backing up your agent’s configuration to GitHub every two hours, or writing an SEO blog post once a day to your website.

To see all your running cron jobs, just type /cron in your agent chat and you’ll get a full list. Setting up a new one is as simple as saying something like “make a cron job for a morning analytics briefing at 8 AM” and then making sure your agent has access to the tools it needs — the right APIs, MCP servers, and permissions to read the data and send you the results.

The Difference Between Heartbeats and Cron Jobs

People sometimes mix these up, but the distinction matters and it’ll change how you think about scheduling your AI agent. A heartbeat is a periodic awareness sweep — your agent wakes up, looks around, and decides if anything warrants action. A cron job is a scheduled task with a guaranteed execution time. Think of the heartbeat like a security guard doing rounds: they walk the building, check the doors, and only call you if something is wrong. A cron job is more like a scheduled meeting — it happens at the appointed time regardless of whether there’s anything urgent.

So if you want your agent to send you an analytics report every morning at a specific time, that’s a cron job. If you want your agent to keep an eye on your email and only message you when something important comes in, that’s a heartbeat. Both of them contribute to making your AI work 24/7, but they serve fundamentally different purposes, and the best setups use both together.

Automations: Vibe-Coded Pipelines

The third mechanism is the most powerful but also takes the most work to set up. Automations in OpenClaw are hard-coded pipelines that you essentially vibe code with your agent. Unlike heartbeats and cron jobs, which rely on the AI model to read context and decide what to do on every run, automations are deterministic sequences of steps that execute without burning tokens on decision-making — at least until a step requires AI processing.

Here’s a concrete example. Say you’re a consultant and you want something to happen automatically every time someone books a call with you. You could build an automation where: a booking triggers a Telegram notification, then the agent kicks off deep research on that person (checking LinkedIn, their company, recent news), then it drafts a personalized email and drops it into your Gmail inbox for you to review, and finally it logs all that research into your Notion CRM. Every step is coded, every step runs reliably, and you didn’t have to open a single tab.

Now, setting one of these up is a bit different from just telling your agent to do something. Because automations involve multiple interconnected steps, you need to plan them out properly. The recommended approach is to tell your agent the full pipeline you want, ask it to plan the entire project, and then have it create a build log document as it codes each piece. That build log is crucial — if your agent loses context midway through a complex build (which happens with long sessions), it can read the log and pick up exactly where it left off. Think of this as vibe coding with guardrails: you describe what you want, but you give the agent a structured way to track its own progress.

The difference from tools like Zapier or Make.com is that everything lives in code alongside your agent, and you can modify it just by having a conversation. No drag-and-drop interface, no third-party platform costs, just your agent writing and maintaining the automation for you.

What To Schedule: Ideas That Actually Generate Value

One of the best things you can do after reading this is ask your own agent what it thinks you should automate. Since it already knows your business context, your tools, and your workflow, it’ll come up with ideas that are surprisingly specific and useful. But to get you started, here are some of the most common setups people are running with their proactive AI agents right now.

Morning briefings are the gateway drug — everyone starts there, and for good reason. Connect your agent to Google Analytics, Search Console, and whatever other dashboards you check daily, then schedule a cron job for your wake-up time. You get a digest of traffic trends, keyword rankings, and anything that changed overnight, all in one message. From there, people tend to set up automated backups (having the agent commit its own configuration to GitHub on a schedule), CRM sweeps that check for stale leads who haven’t been contacted in a while, automated social media posting through integrations like GenViral, SEO content pipelines that draft and publish blog articles on a recurring basis, and YouTube comment monitoring that flags potential leads or questions that deserve a response.

The key with all of these is connecting your agent to the right tools through APIs and MCP servers. MCP — the Model Context Protocol, originally introduced by Anthropic and now an industry-wide open standard under the Linux Foundation — is what lets your agent talk to external services in a structured way. Without the right MCP servers or API connections, your agent can plan and reason about tasks but can’t actually execute them, so make sure you’re giving it access to the tools it needs before setting up any scheduled work.

Setting This Up Tonight

If you want to get started right now, here’s the simplest path. Open your agent chat and type /cron to see what you already have running — you might be surprised to find it’s empty. Then ask your agent to send you its heartbeat file so you can see what it’s currently monitoring (again, probably not much). From there, start with one cron job and one or two heartbeat items.

For the cron job, a morning briefing is the easiest win. Tell your agent something like “set up a cron job to send me an analytics briefing every morning at 8 AM” and make sure it has access to whatever data sources you want included. For the heartbeat, add something simple like monitoring your email for messages from specific people, or checking whether a particular service is still online. Build from there — once you see your agent proactively reaching out with useful information, you’ll quickly find more things to add.

One important thing to keep in mind: for all of this to work around the clock, your OpenClaw instance needs to be running on a persistent server. If it’s on your laptop and you close the lid, your cron jobs and heartbeats stop firing. That’s why services like OpenClaw Direct exist — they host your agent for you so it stays online around the clock, which means your scheduled tasks actually run 24/7 too.

And for the automations, give yourself a bit more time. Plan out the pipeline you want, discuss it with your agent, have it create a project plan and build log, and then let it code the whole thing step by step. It takes longer upfront but the result is a reliable, token-efficient pipeline that runs without you touching it.

The whole point of having an AI agent is that it should be working for you, not just waiting for instructions. Once you have heartbeats monitoring your world, cron jobs running your reports, and automations handling your repetitive workflows, your agent genuinely becomes something closer to a 24/7 AI employee — and that changes the economics of how much value you get out of it pretty dramatically.


Sources: This article is adapted from How to Make Your OpenClaw Work Proactively 24/7 on YouTube. Additional information from OpenClaw Cron Jobs Documentation, OpenClaw Heartbeat Documentation, and Model Context Protocol.