Duck
Tutorials5 min read

AI Agent Design Patterns: A Practical Guide for Solo Operators

Samet Turan— Editor··5 min read

Learn how to structure AI agents with proven design patterns, see real prompts and tool examples, and decide whether to build or use a ready-made blueprint.

AI Agent Design Patterns: A Practical Guide for Solo Operators

Most solo operators try to bolt AI onto existing tasks and end up with fragile scripts that break when the prompt changes or the API rate limit hits. After reading this, you’ll know how to structure an agent so it handles retries, manages state, and stays within cost limits. You’ll also see a concrete example you can copy today.

What most guides get wrong about AI agent design patterns

Many tutorials treat an agent as a single prompt wrapped in a loop. They ignore state, error handling, and cost tracking. The result is a demo that works in a notebook but collapses under real load.

I’ve seen agents that keep re‑sending the same request because they never store a simple “last‑run” flag. That wastes tokens and can trigger rate limits fast.

One concrete gripe: the way Make hides the error log behind three clicks made me miss a failed webhook for two days. I only noticed when a client complained about missing leads.

On the love side: I love how the built‑in retry policy in Pipedream automatically re‑queues a failed step after 30 seconds, which saved me from manual retries during a weekend launch.

Price note: $29/mo is fair for the automation runtime on Pipedream, but $199/mo for the team plan feels ridiculous for what you get—most solo users never need the extra seats.

That’s the gap most tutorials leave.

Core patterns you actually need

Think of an agent as a small state machine with three layers: input handling, reasoning, and output dispatch. Each layer can be swapped independently.

First, the input layer normalizes whatever arrives—email, webhook, or chat message—into a clean JSON payload. A simple function that strips whitespace and validates required fields does the job.

Second, the reasoning layer calls the LLM with a prompt that includes the current state. Keep the prompt short; long prompts increase latency and cost. I’ve found that a system message plus a single user message works for most classification tasks.

Third, the output layer decides what to do with the LLM’s answer: send an email, update a CRM, or trigger another workflow. Wrap this in a try/catch and push failures to a dead‑letter queue for later inspection.

These three layers map neatly to tools you probably already use: a webhook endpoint (input), a serverless function that calls GPT‑4o (reasoning), and a step that posts to Zapier automations or Make (output).

How to debug when this breaks

When an agent stops working, start at the edges. Check the input payload first—did the webhook send the expected fields? A quick log of the raw request will show if something changed upstream.

If the input looks good, move to the reasoning layer. Look at the LLM response: is it empty, malformed, or hitting a safety filter? Most providers return an error code you can catch.

Finally, verify the output step. Did the HTTP call to your CRM return a 2xx? If not, the failure is likely a permission or rate‑limit issue.

I keep a one‑line health check that pings each layer and writes a timestamp to a Google Sheet. If any timestamp is older than five minutes, I know exactly where to look.

Reader question: Why does my agent loop forever?

Loops usually happen when the agent never updates its state after taking an action. Imagine a lead‑qualification agent that reads a form, decides the lead is hot, and then sends a Slack alert—but never marks the form as processed. The next trigger sees the same form and repeats the alert.

The fix is simple: after each successful output, write a flag back to the source. In a Google Sheet, that means updating a “processed” column. In a CRM, it means setting a custom field.

I once spent an afternoon chasing duplicate alerts because I forgot to update a single cell in Airtable. Adding that one line cut the noise by 95%.

Concrete named example: Building a lead‑qualification agent with Make and GPT‑4o

Here’s a real‑world flow I run for a freelance consulting business. It takes a new Typeform submission, asks GPT‑4o to score the lead, and pushes hot leads to HubSpot’s CRM.

Step 1 – Input: Typeform webhook sends JSON to a Make scenario. The scenario’s first module is a JSON parser that extracts name, email, budget, and timeline.

Step 2 – Reasoning: A Make HTTP module calls the OpenAI API with this prompt (trimmed for clarity):

System: You are a lead‑qualification assistant. Respond with a JSON object containing two fields: "score" (0‑100) and "reason" (short string).
User: Name: {{name}}. Email: {{email}}. Budget: {{budget}}. Timeline: {{timeline}}.

The response is parsed; if score >= 70 the lead is hot.

Step 3 – Output: A Make router sends hot leads to a HubSpot “Create contact” module; cold leads go to a Google Sheet for nurturing.

Cost breakdown: Typeform free tier (up to 100 responses/mo), Make core plan $9/mo (covers the scenario runs), OpenAI GPT‑4o ~$0.006 per 1k tokens—roughly $0.02 per lead at average length. Total per lead well under $0.05.

I’ve run this at 200 leads/month for under $12, which is far cheaper than paying a sales‑development rep.

One mild aside: the OpenAI API sometimes returns a generic “rate limit exceeded” message with no retry‑after header—annoying, but handle it with a simple exponential backoff in Make’s error handler.

Pricing opinion and when to grab the blueprint

If you enjoy tinkering, the steps above give you a working agent in under two hours. You’ll learn how each piece fits together, which is valuable when you need to tweak the logic later.

We cover this in more depth elsewhere — deeper coverage of AI agent platforms.

If you’d rather skip the build and deploy a working version in an afternoon, we’ve packaged this workflow as a blueprint at deepusecase.com/vault/ai-agent-builder-kit.

— The Colophon

One AI tool. Tested. Reviewed.
In your inbox every Sunday.

~3 minute read. Real outcomes from operators, not marketers.

Free. One email per Sunday. Unsubscribe in one click.