CSE Roadmap

Common tier · about 4 hours · 11 parts

Part 2 of 11 · 2 min read

Why tool preconditions matter more than the prompt

A rule written in a prompt can be talked past; a rule enforced by the tool itself cannot.

Think of a vending machine that physically will not dispense a drink unless a coin has actually dropped, versus a cashier who was just told to only accept paying customers. The cashier can be argued with; the machine cannot.

In plain words: a policy written only in the prompt relies on the model correctly applying it every time. A precondition built into the tool itself refuses to act when the condition isn't met, regardless of what the model asked for.

A worked example. Running the agent fully autonomously, with no confidence threshold but with tool preconditions still in place, tool-level checks (not the policy) catch 62 wrong attempts. Examples include a refund requested on an order that hasn't shipped, or a cancel requested after shipping. Each one turns into a denied action followed by an unhelpful reply, rather than an actual wrong refund. The model asked; the tool simply refused.

The key lines. From code/mini-support/support.py:

# from code/mini-support/support.py
def refund(self, customer, order_id, key):
    o = self.get_order(customer, order_id)
    if o.status != "delivered": raise ToolError("order not delivered")
    if o.days_since_delivery > WINDOW_DAYS: raise ToolError("outside the refund window")
    if o.refunded: raise ToolError("already refunded")

Read it as: the refund tool checks its own conditions before doing anything, regardless of what the model's reasoning concluded. A model that got confused about the order's status still can't get the tool to act on a false premise.

Intent, confidence, precondition

Intent is the kind of request (refund, cancel, address change, and so on); confidence is the classifier's score for its guess, useful only if calibrated. A precondition is a rule a tool checks on itself before acting, such as "the order has not shipped."

Example: the o.status != "delivered" check above, refusing a refund regardless of what the model believed about the order.