Build an Agent for Your Own Workflow
You have built a research helper with a calculator. But the calculator was just an easy example to verify. The real point of this course is that you can point this same loop at something you care about: a study task, a small research chore, a repetitive job you do every week.
In this lesson you will learn how to turn one of your own tasks into an agent, and how to choose tools that make it genuinely useful.
What You'll Learn
- How to spot a task that suits an agent
- A simple recipe for turning a task into tools
- Three example agents you could build today
- When an agent is overkill
What makes a good first agent
Not every task needs an agent. The sweet spot is a task where the model is mostly capable on its own but needs a few exact facts or actions it cannot reliably do from memory. Use this quick test:
Decision
Does the task need a fact or action the model cannot reliably do alone?
- If No, a single chat answer is enough
Use a plain chat call, not an agent
Adding a loop and tools would be overkill
- If Yes, it needs one lookup or calculation
Build a small agent with one or two tools
Exactly what this course teaches
- If Yes, and it spans many independent jobs at once
Look at a framework or multi-agent setup later
See the next lesson for where to go
If you land in the middle branch, you already know how to build it.
The recipe: task to tools
Turning your task into an agent is three questions:
- What is the goal in one sentence? ("Summarize my study notes and quiz me on them.")
- What facts or actions does the model need that it cannot do alone? Those become your tools. ("Read a notes file." "Save a quiz to disk.")
- What is the system prompt? One or two sentences telling the agent its job. ("You are a study coach. Read the notes, then ask one question at a time.")
Each tool is a normal Python function wrapped in a definition, exactly like the calculator. The loop from Lesson 4 does not change at all. You are only swapping the tools and the system prompt.
Example: a personal study helper
Say you want an agent that reads your notes and quizzes you. The new tool reads a file; everything else is the loop you already have.
def read_notes(filename):
"""Read a local notes file and return its text."""
try:
with open(filename, "r", encoding="utf-8") as f:
return f.read()
except FileNotFoundError:
return f"Error: no file named '{filename}'."
TOOLS["read_notes"] = read_notes
tool_defs.append({
"name": "read_notes",
"description": "Read a local notes file by name and return its text. Use to load study material before quizzing.",
"input_schema": {
"type": "object",
"properties": {"filename": {"type": "string"}},
"required": ["filename"],
},
})
With a system prompt like "You are a study coach; read the notes, then quiz the user one question at a time," your agent now reads real material and builds questions from it. Same loop, new purpose.
Three agents you could build today
- Research helper. A tool that fetches a web page or searches, so the agent answers with current facts instead of guessing. (You add the fetching function; the loop is unchanged.)
- Task automator. A tool that reads a to-do file and another that appends to it, so the agent can triage and update your list on command.
- Personal data assistant. A tool that reads a small CSV and a calculator tool, so you can ask plain-English questions about your own numbers.
Each one is the Lesson 4 agent with one or two tools swapped in. That is the payoff of learning the loop directly: you are not locked into anyone's prebuilt agent. You build the one your task needs.
Keep tools small and clear
A few habits make your agents work better:
- One job per tool. A tool that does one clear thing is easier for the model to use correctly than a Swiss-army tool with ten options.
- Write the description like an instruction. "Use this when the user asks about the current date" beats "date utility." The description is how the model decides when to reach for it.
- Return strings, including errors. The model reads tool output as text. A clear error string keeps the loop alive (Lesson 5).
- Guard powerful tools. If a tool deletes, sends, or spends, validate the input and consider asking for confirmation before acting.
When an agent is the wrong choice
Be honest about when you do not need one. If a single well-written prompt gives you the answer, just use a chat call; the loop adds cost and latency for nothing. Agents earn their keep when the task genuinely needs to act and observe, not when you simply want a good answer. Reaching for an agent for a one-shot question is the most common beginner over-engineering.
Key Takeaways
- The best first agent is a task where the model is capable but needs a few exact facts or actions.
- Turn a task into an agent with three questions: the goal, the tools it needs, and the system prompt.
- The loop never changes. You only swap the tools and the system prompt to fit your workflow.
- Keep tools small, describe them like instructions, return strings, and guard anything powerful.
- If a single chat answer works, skip the agent. Use the loop only when the task needs to act and observe.

