ORIGINAL TECHNICAL PRACTICE
Design a reliable agent tool contract
An AI agent can create support tickets and update their priority. What should the tool interface and execution layer guarantee?
Written for independent practice. The model answer presents one approach; clarify constraints and explain alternatives.
A REASONED APPROACH
Model answer.
Expose narrowly defined operations with explicit input schemas, permissions and execution results. The model proposes an action; the application validates and executes it under the authenticated user’s authority.
Work through it
- Require stable ticket IDs, allowed priorities and a reason field where useful. Separate read operations from writes and prevent arbitrary query or URL execution.
- Use idempotency keys for ticket creation and conditional updates for state-sensitive changes. Return actual persisted status rather than the model’s prediction of success.
- Make uncertain tool outcomes visible and support reconciliation before retrying. Evaluate sequences involving wrong IDs, permission denial, duplicate requests and conflicting updates.
Tradeoffs to discuss
- More focused tools are easier to validate but may require additional steps. A general-purpose execution tool is flexible while greatly expanding the error and security surface.
Common pitfalls
- A tool call completing at the transport layer does not prove the intended business change occurred. Broad credentials and unvalidated model arguments undermine the contract.