How to Build Your First Autonomous AI Agent (No Coding Background Needed)
You don't need to be a developer to build an AI agent. You need a terminal, 30 minutes, and a willingness to copy-paste. I'm going to walk you through building your first one right now.
I'm not a coder. I was a Google Workspace Account Manager for 6 years. I learned Python by building things I needed — badly enough that I was willing to feel stupid for a few hours. This agent was one of the first things I built, and it still runs every 15 minutes on my Mac Mini. It hasn't needed my attention in months.
What You Need
A Mac or Linux machine. (Windows works too with WSL, but I'm writing from Mac-land.) Python 3 — it's probably already installed. A Discord account with a server you own. And about 30 minutes where nobody's bothering you.
That's it. No cloud account. No API keys (for this one). No credit card.
Step 1: Create the Python Script
Open your terminal. If you've never opened Terminal before, hit Command+Space, type "Terminal," and press Enter. You'll see a dark window with a blinking cursor. This is where the magic happens.
Create a folder for your agent and a file to put the code in:
mkdir ~/my-agent
cd ~/my-agent
nano health-monitor.py
That opens a basic text editor right in the terminal. Now paste this entire script. I'll explain what each part does below.
import os, shutil, datetime, json
from urllib.request import Request, urlopen
# --- CONFIG ---
WEBHOOK_URL = "YOUR_DISCORD_WEBHOOK_HERE"
DISK_WARN_GB = 10 # alert if less than 10GB free
LOG_FILE = os.path.expanduser("~/my-agent/health.log")
def check_disk():
"""Check free disk space."""
usage = shutil.disk_usage("/")
free_gb = usage.free / (1024**3)
return free_gb, free_gb < DISK_WARN_GB
def check_uptime():
"""Get system uptime."""
try:
result = os.popen("uptime").read().strip()
return result
except:
return "Could not read uptime"
def send_discord(message):
"""Send a message to Discord via webhook."""
data = json.dumps({"content": message}).encode()
req = Request(WEBHOOK_URL, data=data,
headers={"Content-Type": "application/json"})
urlopen(req)
def log(message):
"""Write to the log file."""
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
with open(LOG_FILE, "a") as f:
f.write(f"[{now}] {message}\n")
# --- MAIN ---
if __name__ == "__main__":
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
free_gb, low_disk = check_disk()
uptime = check_uptime()
status = f"**System Health Check** | {now}\n"
status += f"Disk: {free_gb:.1f} GB free\n"
status += f"Uptime: {uptime}\n"
if low_disk:
status += f"**WARNING: Disk space below {DISK_WARN_GB} GB!**"
send_discord(status)
log(f"Disk: {free_gb:.1f}GB | Low: {low_disk}")
print("Health check sent.")
Here's what each piece does, in plain English:
check_disk() asks your computer how much storage is left. If it's below 10GB, it raises a flag. You can change that number to whatever makes sense for your machine.
check_uptime() runs the uptime command — the same thing you'd type in Terminal. It tells you how long your computer has been on and how hard it's working.
send_discord() is the notification engine. It takes a message and fires it to a Discord channel using a webhook (we'll set that up next). No bot required. No libraries to install. Just a URL and a POST request.
The main block at the bottom ties it all together: check disk, check uptime, build a message, send it to Discord, write to a local log. Done.
Step 2: Set Up the Discord Webhook
Open Discord. Go to your server. Pick a channel (or create one called #system-health). Click the gear icon next to the channel name. Go to Integrations. Click "Webhooks." Click "New Webhook." Give it a name like "Health Monitor." Copy the webhook URL.
Now go back to your script and replace YOUR_DISCORD_WEBHOOK_HERE with the URL you just copied. Make sure it stays inside the quotes.
Save the file (in nano, that's Control+O, then Enter, then Control+X to exit).
Step 3: Test It
Run the script manually first to make sure it works:
python3 ~/my-agent/health-monitor.py
Check Discord. You should see a message with your disk space and uptime. If you see it — congratulations. You just built a working agent. The hard part is done.
Step 4: Make It Autonomous
Right now your agent only runs when you tell it to. That's not autonomous. Let's fix that with cron — a scheduling tool that's been on every Unix system since the 1970s. It runs tasks on a schedule, forever, without needing you.
crontab -e
This opens your cron schedule. Add this line at the bottom:
*/15 * * * * python3 /Users/YOUR_USERNAME/my-agent/health-monitor.py
Replace YOUR_USERNAME with your actual username. Those five fields before the command mean: every 15 minutes, every hour, every day, every month, every weekday. Save and exit.
That's it. Your agent now runs every 15 minutes, automatically, whether you're at your computer or not. Whether you're awake or not. Whether you remember it exists or not. It just runs.
Step 5: Watch It Run
Walk away from your computer. Go make coffee. Come back in 15 minutes and check Discord.
There it is. A message you didn't send. From a program you built. Running without you.
The satisfaction of watching your first agent run at 2am without you is genuinely one of the best feelings in tech. I'm not being dramatic. There's something deeply satisfying about knowing your machine is doing useful work while you sleep. Like having a night shift employee who never complains and never calls in sick.
What to Build Next
Morning briefing bot (about 1 hour): Same pattern, but instead of disk space, pull in weather data (Open-Meteo API, free, no key needed), your calendar events, and a motivational quote. Schedule it for 7am. Wake up to a personalized briefing every morning.
Website uptime monitor (about 1 hour): Use Python's urllib to ping your website every 5 minutes. If it returns anything other than a 200 status code, fire a Discord alert. Simple, but you'll know your site is down before your customers do.
Lead scraper (2-3 hours): Use DuckDuckGo search (no API key needed) to find businesses matching your target keywords. Score them by relevance. Send the top results to Discord every morning. This is a simplified version of what my Lead Engine does — and even the simple version saves hours of manual prospecting.
The pattern is always the same: gather data, make a decision, take an action (or send a notification), repeat on a schedule. Once you see the pattern, you can build anything.
This is one of the 7 agents in MojoBrain. Want all 7 ready to deploy? eyshtech.vip/mojobrain.
Download the Free MojoBrain Architecture Guide
See how 7 autonomous AI agents run a real business — the architecture, the stack, and 3 agents you can build today.
Get the Free Guide →