Skip to content
The ceiling of an agent lies not in the model, but in the tool interface design

The ceiling of an agent lies not in the model, but in the tool interface design

A common scenario: a team connects an Agent to an internal system. The model gets swapped twice, from a cheap small model to the strongest flagship model, and the task success rate climbs from 60% to just over 70%, then stalls. In the retrospective everyone stares at the prompt and the model version, but few look at the signatures of those dozen or so tool functions.

When I judge whether an Agent can get work done, the first thing I look at isn’t the score on the model card—it’s what the tool interfaces look like. Tools are the only channel between the model and the real world. If the channel is narrow, no matter how smart the model is, it can only squeeze through it. This isn’t a metaphor; it’s a constraint you can break down engineering-wise: the set of actions the model can choose at each step, the range of parameters each action can express, and the information it can get after an execution failure are all determined by the interface definition.

Cram five functions into one tool, and the model learns to guess

The most common bad interface is exposing the backend’s existing CRUD (create/read/update/delete) interface to the model as-is. For example, a manage_order function whose parameters are action (create/update/cancel/query), order_id, payload. From an engineer’s perspective this is elegant—one function covers every scenario. From the model’s perspective, four different things are crammed into one action, and payload is a free-form JSON, so the model has to guess the field names.

The consequences are predictable: the model omits required fields, casually includes update fields when calling cancel, and spells action as modify. These errors aren’t because the model’s comprehension is insufficient—it’s that the interface gives it no clear landing spot. Within the same action space, the higher the ambiguity, the higher the probability of sampling errors, and this has little to do with model size.

My approach is to split tools by “user intent” rather than by “data table.” Canceling an order and changing an address are two intents, so they should be two tools, each with parameters narrowed down to three to five required fields. The number of tools will grow, but each tool’s call accuracy will be noticeably better than the merged version. Here’s a counterintuitive point: more tools raise the model’s difficulty in choosing, so you have to trade off between “intent granularity” and “total tool count.” My default is to keep the tools exposed by a single Agent to around ten; beyond that, it’s a sign you should split the Agent, or fold some actions into higher-level composite tools.

Parameter design: don’t make the model fill in what it can’t infer

The second category of problems is at the parameter level. Some interfaces require passing tenant_id, operator_id, internal enum codes—fields that are readily available in context for a human but that the model can’t infer. It can only dig through the conversation, and if it can’t find them, it makes one up.

The criterion is simple: could a colleague who joined three days ago and has only read the requirements doc fill in this parameter correctly without any extra hints? If not, it shouldn’t appear in the tool signature. Tenant and operator should be injected by the server from the session context, not relayed by the model. Enum values should either be fully listed in the parameter description, or changed to natural-language fields that the server maps.

There’s another hidden pitfall: time. Ask the model to fill in start_time and end_time, and it will miscalculate relative times, get confused about which week “last week” refers to, and time zones are an even bigger disaster zone. A workable approach is to have the model pass only relative expressions (last_7_days, yesterday) or nothing at all, and let the server parse them by fixed rules. Move uncertain computation from the model side to deterministic code, and this kind of error basically drops to zero.

JSON12 lines
1
2
3
4
5
6
7
8
9
10
11
12
{
"name": "query_orders",
"description": "按时间范围和状态查询订单,只读",
"parameters": {
"type": "object",
"properties": {
"range": { "type": "string", "enum": ["today", "last_7_days", "last_30_days"] },
"status": { "type": "string", "enum": ["pending", "shipped", "cancelled"] }
},
"required": ["range"]
}
}

The signature above has no user ID, no timestamp, no pagination cursor. These are all supplied by the runtime. The narrower the interface, the fewer judgments the model has to make, and the smaller the error surface. Some worry this isn’t flexible enough, but in Agent scenarios the vast majority of failures aren’t “insufficient capability”—they’re “freedom used in the wrong place.”

Write error messages for humans to read, so the model has a chance to self-correct

The return after a failed tool call is the most easily overlooked part. Many implementations just return str(e), and the model receives a KeyError: 'order_no'—it can’t do anything except retry the same call.

