Building AI Agent Loops and Workflows
Step-by-Step Tutorial Inspired by Matt Van Horn & Eric Siu
This tutorial distills the key ideas from the conversation between Matt Van Horn and Eric Siu into a practical, actionable framework.
Instead of one-off prompting, you'll learn to build self-running "loops" (scheduled automation + LLM judgment), turn repetitive processes into reusable skills, and equip agents with fast, reliable CLIs instead of brittle web interfaces.
Reference: Original X thread / conversation
This builds directly on the philosophy explored in Loops, Not Prompts — shifting from manual prompting to autonomous systems.
Prerequisites
- Basic familiarity with tools like Claude, Cursor, or other LLMs/agents.
- A computer with terminal access (Mac/Linux preferred).
- GitHub account and basic command-line comfort.
- Optional but recommended: Access to Claude Code or similar agentic environments for running loops.
Step 1: Understand & Identify a Loop (Cron Job + LLM Judgment)
A loop is an automated process that runs on a schedule (or trigger) and uses AI for decisions, not just rote actions.
Action Steps
- List 3–5 repetitive tasks you do weekly (e.g., "review sales emails," "research competitors," "prep social content").
- For each, define:
- Trigger: Cron schedule (e.g., daily at 8 AM) or event (new email arrives, new row in Google Sheet).
- Goal/State: Clear success criteria (e.g., "All high-priority leads replied to and flagged").
- Judgment: What decisions does the agent make? (e.g., "Prioritize based on revenue potential").
- Write a simple prompt template for the agent.
Example Loop: Inbound Email Responder
- Trigger: New email arrives.
- Goal: Every inbound replied to within 4 hours; flag uncertain ones.
- Judgment: Assess urgency, draft personalized reply, or escalate.
Tools to Start: Use cron (macOS/Linux), GitHub Actions, or n8n/Zapier + LLM nodes.
Step 2: Skillify Everything (Capture & Reuse Judgment)
If you repeat a process more than 1–2 times, turn it into a reusable skill.
Action Steps
- Document your process in detail (Notion, Markdown, or a text file).
- Convert to a skill format:
- Prompt instructions + examples.
- Input/output schema.
- Error handling and self-check ("Did this meet the goal? If not, adjust and retry.").
- Test it manually, then integrate with an agent framework (Claude skills, OpenClaw, MCP server, etc.).
Examples from the Conversation
- Research process →
last30daysskill (searches Reddit/X/YouTube/etc., ranks by engagement). - Sales prep workflow.
- Content application: Feed YouTube transcripts/sales calls/notes → "Apply lessons to my business."
Pro Tip: Use "Compound Engineering" (planning system) to make agents codify lessons and avoid repeating mistakes. This is the same principle behind Claude Agent Skills and reusable SKILL.md files.
Step 3: Build or Install Agent-Friendly CLIs with Printing Press
Agents hate brittle web UIs (clicks, page loads). Give them fast CLIs that hit APIs directly.
Action Steps to Use Printing Press (Matt Van Horn's Tool)
- Visit printingpress.dev or install via:
go install github.com/mvanhorn/cli-printing-press/v4/cmd/cli-printing-press@latest - Run it on any API/site:
- Provide an API spec, website URL, or HAR file.
- It researches docs, existing CLIs, hidden endpoints → generates a Go CLI + skills (Claude Code, OpenClaw, MCP) with SQLite sync, offline search, and compound commands.
- Browse the library: github.com/mvanhorn/printing-press-library for pre-built ones (Amazon, Linear, etc.).
- Install a CLI and test commands in terminal.
- Integrate into your agent loop (agents prefer CLIs over browser automation).
Why it works: Token-efficient, reliable, agent-native. Less friction than teaching agents to click around. This pairs beautifully with the x402 machine-checkout patterns and sovereign agent tools.
Step 4: Apply Ideas to Your Business (The Real Power Move)
Don't just consume—apply.
Action Steps
- Consume content (video, article, transcript).
- Prompt your agent:
"Apply the key lessons from [content] directly to my [specific business situation]. Output actionable steps, adapted workflows, and potential loops." - Build the loop:
- Integrate with your tools (email, CRM, Notion, etc.).
- Add self-correction: Agent checks output against goal → retries if needed.
- Iterate: Run it, review results, refine the skill.
Examples
- Take a marketing video → Agent applies tactics to your next campaign.
- Sales call notes → Auto-generate personalized follow-ups.
Mindset Shift: Taste (deciding what to build/automate) > raw coding. Anyone can now ship ideas quickly. This is the same evolution discussed in Loops, Not Prompts.
Step 5: Set Up Supporting Infrastructure
- Agent Cookie: Keep a headless Mac agent logged into sites, synced via Tailscale.
- Monitoring: Track loop success rates; have it notify you only on exceptions.
- Security: Use secure CLIs/APIs; review agent actions initially.
- Scale: Start with 1 loop. Expand to a "fleet" once reliable.
Recommended Tools
Last 30 Days Skill
Multi-platform research tool. GitHub: mvanhorn/last30days-skill
Printing Press
CLI factory for agent-friendly tools. printingpress.dev + GitHub repos
Compound Engineering
Planning system for better agent judgment and learning.
Follow Matt Van Horn
@mvanhorn on X for ongoing agent tooling and loop ideas.
Final Thoughts & Next Level
Start small: Pick one repetitive task today, skillify it, wrap it in a loop, and give it a CLI if needed.
The tools improve automatically — your taste and judgment are the moat.
This approach aligns perfectly with the agentic commerce and sovereign infrastructure work happening across HeadlessDomains, x402 machine payments, MCP servers, and .agent domains.
If you want help building a specific loop, generating a skill file, or adapting this to one of your projects (e.g., agent operator roles or multi-tenant tools), just share details.
What loop or skill do you want to tackle first?
Related Resources
- Loops, Not Prompts — Boris Cherny on Claude Code — The foundational philosophy of moving from prompts to autonomous agent systems.
- 6-Month Path to Becoming an Agentic AI Engineer — The complete expanded 12-stage roadmap (foundations through production + portfolio) based on @suraj_sharma14's tweet.
- Stop Babysitting Your Agents — Verification loops, multi-agent parallelization, self-improving skills, and background routines so agents keep working even when you're away from the keyboard. Excellent practical follow-up to building individual loops.
- x402 – Internet-Native Payments for AI Agents — Machine-to-machine commerce that works beautifully with agent loops and CLIs.
- Claude Agent Skills — Reusable, structured expertise that complements skillifying your workflows.
- Headless Architecture — Sovereign infrastructure that pairs with agent loops and discovery.
- AI Agents Category — More experiments in orchestration, discovery, and agentic systems.
- Mobile App Development with Codex — Applying similar agentic loop thinking to building apps.