Building Your First AI Agent: A Practical Guide
AI agents are not magic — they are programs. Here is how to build one that actually works, with tools, memory, and guardrails.
Prompt engineering is not arcane knowledge. These patterns make your AI interactions more reliable without needing an ML background.
The same model with a bad prompt and a good prompt can produce outputs so different they appear to come from entirely different systems. Prompt engineering is not a hack or a workaround — it is the primary interface for instructing a language model.
Most business users write prompts the way they would write an email: conversationally, assuming context, leaving things implied. Language models reward specificity. Here are the patterns that close that gap.
The most reliable general-purpose structure is three parts: who the model is, what it should do, and what the output should look like.
You are a senior business analyst specialising in SaaS pricing strategy.
Analyse the pricing page copy below and identify three weaknesses that might cause
a visitor to abandon without converting.
Return your analysis as a numbered list. For each weakness, write:
- The issue (one sentence)
- Why it matters (one sentence)
- A suggested fix (one sentence)
Pricing page copy:
[INSERT TEXT HERE]
The role primes the model's reasoning style. The task is unambiguous. The format makes the output immediately usable without editing.
When you need the model to produce a very specific output style — tone of voice, a particular data format, a house style — showing is more reliable than telling.
Convert the following customer support transcript excerpt into a structured summary.
Example input:
"Hi, I'm having trouble logging in. I've tried resetting my password twice."
Example output:
Issue: Login failure after repeated password reset attempts
Priority: Medium
Suggested action: Check account lock status; escalate if locked out >24h
Now process this transcript:
[INSERT TRANSCRIPT]
The model learns the output schema from the example, not from a description of it. Two or three examples are usually sufficient; more than five often has diminishing returns.
For tasks that involve multi-step reasoning — financial analysis, risk assessment, root cause analysis — ask the model to show its work before giving the answer.
Before giving your recommendation, think through the following step by step:
1. What are the key factors in this decision?
2. What are the trade-offs of each option?
3. What assumptions are you making?
Then give your recommendation in one paragraph.
This reduces errors in the final answer by forcing the model to surface its reasoning — where you can spot incorrect assumptions before they propagate into the conclusion.
Open-ended prompts produce open-ended outputs. When you need something specific, constrain it explicitly.
Each constraint eliminates a category of unwanted output. Stack constraints deliberately.
Business prompts often have implicit topics that are off-limits — competitors, legal disputes, pricing disputes. If you do not tell the model to avoid these, it will not.
If asked about competitors or pricing disputes, respond only with:
"I'm not able to discuss that topic. For specific queries, please contact
your account manager."
Do not attempt to answer those questions under any circumstances.
The "under any circumstances" phrasing is important — it raises the compliance threshold and reduces the chance the model talks itself into an exception.
A prompt is not done when it works once. It is done when it works consistently across a range of inputs, including edge cases.
Build a small test set: 10 representative inputs and their expected outputs. When you change the prompt, run all 10. If a change improves 7 but breaks 3, you need to understand why before deploying.
Version your prompts the same way you version code. The difference between prompt v1 and prompt v12 is often the difference between a demo and a production system.