Start with the job, not the agent
Many first agent projects go wrong because they begin with the technology. Begin with the job instead:
- What is the task? Write it down in one or two sentences, as you would for a new colleague.
- What does success look like? A drafted reply, a filled form, a correct classification: something you can check.
- What is out of scope? The actions the agent must never take, and the cases it must hand to a person.
- Who is accountable? A named person who owns the agent's results.
Then ask whether you need an agent at all. Sometimes the steps are always the same. Then a fixed workflow is usually cheaper, faster and easier to test: ordinary code that calls a language model at set points. An agent, where the model decides the next step, earns its place when the path really varies from case to case.
Also estimate the running cost early. Each step is usually a separate model call, paid for by the amount of text in and out, so a task of twenty steps costs far more than one of two.
A good first agent has a narrow job, a clear finish line and a person reviewing its output.
Designing the tools
An agent can only act through the tools you give it: functions such as "look up an order", "search the policy documents" or "draft an email". The model asks for a tool and supplies the inputs; your code runs it and returns the result. Much of the real engineering work is in these tools.
Good tools are:
- Narrow. "Get the status of order N" is safer, and easier for a model to use correctly, than "run any database query".
- Clearly described. The model chooses tools from their names and descriptions. Write them as you would for a new colleague: what the tool does, when to use it, what each input means.
- Read-only where possible. Keep tools that only look at data apart from tools that change it, and have few of the second kind.
- Checked in code. Validate every input before acting, and enforce permissions in the tool itself, not in the prompt.
- Run with the agent's own limited access. Give the agent its own account or key with only the rights its tools need. Never give it a shared administrator login.
- Helpful when they fail. A clear error such as "order not found; check the number" lets the agent recover instead of guessing.
Open protocols such as the Model Context Protocol (MCP), now run as an open project under the Linux Foundation, let a tool be described once and used by any compatible agent. Treat a tool server written by someone else like any third-party software: check who maintains it and what access it gets before you connect it.
The loop, the instructions and the limits
At its core, an agent is a loop. The model reads the goal and what has happened so far, then chooses an action. Your code carries it out, and the result is added to what the model sees next. The loop repeats until the model says it is done.
Around that loop you set:
- Instructions (often called the system prompt): the role, the goal, the rules to follow, and when to stop and ask a person.
- Stop conditions: a maximum number of steps, a time limit and a cost limit, so a confused agent cannot run forever.
- Structured output: ask for the final result in a fixed shape, such as named fields, so your code can check it before using it.
- Approval points: before any action that is hard to undo, the loop pauses and a person approves.
Keep the rules that really matter outside the model. The instructions can say "never refund more than 5,000 shillings". Only a check in the refund tool's code makes sure it never happens.
Choosing the model
The model is a part you can change, so treat it as a choice rather than a given.
- Match the model to the step. Routine steps — classifying a request, extracting a field, checking a format — often run well on a smaller, cheaper, faster model. Save the largest model for the steps that need judgement. A single agent can use more than one.
- Pin the exact version. If your code names a model family rather than a specific version, the behaviour underneath you can change without warning. Name the version, and move to a new one deliberately.
- Re-run your tests when you switch. A model that is better in general can be worse at your task, particularly at following your output format or using your tools.
- Plan for the model being unavailable. Decide in advance whether the agent waits, falls back to another model, or stops and hands the task to a person.
Leave fine-tuning until last. Clearer instructions, better tools and better retrieval fix far more problems than training does, and they are much cheaper to undo.
Memory and context
A language model works only with the text it is given on each step, called its context. Everything the agent "remembers" has to be put there by your code.
- Working memory is the history of the current task: the goal, the steps taken and their results. Long tasks can outgrow the space available, so older steps are often summarised.
- Knowledge comes from documents and systems. Rather than pasting everything in, agents usually retrieve the few relevant passages for each step. This technique is called retrieval-augmented generation (RAG).
- Long-term memory, such as notes kept between sessions, is useful but needs care. Decide what may be stored, for how long, and who can see it. If it holds personal data, your data protection law applies to it; in Kenya, for example, that is the Data Protection Act, 2019.
Two rules help. First, give the model only what the step needs: too much context costs more and can distract it. Second, treat anything retrieved from emails, web pages or uploaded files as untrusted. Hidden text in them can try to redirect the agent (prompt injection), and a model cannot be relied on to ignore it. So limit what the agent can do, and keep approvals for consequential actions.
Testing before anyone relies on it
An agent that worked once in a demonstration has been tested once. Before real use:
- Build a test set of real tasks: easy ones, hard ones, unusual ones, and ones the agent should refuse or hand over.
- Run each test more than once. The same input can give different results on different runs.
- Check the path, not only the answer. Did it use the right tools, in a sensible order, without unnecessary steps?
- Try to break it. Feed it misleading documents, hidden instructions and missing data, and confirm it fails safely.
- Log everything: every input, tool call, result and approval, so any outcome can be explained later. Logs often contain personal data, so protect them and decide how long to keep them.
- Start small. Run it alongside people first, with a person approving every action. Widen its freedom only as the evidence builds.
- Re-test after every change, including a new model version, new tools or edited instructions.
Keep a way to pause or switch the agent off at once, and a named person who watches how it performs.
Putting it into service
An agent is instructions, tools and a model working together, and all three change. What you release is the combination.
- Keep the parts you will want to tune out of the code: the instructions, the step and cost limits, the model version. Then a limit can be changed without a software release, which matters at two in the morning.
- Version the whole combination. Record which instructions, tools and model version produced any given result, so a complaint about last Tuesday can be answered.
- Keep secrets out of the prompt. API keys and passwords belong in your tools' configuration, where the model never sees them and cannot be talked into repeating them.
- Have one switch that stops it, known to more than one person, and test that it works before you need it.
- Decide who is told when it misbehaves, and what the on-call person is allowed to do: pause it, lower its limits, or roll back to the previous version.
Release in stages, and keep the previous version ready to return to for as long as the new one is unproven.
Ten questions
Answer all ten questions, then check your answers. You need 9 out of 10 to pass and receive a certificate. If you score less, you will see which answers were right and wrong, and then go through the course again before you retake the check. Your answers, progress and times are kept only in this browser.
Your answers
Your certificate of completion
Enter your name as you want it to appear, then save the certificate as a PDF. In the print window, choose Save as PDF. A certificate is issued once per completion of the course.
Rate this course
How would you rate this course? Your rating is anonymous — just a number, with no name and no account.
Bring this to your team
Your colleagues can take this course too — it is free, needs no sign-up, and nothing they enter leaves their browser. If your institution wants the same ground covered as structured training for a team, with an instructor and your own cases, we run courses in a classroom or online for groups of ten or more.
Talk to us about training your team → See the paid courses →
Saolix does not record who takes this course, so it cannot verify these certificates. The certificate confirms completion of a free self-paced course and is not an accredited qualification.
Standards and frameworks covered
The published frameworks this course teaches toward. Saolix is not affiliated with, endorsed by or accredited by any of these bodies; naming a standard is a citation, not a claim about its author.
Sources
The official documents this course relies on. Laws and guidance change, so check the current version.
- OWASP Top 10 for Agentic Applications for 2026 · OWASP Gen AI Security Project
- LLM01: Prompt Injection · OWASP Gen AI Security Project
- Guidelines for secure AI system development · UK National Cyber Security Centre, with international partners
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020) · arXiv
- Linux Foundation announces the formation of the Agentic AI Foundation (includes the Model Context Protocol) · The Linux Foundation
- Data Protection Act, 2019 (No. 24 of 2019) · Kenya Law



