Skip to content
The AI Agent Factory

16.2 Choosing the right piece

Approved by
Panaversity ·
9 min read

In everyday life. A kitchen has a stove that came with the house and a knife you sharpened yourself. It has a recipe card and a delivery service for what you do not keep at home. It has an assistant cook for a side dish and a lock on the cabinet that holds the cleaning chemicals. Each does one kind of job. You would not write "do not open the chemicals cabinet" on a recipe card and call it locked.

What you will learn. How to decide what each new job for an agent needs. It may need what is already there, your own code, written instructions, a link to another system, a helper, or a rule that cannot be ignored.

Why it matters. Each piece does one kind of job and costs something different. Put a rule in the wrong piece, and it works only until the day the agent ignores it.

Which pieces can I choose from?

Six. No single standard defines this list, because it covers several standards and every product's own features.

PieceWhat it isUse it forWho can change it
Built-in toolA tool the agent already has: read a file, search, run a commandAnything the agent can already do wellThe product's maker
Custom toolCode you write and test, which the agent runsCalculations, checks, anything that must be exact every timeYou, through a reviewed change
SkillInstructions and files that load when the work matches (16.1)A procedure with judgment in it: which steps, in what order, what to reportWhoever edits the skill
ConnectorA server that gives the agent tools and data from another system, through the Model Context Protocol (MCP), an open standardSystems the agent cannot reach on its own: an accounting system, a database, a shared driveThe connector's author
SubagentA helper agent with its own context that reports backA side task whose reading would crowd the main sessionYou
Hook or settingA rule the product enforces before or after an actionThings that must never happen, whatever the instructions sayThe person who controls the settings

What is the difference between a skill and a hook?

A skill guides. A hook or setting enforces. A skill is words. An agent usually follows them, and sometimes does not. A hook is code the product runs at a fixed moment, such as before every file edit, and it can block the action. A permission setting does the same without code. So "never edit the AP export" belongs in a setting that denies edits to data/, not only in a skill's "Never" list. Chapter 23 teaches hooks in depth.

Where do calculations go?

Into tested code, never into a skill's words. This is the rule for every number from Chapter 13: an AI can reason about a problem, but deterministic code, which gives the same answer every time, enforces rules and arithmetic. A skill that says "add up the amounts" or "calculate the due date" asks the model to do the arithmetic itself. A skill that says "run the triage script and copy its totals" does not. So most good skills have a script beside them. The skill's job is to say when to run it and how to report what it printed. The number in that code is still a copy of a rule its owner decides (16.6).

What does each piece cost?

A built-in tool costs nothing extra. A skill costs its short description on every turn. A connector costs its tool names or descriptions on every turn, depending on the product, and a running process. A subagent costs a second context. Choose the cheapest piece that does the job reliably.

How do I choose?

Ask these questions in order, and stop at the first yes. If a job has parts, ask for each part. The Monday report's totals are tested code, and its steps are a skill.

A decision ladder of six questions, asked in order. Must it never happen? Then a hook or setting. Is the data in another system? Then a connector. Must a number be calculated exactly? Then your own tested code. Is it side work that would crowd the session? Then a subagent. Can the agent already do it well? Then a built-in tool. Otherwise, it is a procedure with judgment: a skill.

Figure 16.4. Choosing the piece. Reading a long contract is side work, so it goes to a subagent, even though the agent could read it in the main session.

At work. Ana and the builder place six AP jobs, which means they choose a piece for each:

JobPieceWhy
Read the weekly invoice exportBuilt-in toolThe agent can already read a file
Compute due datesCustom tool: src/due-date.tsA number people act on, so tested code
Sort invoices into piles and reportSkill, which runs a scriptA procedure with steps and a report shape, with the sorting in code
Look up a vendor in the accounting systemConnectorAnother system. Chapter 17 builds it
Never edit data/SettingIt must work even if instructions are ignored
Pause before scheduling a paymentHookAn approval gate. Chapter 23 builds it

The operating rule: use the cheapest piece that is reliable enough. Put judgment in a skill, numbers in tested code, other systems behind a connector, and every "never" that must hold in a hook or setting.

Practice it. Practice: choosing the right piece, on your own, ten minutes.

Building Skills and Plugins with Coding Agents

Question 1 / 8

0 answered

An agent must compute each invoice's due date the same way every time. Which piece?

Owner
Panaversity