Connect with me via the floating button
Learn the key concepts of this lesson
An AI agent is just a workflow with a clear job, clear inputs, and a clear definition of done. The fastest way to build one is to treat it like a small employee with a tight job description.
Pick a task that can be explained in five steps or fewer. Examples:
The smaller the job, the easier it is to test and refine. If you need a practice target, use a guide like Valentine's Day Melbourne 2026 as your input source.
Inputs are what the agent receives. Outputs are what you can ship. Write them down before you build anything.
If the output format is vague, the agent will be inconsistent. A fixed schema forces clarity.
Example output schema:
{
"title": "string",
"summary": "string",
"highlights": ["string"],
"warnings": ["string"],
"source_url": "string"
}
Write a short runbook for the agent:
This runbook becomes your prompt and your QA checklist. It also makes handoffs easy when you bring in a teammate or reviewer.
Guardrails save you time later. Add them now:
Also add a clear rejection rule. For example: "If the input does not mention a location, return a one-sentence request for clarification."
Goal: turn a long guide into a 150-word summary + 5 highlights.
Input: the full guide text and the URL. Output: JSON with summary, highlights, and a short caution list.
Quality checks:
Full access
Unlock all 6 lessons, templates, and resources for AI Product Building. $49 AUD.
This is small enough to build in a day and test against three guides.
The code below shows a minimal Node/TypeScript wrapper. It enforces a schema and rejects missing fields. Adapt to your stack.
import { z } from "zod";
const OutputSchema = z.object({
title: z.string(),
summary: z.string().min(80).max(200),
highlights: z.array(z.string().min(8)).min(3).max(6),
warnings: z.array(z.string()).max(3),
source_url: z.string().url(),
});
type Output = z.infer<typeof OutputSchema>;
async function runAgent(inputText: string, sourceUrl: string): Promise<Output> {
const prompt = `Summarize and extract highlights. Output JSON only.`;
const raw = await callModel({ prompt, inputText, sourceUrl });
const parsed = JSON.parse(raw);
return OutputSchema.parse(parsed);
}
Even if your stack differs, the principle is the same: strict schemas reduce unpredictable output.
Run the agent on five inputs and score each output on:
If it fails any one consistently, tighten the runbook and guardrails first before adding features.
Lesson 3 shows how to take that prototype and make it production-ready.