Part 2 of 7 in the Enterprise AI Agent Engineering guide
Why this matters now
Consider a procurement agent in a GCC. A manager asks it to raise a purchase order. The agent calls a create-order tool, the vendor system takes longer than expected, and the tool returns a generic "request failed" message. The agent retries. The first call had in fact succeeded, so two orders now exist for the same goods. Finance finds the duplicate at month-end. (This is an illustrative scenario, not a customer case.)
The model reasoned sensibly from what it was told. The tool gave it a vague error, and nothing in the surrounding code prevented the same action from running twice.
Enterprises face this more sharply than most because agents connect to systems that were never designed for them: ERP, ticketing, case management, core banking. These systems have slow responses, partial failures, strict permissions and audit requirements. Every tool you give an agent is a path into one of them.
Teams often respond by switching to a stronger model. That rarely addresses the cause. A stronger model still receives the same vague error and still runs inside the same unprotected code. The reliable fix is in the tools and the harness, which is why this is the second topic in our series, right after context engineering and memory architecture.
The core concept
A tool is a function the agent can call, defined by a contract: a name, a description the model reads, an input schema, an output format and a set of defined errors. The description matters as much as the code, because it is how the model decides whether and how to use the tool. Anthropic's 2024 guide "Building effective agents" makes a similar point, advising teams to treat tool definitions with the care they would give an interface built for people.
The harness is the code around the model. It assembles context, exposes the available tools, validates each requested call, enforces permission scopes, applies timeouts and retry limits, records a trace and returns results to the model. The model proposes. The harness disposes.
The two depend on each other. A well-designed tool inside a weak harness still fails, because nothing stops a repeated call or a hung request. A strong harness with vague tools still fails, because the model picks the wrong tool or passes the wrong arguments, and the harness can only catch part of that.
One way to think about it: the tool defines what is possible and understandable, and the harness defines what is allowed and survivable.
A single tool call, end to end:
Model proposes a call
|
v
[Harness] validate arguments against schema
|
v
[Harness] check permission scope and approval rules
|
v
[Harness] execute with timeout and idempotency key
|
v
[Harness] normalise result or error into a clear message
|
v
[Harness] write trace entry, then return result to context
How it works in real systems
Scenario 1: Procurement. The duplicate-order problem is fixed in two places. In the tool, the create-order function accepts an idempotency key, so a second call with the same key returns the first result instead of creating a new order. In the harness, retries for write tools are limited to cases where the tool has confirmed it is safe. The error message also changes from "request failed" to "order status unknown; check order status before retrying", which tells the model what to do next.
What a tool contract looks like. A contract is more than a function signature. It tells the model when to use the tool, what to send and what to expect back, including the errors. An illustrative contract for the procurement tool:
{
"name": "create_purchase_order",
"description": "Creates one purchase order for an approved supplier. Use only after the request is approved. Do not use to check an existing order; use get_order_status for that.",
"input": {
"supplier_id": "string, required",
"items": "list of {sku, quantity}, required",
"idempotency_key": "string, required; reuse the same key when retrying"
},
"output": {"order_id": "string", "status": "created | already_created"},
"errors": {
"SUPPLIER_NOT_APPROVED": "Supplier is not on the approved list. Do not retry.",
"ORDER_STATUS_UNKNOWN": "Order status unknown; check order status before retrying."
}
}
Three details do most of the work: the description says when not to use the tool, the idempotency key makes a retry safe, and each error tells the model what to do next. This is an example, not a customer system.
Scenario 2: KYC checks. An agent calls a screening tool that returns a long raw report. Loading all of it into context wastes tokens and buries the one field that matters. A better tool returns a short structured result, such as match status, confidence band and a reference to the full report. The harness stores the full report outside the context so a reviewer can open it later. This connects directly to the context budget discussed in the previous post.
Impact. Clear tool contracts reduce wrong-tool and wrong-argument errors, which improves reliability. Narrow results and sensible retries lower cost and latency. Separating read tools from write tools limits the damage when something goes wrong, which lowers risk. Traces of every call give reviewers evidence, which supports adoption.
Design decisions and trade-offs
| Decision | Option A | Option B | Choose A when | Choose B when |
|---|---|---|---|---|
| Granularity | Few broad tools | Many narrow tools | The domain is small and low risk | Actions differ in risk or permissions |
| Results | Return raw output | Return a summarised, structured result | Output is short and the model needs all of it | Output is long or mostly irrelevant |
| Retries | Model decides | Harness decides | The action is read-only | The action changes state |
| Side effects | One tool reads and writes | Separate read and write tools | Never for state-changing actions | Whenever you need different approvals |
| Tool exposure | Load all tools every step | Select tools per step or task | The tool set is small | Many tools overlap or confuse selection |
When not to build a tool: if a person already approves the result and the task is rare, a tool adds a path for error without much benefit. Likewise, avoid wrapping a whole API. Expose the few actions the agent needs, not everything the system offers.
What breaks in production
| Failure mode | Symptom | Root cause | Mitigation |
|---|---|---|---|
| Wrong tool chosen | Agent uses a search tool when a lookup tool was needed | Overlapping tools with similar descriptions | Merge or sharpen descriptions, add "use when / do not use when" text |
| Malformed arguments | Calls fail or return unexpected data | Loose schema, free-text fields | Strict schemas with enumerated values, validate before execution |
| Silent partial failure | Agent reports success but the system changed only partly | Tool returns success on partial completion | Return explicit status per step, verify state after write |
| Duplicate side effects | Repeated orders, tickets or payments | Retries without idempotency | Idempotency keys, harness-controlled retry rules |
| Context flooding | Agent slows and loses focus after a large result | Tool returns entire raw output | Summarise in the tool, store the full output elsewhere |
| Hung or runaway calls | Run stalls or loops on a slow system | No timeout or call budget | Timeouts, maximum calls per run, clear stop conditions (see loop engineering and orchestration patterns) |
Enterprise Decision Framework
Classify every tool into a risk tier, then require the controls for that tier before the tool is exposed to an agent. The controls are recommended starting points; calibrate to your environment.
| Tier | Description | Example | Minimum harness controls | Approval |
|---|---|---|---|---|
| 1. Read-only | Reads data, no side effects | Look up a ticket status | Schema validation, permission scope, trace | None |
| 2. Reversible write | Changes state that can be undone | Add a note, set a draft status | Tier 1 controls plus idempotency key and undo path | Optional sampling review |
| 3. Irreversible or external write | Cannot be undone or affects others | Raise a purchase order, send an email, move money | Tier 2 controls plus timeout, retry rules set by the harness, post-write verification | Human checkpoint before execution (see human-in-the-loop design) |
Rules for a design review:
- If a tool is Tier 3 and lacks an idempotency key or a human checkpoint, do not release it.
- If two tools could both answer the same request, merge them or rewrite their descriptions before release.
- If a tool returns more than the model needs, summarise at the tool.
- If you cannot name the tier, treat it as Tier 3 until you can.
Worked example. Suppose a team reviews four tools before exposing them to a procurement agent. This is an illustrative review, not a customer result.
| Tool | Tier | Control missing | Decision |
|---|---|---|---|
| get_ticket_status | 1. Read-only | None | Release |
| add_ticket_note | 2. Reversible write | Undo path not defined | Release after the undo path is added |
| create_purchase_order | 3. Irreversible or external write | Idempotency key and human checkpoint | Do not release until both exist |
| send_supplier_email | 3. Irreversible or external write | Human checkpoint before sending | Do not release until the checkpoint exists |
Two of the four tools can go live now or soon. The two Tier 3 tools wait, because the rule is explicit: a Tier 3 tool without an idempotency key or a human checkpoint is not released. Note that nobody had to debate the model to reach this decision.
What to do in the next 30 days
- Inventory and tier every tool. Owner: AI architect. Outcome: a list of all tools, each assigned a tier, completed within week one.
- Rewrite the five most-used tool descriptions and schemas. Owner: platform engineer. Outcome: each states when to use and when not to use it, with strict input types, by week two.
- Instrument tool-call success rate. Owner: platform engineer. Outcome: a baseline for success rate and error types per tool within two weeks.
- Add idempotency keys and harness-controlled retries to all Tier 2 and 3 tools. Owner: engineering lead. Outcome: a repeated-call test that produces no duplicate side effects, passing by week three.
- Run a tier review with security and operations. Owner: head of AI. Outcome: a signed-off tier list and a go or no-go on each Tier 3 tool by day 30.
Closing thoughts
Agents become dependable when the connection to real systems is engineered with the same care as the systems themselves. Our practitioner's view is that tools and the harness deserve more of the design time than the choice of model. The next post looks at the loop that decides when an agent calls these tools, and when it should stop. If useful, download the checklist below, or talk to our architects about a tool and harness review for your agent.
Free checklist: Tool and Harness Design Review
Download the Tool and Harness Design Review checklist
A one-page, 14-point checklist your architects and risk team can use in the next design review.
Quick self-check
Tick the statements that are true for your agent today. The same checklist is available as a PDF above.
Inventory and tiers
Tool contracts
Harness controls
Operations
Frequently asked questions
What is tool design for AI agents?
Tool design is the practice of defining the functions an agent can call, including their names, descriptions, input schemas, outputs and error messages. Good design makes the right tool easy to choose and hard to misuse. It also decides what each tool returns, so results stay short, structured and useful to the model.
What is an agent harness?
The harness is the code around the model that builds context, exposes tools, validates calls, enforces permissions, applies timeouts and retries, and records traces. The model proposes actions, and the harness decides whether to run them. It is where reliability, safety and auditability are enforced in practice.
How many tools should an agent have?
As few as the task needs. More tools increase the chance of overlap and wrong selection, and they add to context. Start with a small set, measure wrong-tool errors, and add or split tools only when a specific failure justifies it. Separate read and write actions from the start.
Should the model or the harness handle retries?
For read-only actions, the model can reasonably retry. For actions that change state, the harness should control retries, using idempotency keys and confirmed-safe conditions. This prevents duplicate orders or payments and gives you one place to enforce limits and record what happened.
What is an idempotency key, and why do agent tools need one?
An idempotency key is a unique value sent with a request so that repeating the request returns the first result instead of repeating the action. Agents retry after timeouts and unclear errors, so without a key a retry can create a duplicate order or payment. Any tool that changes state should accept one.
Should an AI agent have read-only tools or read and write tools?
Separate them. Give the agent read tools freely within its permission scope, and expose write tools one at a time with the controls for their risk tier. Separate read and write tools also let you apply different approvals, which a single tool that does both cannot support.
How do you write a good tool description for an AI agent?
Write it for a reader who cannot ask questions. State what the tool does, when to use it, when not to use it, what each input means and what each error means for the next step. The model reads the description to decide whether and how to call the tool, so a vague description produces wrong-tool and wrong-argument errors.
Scenarios and examples in this guide are illustrative, not customer cases. Thresholds and intervals are recommended starting points; calibrate to your environment. Last reviewed: October 2026.
Put this into practice
Tell us about the workflow you want an agent to own. We map the controls, the failure modes and the measurement before any build starts.