The problem with untyped tools
When agents call external APIs through ad-hoc JSON, failures are silent. Wrong field names, missing validations, and partial updates corrupt production data before anyone notices.
We treat agent tools like public API endpoints: typed inputs, typed outputs, schema validation on both sides.
Our pattern
Each tool is a function with a Zod (or equivalent) schema. The agent receives a JSON schema derived from those types. Outputs are validated before side effects execute.
If validation fails, the agent gets a structured error and retries — it doesn't write bad data to your CRM.
Testing tools independently
Tools are unit-tested without the model. Agent evals test tool selection and sequencing. This separation makes debugging fast: was it the model or the integration?