I prefer to classify errors into three types and return all of them explicitly to the model: invalid parameters (which field, what format is expected), business rule rejection (why it was rejected, under what conditions it would pass), and system failure (temporarily unavailable, suggest switching paths or stopping). These three correspond to three completely different follow-up actions for the model: change the parameters, change the approach, or give up and tell the user. Without the distinction, the model can only retry uniformly, and you’ll see it spin five times on a call that’s doomed to fail.

Here’s a detail that’s easy to get wrong: when a business rule rejects, don’t throw the internal rule text out verbatim. You need the model to know “why it doesn’t work” without leaking the risk-control policy. A workable approach is to give a stable error code plus a user-facing message for the model to relay. The criterion is: if this error message were printed to the frontend as-is, would it cause problems? If so, it must be filtered at the return layer.

Another detail is that the return shape must be stable. The same tool sometimes returns an array, sometimes returns {data: [...]}, and sometimes returns an empty string when nothing is found—the model has to re-guess the structure every time, and in long tasks this instability accumulates into drift. Standardize on fixed fields, fixed types, and return an empty array plus an explicit count: 0 when nothing is found. These are engineering common sense, but they’re exactly the watershed for whether the model can work across multiple steps.

Tool descriptions are part of the prompt, but they don’t do the safety netting

If tool descriptions are vague, the model picks the wrong tool. I’ve seen descriptions written as “handles order-related operations,” with all five tools written that way, leaving the model to guess by name. A description should state three things clearly: when to use it, when not to use it, and what side effects occur after calling it.

The side-effects point is especially important. With read-only and write tools mixed together, the model has no reason to be more cautious. A workable approach is to label directly in the description “read-only” or “modifies data, confirm before calling,” and at the same time add a confirmation layer for write operations at runtime. This isn’t asking the model to be careful via the prompt—it’s making the risk level explicit through the interface.

But draw the boundary clearly: a well-written tool description only improves selection accuracy; it can’t replace parameter validation and permission control. Putting safety on “the model will read the description” puts responsibility in the wrong place. Hard constraints at the interface level (permissions, idempotency, amount caps) must be enforced by the server; the model is only responsible for choosing a path within the constraints.

Changing the interface is cheaper than swapping the model, but measure first

To decide whether to touch the interface, I usually look at the failure distribution first, not the overall success rate. Classify failure samples into “wrong parameters, wrong tool selected, failed to stop when it should have, tool itself errored, model reasoning error.” If the first four categories dominate, swapping the model is basically a waste of money.

flowchart TD
    A[失败样本] --> B{错在哪一层}
    B -->|参数不合法| C[收窄参数 服务端注入]
    B -->|选错工具| D[拆意图 重写描述]
    B -->|该停手没停| E[错误分三类返回]
    B -->|工具报错| F[修实现 补幂等]
    B -->|推理错| G[再谈模型]

This diagram answers the question of troubleshooting order: only after the four interface-level categories are ruled out does the remaining failure belong to the model. My experience is that for an Agent that has just been connected to tools, interface-level failures often account for more than half. Pushing that part down usually yields a bigger success-rate gain than one model swap, and the cost is just a few function signatures and return structures.

One more boundary needs to be made clear: narrowing the interface has a cost. The more specialized a tool is, the worse its cross-scenario reusability becomes, and when it encounters user intent it has not been designed for, the Agent will appear “inflexible.” This is not a design failure; it is a trade-off. My default is to first turn high-frequency paths into specialized tools and get them running stably, use one or two constrained general-purpose queries as a fallback for the long tail, and explicitly tell the model “general-purpose tools are for queries only; do not use them for writes.” Once enough long-tail intent has accumulated, promote them to specialized tools.

By the tenth year, I increasingly feel that an Agent’s capability ceiling is not a model metric but an interface list. The model determines how complex the speech it can understand; the interface determines how many correct actions it can turn that understanding into. You can buy the former; the latter you can only design yourself.

Next time the success rate gets stuck, don’t rush to switch models. Print out the tool list and ask one by one: if this function were handed to a smart newcomer with no background knowledge, would they use it wrong? If so, that’s where the problem is.

About this Post

This post is written by Lu's Blog, licensed under CC BY-NC 4.0.

#Agent #Engineering Trade-offs #Tool Design

Comments