What is function calling in AI?

Updated October 2026 · How we answer

Short answerFunction calling lets an AI model request a specific function from your code, like checking the weather or sending an email, by returning structured data instead of just text. It bridges the gap between language understanding and real-world actions.

The Basic Idea

Function calling is a feature where a large language model (LLM) can output a structured request—usually JSON—to invoke a function you've defined. For example, if a user asks 'What's the weather in Boston?', the model might return `{"function": "get_weather", "arguments": {"location": "Boston"}}`. Your application then runs that function and feeds the result back to the model.

This turns the model from a text generator into an agent that can interact with external systems. It's not the model executing code itself; it's the model deciding which function to call and with what parameters, based on the conversation.

Common Use Cases

Function calling is used for tasks like fetching live data (weather, stock prices), performing calculations, sending messages, querying databases, or controlling smart devices. It's especially powerful in chatbots and assistants where the model needs to go beyond its training data.

For instance, a customer support bot could call a function to look up an order status, or a travel assistant could call a function to book a flight. The model handles the language part, and your code handles the action.

  • Retrieving real-time information (news, weather, sports scores)
  • Performing actions (sending emails, making reservations)
  • Interacting with databases or APIs
  • Doing math or data processing
  • Controlling external devices or services

Common mistakes

  • Thinking the model executes the function itself—it only suggests the call; your code must run it.
  • Assuming function calling works out of the box for any model; it requires specific training or prompting.
  • Confusing function calling with fine-tuning; it's a runtime capability, not a way to change the model's weights.
From our studioSearchSignal — SEO data and keyword research for AI agents.