Function calling

An API pattern where the LLM returns a structured call to a specified function, often validated and executed by your code.

When to use it

  • You need strict schema adherence with minimal prompt engineering.
  • You want safety and determinism for high-risk actions (payments, PII).
  • You plan to swap models/providers while keeping the same contracts.

PM decision impact

Function calling enables safer integrations and clearer contracts with engineering. PMs define which functions are exposed, required fields, and audit logging. It affects portability and reduces vendor lock-in. Over-exposing functions increases risk surface and maintenance load.

How to do it in 2026

Design narrow, well-typed functions with strong defaults. Validate all arguments before execution and provide user-facing confirmations for destructive actions. In 2026, pair function calling with per-tenant allowlists and privacy redaction on inputs/outputs.

Example

A billing copilot exposes `create_refund` only with required fields and an approval step. Refund accuracy rises to 96%, while incident rate stays below 0.2% and refunds process in under 20 seconds end-to-end.

Common mistakes

  • Exposing broad catch-all functions that are hard to validate.
  • Skipping user confirmation for irreversible actions.
  • Assuming provider-specific behavior will stay stable across model upgrades.

Related terms

Learn it in CraftUp

Last updated: February 2, 2026