agents medium complexity mvp

Function Calling

Function calling is a model interface pattern where the model emits structured arguments for predefined functions.

Decision

Use function calling when you need a model to choose among known functions and provide machine-readable arguments.

Use when

  • Extracting structured arguments
  • Calling known APIs
  • Routing user requests
  • Constrained tool use

Avoid when

  • Unknown tool ecosystems
  • Unvalidated side effects
  • Free-form reasoning output
  • Cross-application tool discovery by itself

What function calling is good at

Function calling gives the model a set of available functions and asks it to produce structured arguments. It is useful when the application already knows the tools and needs the model to select or fill them.

The function call should be treated as a request, not as trusted execution. Your code still validates the arguments and decides what happens.

Where it is limited

Function calling does not solve tool discovery, permissions, state management, or cross-app integration by itself. Those concerns live in the surrounding product architecture.

Common mistakes

  1. Treating generated arguments as trusted input.
  2. Exposing too many broad functions.
  3. Using function calling when structured output alone is enough.

Next decision

Compare function calling with MCP when you need reusable tool integrations across clients and servers.