I recently came across this fantastic post by @morganwilliscloud: "AI Agents don’t need complex workflows: Build one in Python in 10 minutes." Her point was clear: we often overcomplicate Agentic AI. You don't need massive enterprise frameworks to build something functional. Inspired by that "build-to-understand" philosophy, I decided to create Alfred—my personal digital butler running locally on my Linux Mint machine.
🧠 The Brains: Local & Private
Following Morgan’s lead, I skipped the heavy cloud APIs. Instead, I used Ollama with the Qwen 2.5 Coder (7B) model. It’s incredibly snappy at function calling and runs entirely on my hardware.
🛠️ Giving Alfred "Hands" (The Tools)
While a basic agent might just do math, I wanted Alfred to actually manage my OS. Using Python’s subprocess and psutil, I gave him four specific skills:
System Health Check: He monitors CPU, RAM, and Disk usage in real-time.
Multimedia Control: He scans my ~/Videos and ~/Music folders to launch VLC or Audacious on command.
Deep Search: A smart wrapper around the find command to locate any file across the system.
Content Discovery: Using grep to find specific strings inside text files without me having to remember complex flags.
💻 The Implementation
I used a lightweight orchestration layer to handle the loop, ensuring Alfred maintains his "impeccable British butler" persona while executing technical tasks.
The heart of the Butler
agente = Agent(
model=model,
tools=[media_play, system_status, fast_search, find_text],
system_prompt=(
"You are ALFRED, kernel's digital butler. Your tone is impeccable and polite.\n"
"RULES:\n"
"- ALWAYS call a tool if the request is technical.\n"
"- Be brief and address him as 'Sir' or 'kernel'."
)
)
🛡️ Security First
As Morgan emphasizes in her cloud architecture sessions, automation must be secure. Since Alfred has access to my shell, I implemented shlex for input sanitization:
Sanitizing user input for safe shell execution
safe_query = shlex.quote(query.strip())
cmd = f"find {USER_HOME} -iname '{query}' -type f 2>/dev/null | head -n 10"
🚀 Why This Matters
Building this taught me that the "10-minute agent" isn't just a toy—it's a foundation. Alfred now saves me several minutes a day by fetching files and checking system vitals through a simple chat interface.
A huge thanks to @morganwilliscloud for stripping away the complexity and showing that the best way to learn AI is to give it the keys to your terminal (carefully!).
Top comments (0)