الدرس 3 · الوحدة 4: Agentic Systems: Manager and Worker Agents
Building worker agents with tools: research, writing and data entry
- What a worker agent is and what a tool is
- Build three workers: research, writing, data entry
- Give each worker only the tools it needs
Why this matters
A manager agent can decide who should handle a customer message, but it cannot update a spreadsheet, check a calendar, or read a web page by itself. Without workers that have the right tools, every decision stops at a recommendation and a person still does the work. This lesson shows how to build small worker agents, each with a clear job and only the tools that job needs, so the team gets real tasks done safely.
Key ideas
- A worker agent has four parts. It has a short job description, a language model that reads and writes text, a few tools it may call, and a fixed report format that the manager can always read.
- A tool is a labelled action. The model cannot see inside a tool. It chooses a tool by reading its name, a one-sentence description, and its inputs. Here is a tiny example:
def lookup_order(order_id):
orders = {"A-1042": "shipped", "A-1043": "packing"}
return orders.get(order_id, "not found")
print(lookup_order("A-1042")) # shipped
print(lookup_order("A-9999")) # not found
- Each worker gets only the tools it needs. A researcher reads, a writer drafts, and a clerk writes data. Giving every worker every tool makes the model pick the wrong one more often and raises the risk of damage.
- A tool that writes data needs a check first. A simple rule, such as "the email must contain an at sign," stops bad rows from reaching the sheet. Bad rows are sent back instead.
Try it before you watch
Lina's researcher can search the web and read Lina's customer list, but it can also delete rows from the customer list. Which of these two tools is the risk, and what would you change?
Show answerHide answer
The delete-rows ability is the risk, because a research job only needs to look things up. Remove the delete permission, or make the tool read-only, so the worst the researcher can do is give a weak answer. This shows why each worker should have only the tools its job needs.
Words to know
- Worker agent: a small AI helper with one job, given to it by a manager agent.
- Tool: an action the worker is allowed to take, such as looking up an order or adding a row to a sheet.
- Tool description: the short label (name, one sentence, inputs) that tells the model when to use a tool.
- Read-only tool: a tool that can look things up but cannot change any data.
- Guard: a check placed before a tool that writes, which stops bad input from being saved.
- Report format: a fixed shape for the answer a worker sends back, so the manager always reads it the same way.
What to watch for
- Notice how the tool label, not the tool's code, is what the model reads when it decides what to do.
- Watch which tools each of Lina's three workers has, and why the writer has no way to send email.
- Notice where the guard sits in the clerk's flow, and what happens to the row that fails the check.
تعلّمه مع معلمك على السبورة المباشرة
أهم نقاط الفيديو
The manager has no hands
- Lina sells handmade candles online
- Her manager agent decides who handles each message
- But it cannot touch a sheet or a calendar
- Workers with tools do the actual jobs
layout: wide
parts:
lina: {chip: Lina, sub: "Sells candles online"}
steps:
- at: "Meet Lina"
highlight: lina
- at: "about forty messages"
count: {to: 40, label: messages}
- at: "wholesale inquiries"
note: "Wholesale inquiries"
- at: "booking requests"
note: "Booking requests"
- at: "where their order is"
note: "Order status"
- at: "manager agent that reads"
note: "Manager agent"
- at: "who does the handling"
note: "Who does the handling?"
- at: "touch a spreadsheet or a calendar"
note: "No hands on the sheet"
- at: "worker agents come in"
note: "Worker agents"
- at: "the tools it needs"
note: "Workers with tools" What you will learn
- What a worker agent is and what a tool is
- Build three workers: research, writing, data entry
- Give each worker only the tools it needs
layout: side
objects:
head: {text: "Today's plan", pos: top}
g1: {text: "1. Worker and tool", pos: top_left}
g2: {text: "2. Three workers", pos: top_right}
eq: {tex: '1 + 1 + 1 = 3', pos: center}
g3: {text: "3. Only the tools", pos: bottom}
steps:
- at: "Here's the plan for this lesson"
show: head
- at: "what people mean by a tool"
show: g1
- at: "Second, you'll build three typical workers"
show: g2
- at: "a research worker that checks out new leads"
show: eq
- at: "give each worker only the tools"
show: g3
- at: "cheaper, safer and much easier to fix"
highlight: g3 What a worker agent is
- A short job description from the manager
- A language model that reads and decides
- A few tools it is allowed to call
- A fixed report format sent back
layout: wide
parts:
worker: {chip: Worker, sub: "Four parts"}
steps:
- at: "four parts"
highlight: worker
- at: "a short job description"
note: "1. Job description"
- at: "a language model"
note: "2. Language model"
- at: "reads text and writes text"
note: "Reads and writes text"
- at: "a few tools it is allowed to call"
note: "3. Tools"
- at: "a fixed report format"
note: "4. Report format"
- at: "Watch the loop"
note: "The loop"
- at: "takes the task from the manager"
note: "Task from the manager"
- at: "decides a tool would help"
note: "Choose a tool"
- at: "calls that tool"
note: "Calls a tool"
- at: "reads the result that comes back"
note: "Reads the result"
- at: "until it can write its report"
note: "Repeat until enough"
- at: "one trip around that loop or five"
note: "One trip or five" What a tool really is
lookup_order = {
"name": "lookup_order",
"description": "Find an order by its number",
"inputs": {"order_id": "text, like A-1042"},
}
orders = {"A-1042": "shipped", "A-1043": "packing"}
def run_tool(order_id):
return orders.get(order_id, "not found")
print(lookup_order["description"])
print(run_tool("A-1042")) Lina's three workers
- Researcher: checks new wholesale leads
- Writer: drafts replies with real prices
- Clerk: records bookings and orders
- Each has its own tools, no overlap
layout: wide
parts:
office: {box: BACK OFFICE, holds: [research, writer, clerk]}
research: {chip: Researcher, sub: "Checks leads"}
writer: {chip: Writer, sub: "Drafts replies"}
clerk: {chip: Clerk, sub: "Records data"}
steps:
- at: "walk through Lina's back office"
note: "Lina's back office"
- at: "sits the researcher"
highlight: research
- at: "looks up the shop"
note: "Looks up the shop"
- at: "sits the writer"
highlight: writer
- at: "using her real prices"
note: "Real prices"
- at: "sits the clerk"
highlight: clerk
- at: "writes workshop bookings"
note: "Bookings and orders"
- at: "its own small set of tools"
note: "Own tools, no overlap"
- at: "That separation is deliberate"
note: "By design" Worked example: the research worker
- Task: "Is Green Leaf Gifts worth a wholesale quote?"
- Tools: search the web, read a web page, look up the customer list
- All tools only read, never change anything
- Report: score, reasons, sources
layout: wide
parts:
worker: {box: RESEARCH WORKER, holds: [web, crm, report]}
web: {chip: Web search, sub: "Reads only"}
crm: {chip: Customer list, sub: "Reads only"}
report: {chip: Report, sub: "Score and sources"}
steps:
- at: "Here's a real task"
note: "A real task"
- at: "from Green Leaf Gifts"
note: "A wholesale inquiry"
- at: "two hundred candles"
count: {to: 200, label: candles}
- at: "one question"
note: "Is it worth a quote?"
- at: "searches the web"
highlight: web
- at: "checks Lina's customer list"
highlight: crm
- at: "every tool only reads"
note: "Read only"
- at: "can't email anyone"
note: "No email, no edits"
- at: "reports back a score"
highlight: report
- at: "two or three reasons"
note: "Two or three reasons"
- at: "the links it used"
note: "Links to check"
- at: "check its work in seconds"
note: "Check in seconds" Worked example: the writing worker
- Input: the inquiry plus the research report
- Tools: price list, product catalog, reply templates
- Output: a draft, never a sent email
- Sending belongs to a later, approved step
layout: wide
parts:
writer: {box: WRITING WORKER, holds: [prices, catalog, templates]}
prices: {chip: Price list, sub: "Lina's real prices"}
catalog: {chip: Catalog, sub: "Products"}
templates: {chip: Templates, sub: "Reply wording"}
steps:
- at: "gets the original inquiry"
note: "Inquiry and report"
- at: "Lina's price list"
highlight: prices
- at: "product catalog"
highlight: catalog
- at: "reply templates"
highlight: templates
- at: "invent a price"
note: "No invented prices"
- at: "no send email tool"
note: "No send step"
- at: "produces a draft"
note: "Draft"
- at: "a separate step"
note: "Approval comes later"
- at: "can't embarrass you"
note: "Safe to draft" Worked example: the data entry worker
import re
def check_booking(row):
problems = []
if not re.match(r".+@.+\..+", row["email"]):
problems.append("bad email")
if row["hour"] not in range(9, 18):
problems.append("outside opening hours")
return problems
rows = [
{"name": "Sara", "email": "[email protected]", "hour": 10},
{"name": "Omar", "email": "omar-mail.com", "hour": 20},
]
for row in rows:
issues = check_booking(row)
status = "write to sheet" if not issues else "send back"
print(row["name"], "->", status, issues) Building workers without code
- One AI Agent step per worker
- Attach tools: Google Sheets, HTTP request, Calendar
- Write each tool description like a label
- Describe the report you want back
layout: wide
parts:
n8n: {box: N8N, holds: [agent, sheets, calendar]}
agent: {chip: AI Agent, sub: "One per worker"}
sheets: {chip: Google Sheets, sub: "Rows and cells"}
calendar: {chip: Calendar, sub: "Bookings"}
steps:
- at: "don't need Python"
note: "No Python needed"
- at: "In n8n"
note: "n8n: no code"
- at: "one AI Agent step"
highlight: agent
- at: "You attach tools to it"
note: "Attach tools"
- at: "a Google Sheets tool"
highlight: sheets
- at: "an HTTP request tool"
note: "HTTP request"
- at: "or a calendar tool"
highlight: calendar
- at: "you write a short description"
note: "Short description"
- at: "describe the report you want back"
note: "Same report shape"
- at: "reply with a score"
note: "Score, reasons, links"
- at: "build one worker, test it"
note: "Build, test, copy"
- at: "take minutes, not hours"
note: "Minutes, not hours" Common mistake: one worker with every tool
- Giving every worker every tool "just in case"
- The model picks the wrong tool more often
- A writer that can send, or a researcher that can delete
- Fix: few tools, clear labels, read-only where possible
layout: wide
parts:
kit: {box: EVERY TOOL, holds: [mail, rows, cal]}
mail: {chip: Send email, sub: "Can send"}
rows: {chip: Delete rows, sub: "Can delete"}
cal: {chip: Calendar, sub: "Books slots"}
steps:
- at: "handing every worker every tool"
note: "Every tool, every worker"
- at: "it backfires in two ways"
note: "Two ways it fails"
- at: "picks the wrong one"
note: "Wrong tool picked"
- at: "a drawer of forty keys"
count: {to: 40, label: keys}
- at: "it's risky"
note: "Risky"
- at: "a writer that can also send"
highlight: mail
- at: "a researcher that can also delete"
highlight: rows
- at: "can do real damage"
note: "Real damage"
- at: "The fix is simple"
note: "The fix"
- at: "two to four tools"
note: "Two to four tools"
- at: "make tools read-only"
note: "Read-only where possible" Recap
- A worker is instructions, a model, a few tools and a report format
- A tool is a labelled action; the model reads the label
- Match tools to the job and guard any tool that writes
layout: wide
parts:
team: {box: WORKER TEAM, holds: [agent, tool, rule]}
agent: {chip: Worker, sub: "Job, model, tools"}
tool: {chip: Tool, sub: "A labelled action"}
rule: {chip: Match tools, sub: "Right tool, right job"}
steps:
- at: "Let's wrap up"
highlight: team
- at: "A worker agent is"
highlight: agent
- at: "a language model"
note: "The model reads and writes"
- at: "A tool is a labelled action"
highlight: tool
- at: "by reading that label"
note: "The label decides"
- at: "match the tools to the job"
highlight: rule
- at: "Researchers read"
note: "Read only"
- at: "writers draft"
note: "Drafts"
- at: "gets a check in front of every write"
note: "Check before writing"
- at: "finished drafts and clean records"
note: "Ready for Lina" Your exercise
- Pick one worker for a business idea
- List two or three tools and write each label
- Mark each tool as read-only or writes data
- Add one check before any tool that writes
layout: wide
parts:
pad: {box: YOUR NOTEPAD, holds: [tlabel, readonly, check]}
tlabel: {chip: Tool label, sub: "Name, purpose, inputs"}
readonly: {chip: Read only, sub: "Only looks things up"}
check: {chip: Check first, sub: "Before any write"}
steps:
- at: "Now it's your turn"
note: "Your turn"
- at: "maybe your own or a client's"
note: "Choose a business"
- at: "a researcher for leads"
note: "Researcher"
- at: "a writer for customer replies"
note: "Writer"
- at: "a clerk for bookings"
note: "Clerk"
- at: "Write down two or three tools"
note: "Two or three tools"
- at: "for each one write the label"
highlight: tlabel
- at: "Mark each tool as read-only"
highlight: readonly
- at: "that writes data"
note: "Writes data"
- at: "add one simple check"
highlight: check
- at: "Bring this list to the next lesson"
note: "Next lesson" النص المكتوب
The manager has no hands. Meet Lina. She sells handmade candles online, and every morning her inbox holds about forty messages. There are wholesale inquiries, booking requests for candle-making workshops, and customers asking where their order is. In the last lesson you built a manager agent that reads those messages and decides who should handle each one. But who does the handling? The manager can say look up this lead or add this booking, yet it has no way to touch a spreadsheet or a calendar. That's where worker agents come in. Today you'll give the manager a small team of workers, and each worker gets the tools it needs to really get the job done.
What you will learn. Here's the plan for this lesson. First, you'll learn exactly what a worker agent is and what people mean by a tool, in plain words. Second, you'll build three typical workers for a small online business: a research worker that checks out new leads, a writing worker that drafts replies, and a data entry worker that records bookings and orders. Third, and this is the part most people skip, you'll learn to give each worker only the tools its job needs. That one habit makes your agent team cheaper, safer and much easier to fix when something goes wrong.
What a worker agent is. A worker agent has four parts. First, a short job description, like "you qualify sales leads." Second, a language model. That's the AI that reads text and writes text, a bit like a very fast assistant who has read a huge library but knows nothing about your shop. Third, a few tools it is allowed to call, which we'll unpack next. Fourth, a fixed report format, so the manager always gets the answer in the same shape. Watch the loop. The worker takes the task from the manager, decides a tool would help, calls that tool, reads the result that comes back, and repeats until it can write its report. A worker might take one trip around that loop or five.
What a tool really is. A tool is simply an action the worker is allowed to take, like looking up an order, searching a website, or adding a row to a sheet. Think of a toolbox where every tool has a label. The model can't see inside the tool. It only reads the label: a name, a one-sentence description, and the inputs it needs. Here the label says "find an order by its number," and the input is an order number like A-1042. When the model calls the tool, your system runs the real action and hands the result back. Run it, and order A-1042 comes back as shipped. In no-code tools, you fill in this same label in a form.
Lina's three workers. Let's walk through Lina's back office. On the left sits the researcher. When a wholesale inquiry arrives, it looks up the shop that sent it and checks whether this is a serious buyer. In the middle sits the writer. It drafts replies and quotes in Lina's friendly tone, using her real prices. On the right sits the clerk, the data entry worker. It writes workshop bookings to the bookings sheet, which feeds Lina's calendar, and new orders to the sales sheet. Each desk has its own small set of tools, and none of them can do the others' jobs. That separation is deliberate, and you'll see why by the end of this lesson.
Worked example: the research worker. Here's a real task. A message arrives from Green Leaf Gifts asking for a wholesale price on two hundred candles. The manager sends the research worker one question: is this lead worth a quote? The worker searches the web, reads the shop's website, and checks Lina's customer list to see if they've bought before. Notice that every tool only reads. The researcher can't email anyone or change a record, so the worst it can do is give a weak answer. It reports back a score from one to five, two or three reasons, and the links it used, so Lina can check its work in seconds.
Worked example: the writing worker. Next, the writing worker gets the original inquiry plus the research report. Its tools are Lina's price list, her product catalog and a few reply templates, so every number in the quote comes from a real source instead of the model's imagination. That matters, because language models will happily invent a price that sounds reasonable. Look at what's missing here: there's no send email tool. The writer produces a draft and stops. Sending is a separate step that you'll protect with approvals later in this module. A writer that can't send can't embarrass you in front of a customer.
Worked example: the data entry worker. The clerk is the only worker that changes real data, so it gets a guard in front of its tool. Before adding a workshop booking to the bookings sheet, it checks two simple rules: the email looks like an email, and the time falls within opening hours, nine to six. You don't need to write this code yourself. The pattern line only checks that the email has an at sign and a dot, and range nine to eighteen means a start time from nine in the morning to five in the afternoon. Read the two rows. Sara booked at ten with a proper email, so her row goes in. Omar typed his email without the at sign and asked for eight in the evening. Run it, and Sara is written while Omar is sent back with both problems listed. In a no-code tool, this guard is just a filter step placed before the write.
Building workers without code. You don't need Python to build any of this. In n8n, a popular no-code automation tool, each worker is one AI Agent step. You attach tools to it, for example a Google Sheets tool, an HTTP request tool, which fetches a web page or calls another service, or a calendar tool. Then you write a short description for each one, exactly like the labels you saw earlier. Then, in the worker's instructions, describe the report you want back, such as "reply with a score, reasons and links." Here's the shortcut: build one worker, test it, then copy it and swap the tools and instructions. Your second and third workers take minutes, not hours.
Common mistake: one worker with every tool. The most common mistake is handing every worker every tool, just in case. It feels flexible, but it backfires in two ways. First, the more tools a model sees, the more often it picks the wrong one, just like a new employee facing a drawer of forty keys. Second, it's risky. A writer that can also send emails, or a researcher that can also delete rows, can do real damage on a bad day. The fix is simple. Give each worker two to four tools, write clear labels, and make tools read-only whenever the job only needs to look things up.
Recap. Let's wrap up. A worker agent is a short job description, a language model, a small set of tools and a fixed report format. A tool is a labelled action, and the model chooses it by reading that label, so good descriptions matter as much as the tool itself. And finally, match the tools to the job. Researchers read, writers draft, and the one worker that changes data gets a check in front of every write. With that, Lina's morning inbox stops being a pile of chores and becomes a list of finished drafts and clean records waiting for her.
Your exercise. Now it's your turn. Pick one worker for a business you know, maybe your own or a client's. It could be a researcher for leads, a writer for customer replies, or a clerk for bookings. Write down two or three tools it needs, and for each one write the label: a name, one sentence saying what it does, and its inputs. Mark each tool as read-only or as one that writes data. Then, for every tool that writes, add one simple check that must pass first. Bring this list to the next lesson, where we'll pass work between these workers without losing details.
استكشف الرسوم المتحركة
الرسوم المتحركة نفسها التي في الفيديو، دقيقة وتفاعلية: شغّلها أو أوقفها، أو اسحب المؤشر، أو انتقل إلى أي خطوة بالسرعة التي تناسبك.
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
أجب عن كل الأسئلة ثم تحقّق. تنجح بنسبة 70%، ويمكنك إعادة المحاولة كما تشاء.
ملخص الدرس
- القراءة
- مشاهدة الفيديو
- اجتياز الاختبار (70%)
- A worker is instructions, a model, a few tools and a report format
- A tool is a labelled action; the model reads the label
- Match tools to the job and guard any tool that writes