Frank Coyle (@frank_coyle_969c2658e185c) wrote Your Agent Needs a Schema, Not a Better Prompt for Daily Context on DEV Community. He uses a hypothetical refund workflow to ask where an application should enforce the business rules that govern an agent's tool calls.
Validate the proposed refund against order data
Coyle's example starts at the moment an agent is ready to request a refund. The request carries an order reference and an amount. Those fields can be well formed while the order is still ineligible. The application needs information about the order itself to decide whether the proposed action meets the policy.
The article models those conditions in SHACL, the W3C Shapes Constraint Language for validating RDF graphs. The sample shape expects exactly one order reference, constrains the referenced node to the delivered-order class, and checks that the refund amount is a positive decimal. Those tests can run on the proposed refund and the relevant order facts before the side effect. Coyle describes the comparison with the purchase total separately, as a constraint that can use SPARQL to compare related values in the graph. The sample shape covers the reference and the positive amount.
Make a rejection explain which condition failed
Coyle then places the validator between the agent's proposed action and the operation that would move money. A failed check can produce a validation result with the field and condition involved. In the delivery example, that gives the caller a concrete reason to surface when the order has shipped but has yet to reach a delivered state. A useful evaluation case can preserve both the proposed refund and the order state that made it ineligible.
The author suggests starting with a single consequential action and tracking rejected proposals. For a refund workflow, separate cases for a missing reference, a reference to an ineligible order, and an invalid amount would exercise different parts of the shape. A separate case can exercise the comparison with the order total once that constraint is implemented. The resulting cases give the team a way to review the rules alongside the agent behavior.
Reference for constraint and report semantics: W3C SHACL.