On this page

The problem#

Every team building agents hits the same wall: the model invents a tool, invents an argument, or calls the right tool with the wrong shape. The fix is rarely "a smarter model."

1. Strict JSON schema, every call#

Reject anything that doesn't parse before it even reaches your runtime.

typescript
const schema = z.object({
  tool: z.enum(["search", "fetch", "summarize"]),
  args: z.record(z.string()),
});

2. Tool dictionaries in the prompt#

Don't just describe tools. List them by name, in order, in a fenced block. Models pattern-match.

3. One retry with the error pinned#

If parsing fails, feed the exact error back and ask for a corrected call. Don't go to three retries — diminishing returns.

4. Evals before deploys#

We run a 200-case suite on every prompt change. It catches regressions a vibe-check never would.

5. Boring telemetry#

Log tool, args, result, latency. You will use it.