AI Expert

Guides/Tool & integration design

Tool & integration design for LLMs

Agents fail loudly when integrations behave like one-off scripts. Treat tool calls as API contracts: validate arguments, execute with budgets, and translate failures into responses models can reason about — instead of raw stack traces destined for confused users.

Call lifecycle

Stages from model tool call to normalized response for the modelHappy path + failure normalizationCall JSONSchema checkExecuteTimeout / quotaNormalizeStable errorsModel summaryTruncate / redactRetries & idempotency keys live inside Execute —models should never see raw vendor HTML stacks
Treat tool outputs like APIs: consistent shapes beat clever prompting when agents loop.

Schema & ops checklist

Design leverWhat good looks likePM smell
Narrow tool surfaceFewer functions with crisp names beat giant generic “doAnything” RPCSupport tickets cite wrong tool picked — widen docs before widening surface
Deterministic argsEnums, bounded strings, max lengths — reject early with actionable messagesSilent truncation causes wrong writes — surface validation to the model path
Idempotency tokensSafe replays on timeouts — critical for payments, tickets, emailsDuplicate side-effects after retries — missing idempotency story
Timeout budgetFail fast; return partial progress markers the model can narrateHung threads & angry users — align SLAs with streaming UX guide

Reliability compounding

Side-effect mishap pressure vs integration hygiene (schematic)

Each layer removes failure modes agents cannot prompt away — especially under retries.

Pair with agent-boundaries tiers — reliability gates determine how far autonomy can expand.