A practical guide to OpenAI Function Calling

Kenneth Pangan
Written by

Kenneth Pangan

Katelin Teen
Reviewed by

Katelin Teen

Last edited September 8, 2026

Expert Verified
A practical guide to OpenAI Function Calling

We all know large language models (LLMs) can talk a big game. They can churn out emails, answer trivia, and even whip up a sonnet on command. But what about actually doing things? How do we get them to stop just talking and start interacting with the real world, like looking up an order, updating a support ticket, or querying a database?

That's the job of OpenAI Function Calling. It’s the piece of the puzzle that connects an AI's conversational skills to real-world action. It's what turns a simple Q&A bot into an agent that can actually work with your business software.

In this guide, we’ll walk through what function calling is, how it works, and some of the hidden complexities you'll run into if you try to build with it from scratch. We'll also look at a different starting point for support work: using eesel CLI to operate a teammate with its own knowledge and instructions, instead of building that application yourself.

What is OpenAI Function Calling?

Put simply, OpenAI Function Calling is a feature that lets you tell an LLM about the tools you have available. You describe your functions to the model, and it can then analyze a user's request and ask to use one of them. It does this by spitting out a neat JSON object with all the details your app needs to run the function.

A common mix-up is thinking the model runs the code itself. It doesn't. It just tells your application what code it should run and what information to use.

Think of the LLM as a really smart assistant who knows your entire toolbox inside and out. When a task comes up, they can't use the tools themselves, but they can hand you the right one (the function name) and tell you exactly how to use it (the arguments). Your application is the one that actually gets its hands dirty and does the work.

OpenAI also calls this tool calling. A function is one kind of tool; the wider tool category also includes built-in capabilities such as web search.

How does the OpenAI Function Calling flow work?

Getting an AI to use a tool isn't a single API call; it’s more of a back-and-forth conversation between your app and the model. It’s a little dance that follows a pretty predictable pattern.

Here’s a step-by-step look at how it plays out:

  1. You show the model your tools. First, you give the model a list of the functions it can use. This includes the function's name, a clear description of what it does, and the specific parameters it needs to work (all laid out in a format called a JSON schema). The quality of your description is everything, it's how the model figures out when to suggest a tool.

  2. The user asks for something. A user types a request in plain English, like, "What's the status of my order, #12345?"

  3. The model picks a tool. The model reads the request. If it spots a match with one of your function descriptions, it responds with a special message asking your application to call that function. It also provides the arguments it pulled from the user’s prompt (for example, "{"function": "get_order_status", "arguments": {"order_id": "12345"}}").

  4. Your app does the work. Your code grabs this structured response and runs the actual "get_order_status" function. It might connect to your database or an external API to get the info, which in this case is "Shipped."

  5. You pass the result back to the model. You send the function result back to the model. It can then answer, for example, "Your order #12345 has been shipped," or request another tool call if the task needs more information.

This little round trip allows the AI to blend its conversational skills with real-time data and actions, making it a whole lot more useful.

Common use cases for OpenAI Function Calling

Function calling is what takes a chatbot from a simple novelty to a powerful agent that can handle real business workflows. Here are a few of the most common ways people are putting it to work.

Plugging into your live data

This is the most straightforward use case. It lets an AI access real-time, private, or dynamic information that wasn't in its original training data. An AI can become an expert on your specific business operations almost instantly.

For example, a customer support AI could look up an order status in a Shopify database, check flight availability through an airline's API, or pull up account details from your internal CRM.

Getting things done in other apps

Beyond just fetching information, function calling lets an AI trigger workflows and make changes in other systems. It can become an active part of your business processes.

For instance, an IT support bot could get a request and automatically create a new ticket in Jira Service Management. Or, a sales assistant could take details from a conversation and add a new lead to your CRM without anyone having to do manual data entry.

Turning messy text into clean data

Sometimes, the goal isn't to answer a question but to reliably pull out and format information. Function calling is great for this because you can define a function's parameters as a blueprint you want the data to fit into.

A perfect example is processing an inbound support email. The AI can read a wall of text, pull out the user's name, company, issue type, and urgency level, and then format it all into a perfect JSON object. That object can then be used to create a new, perfectly categorized ticket in your help desk.

The hidden challenges of building with OpenAI Function Calling

Going from a cool demo to a production-ready application that uses function calling is a pretty big leap. Building directly with the API is powerful, but it comes with some engineering responsibilities that many teams don't see coming.

Orchestration challenges

What happens when a task needs multiple steps? To find a customer's order, you might first need to find their customer ID using their email, and then use that ID to look up their orders. The model can request those calls in sequence. Your application must execute them, return their results, and handle failures. That loop is part of the application you ship, not something a function definition supplies.

As one developer on Reddit put it, it’s like instructing an intern. You have to give them a series of instructions, check their work at each step, and then tell them what to do next. You're responsible for building and debugging that entire orchestration layer.

Reliability and error handling

Models don't always act the way you expect. They can sometimes "hallucinate" arguments that don't exist, call the wrong function, or just fail to call one when it's obviously needed. This means your team has to write a ton of validation, error-checking, and retry logic to make the system dependable.

Some developers even resort to practically yelling at the model in their system messages, writing things like "DO NOT ASSUME VALUES FOR PARAMETERS" in all caps, just to get it to behave. That’s hardly a scalable way to build a production system.

Test the whole tool sequence

A successful lookup does not prove the full workflow works. Test what happens when the first call finds no customer, the next service times out, or an action needs approval. OpenAI documents a loop that can return further tool calls; your application still needs clear rules for when to continue, stop, or ask a person.

Development and maintenance can be a real drag

Defining function schemas in JSON is tedious work and it's easy to make a syntax error. Every time you want to add a new tool or update an old one, you have to dive back into the code. Keeping this code in sync with your actual tools, managing different versions, and just keeping up with frequent changes to the OpenAI API becomes a constant drain on engineering time.

Operate a support teammate with eesel CLI

If you're exploring function calling to build a custom product, the API gives you control over its tools and execution. If your immediate job is to give a support teammate the right policies and check its answers, I would start with eesel CLI. Its commands let you operate the same eesel teammate your support team uses in the dashboard.

You configure an existing teammate's knowledge, instructions, and connected apps, then review its activity. A developer can run those commands directly, a script can repeat them, or a coding agent such as Claude Code, Cursor, or Codex can use them while helping you configure support.

The eesel helpdesk dashboard, another way to manage the teammate you access through the CLI.
The eesel helpdesk dashboard, another way to manage the teammate you access through the CLI.

Try a policy question against your existing teammate

For an existing eesel workspace, use Node.js 18.17 or newer and sign in first:

Bash
npx @eesel/cli login
npx @eesel/cli agents

Pick the intended agent from the list. Replace <agent-id> below with its ID, and use a real local policy file:

Bash
npx @eesel/cli instructions --agent <agent-id>
npx @eesel/cli files upload ./refund-policy.pdf --agent <agent-id>
npx @eesel/cli chat "According to our refund policy, what should we tell a customer who asks for a refund after 45 days?" --agent <agent-id>

Check that the upload succeeds before asking the question. Then compare the answer with the policy and the teammate's instructions. This tests a concrete support situation using the teammate you already operate, without first writing a document-search function and an application to run it.

For knowledge from a connected helpdesk or website, npx @eesel/cli status --agent <agent-id> shows the connections and whether their content has downloaded. Connecting a source and having its content ready are separate checks.

Make it usable by scripts and coding agents

The CLI returns JSON and structured errors with a hint and retryability information. A coding agent can read those results to decide what to check next. For example, ask it to inspect your teammate's instructions and connected sources, then report what is missing before making changes. The same setup remains visible to colleagues in the dashboard.

Use approvals to inspect actions held for human review and activity to see what the teammate has been doing. For write commands, --dry-run previews the server request without sending it. The preview shows what would be sent to the server; test the teammate's answers separately.

Choose between building an application and operating a teammate

Function calling makes sense when you need your own application behavior and want to own the tool execution. eesel CLI makes sense when you want terminal or agent-driven control of a ready-made support teammate. It does not turn your existing OpenAI function definitions into eesel commands.

If support is the use case behind your function-calling research, try eesel and follow the CLI setup guide. Start with one policy and one realistic question, then inspect the answer before expanding the workflow.

Frequently asked questions

What exactly is OpenAI Function Calling, and what problem does it solve?

OpenAI Function Calling is a feature that allows you to describe your available functions to an LLM. It solves the problem of connecting an AI's conversational abilities to real-world actions, enabling it to ask your application to perform tasks like looking up data or updating systems.

Does OpenAI Function Calling mean the LLM itself runs my application's code?

No, the LLM does not run your code. It simply analyzes a user's request and, if appropriate, responds with a structured JSON object indicating which function your application should run and what arguments to use. Your application then executes that function.

Could you explain the typical flow when using OpenAI Function Calling for a user request?

The process involves your app first describing its tools to the model. When a user makes a request, the model suggests a function and its arguments. Your application then runs that function, and finally, you pass the result back to the model so it can formulate a natural-language response to the user.

What are some practical examples of how businesses can use OpenAI Function Calling?

Businesses commonly use it to connect AIs to live data, such as looking up order statuses in a database or account details in a CRM. It's also used to trigger actions in other apps, like creating a Jira ticket, or to extract and format specific data from messy text.

What are the main challenges faced when building a production system using OpenAI Function Calling directly?

Your application must execute tool calls, return results, enforce permissions, and handle failures. Models can request multiple calls across a workflow, so test the complete sequence rather than only individual functions.

Where does eesel CLI fit when evaluating OpenAI Function Calling?

Function calling helps you build a custom application. eesel CLI gives people, scripts, and coding agents commands to operate an existing eesel teammate: upload knowledge, inspect instructions, ask questions, and review held actions. It uses the same workspace as the dashboard; it is not an OpenAI SDK or a drop-in replacement for your function definitions.

Share this article

Kenneth Pangan

Article by

Kenneth Pangan

Writer and marketer for over ten years, Kenneth Pangan splits his time between history, politics, and art with plenty of interruptions from his dogs demanding attention.

Related Posts

All posts →
Hand-drawn illustration of two people talking with an AI voice assistant, for a guide to OpenAI WebRTC voice AI
Guides

OpenAI WebRTC: A complete overview for real-time voice AI

OpenAI WebRTC offers powerful real-time voice capabilities, but building with the raw API is complex. This guide covers the essentials and a simpler path to deployment.

Rama AdiRama AdiOct 12, 2025
Hand-drawn illustration of documents flowing into a vector store and a search panel returning results, for a 2026 guide to OpenAI Vector Stores
Guides

A practical guide to OpenAI Vector Stores for RAG (2026)

Thinking about using OpenAI Vector Stores for your AI support agent? This guide breaks down the pros, cons, and hidden complexities of building with them directly. Learn about the challenges of latency, cost, and control, and discover how a self-serve platform can provide a more powerful, integrated solution in minutes.

Kenneth PanganKenneth PanganOct 12, 2025
Hand-drawn illustration of two people reviewing an AI agent's graded trace checklist, for a guide to OpenAI Trace Grading in 2026
Guides

What is OpenAI Trace Grading? A guide for 2026

OpenAI Trace Grading offers deep insights for developers building AI agents, but it's complex. Learn what it is and explore a more practical, business-friendly alternative for evaluating your support AI with confidence.

Kenneth PanganKenneth PanganOct 12, 2025
Illustration of messy model text turning into a clean JSON object for OpenAI JSON Mode in 2026
Guides

OpenAI JSON Mode: How to use it and common pitfalls (2026)

Discover the essentials of OpenAI JSON Mode, from implementation to its biggest challenges. This guide explains how to get structured JSON responses from OpenAI models and explores more reliable alternatives for building production-ready AI applications.

Rama AdiRama AdiOct 12, 2025
Developer at a laptop with an AI coding agent chat beside the code editor, illustrating Codex in PyCharm in 2026
Guides

A developer's guide to OpenAI Codex integrations with PyCharm in 2026

Looking for OpenAI Codex integrations with PyCharm? You're not alone. Our guide shows how to run Codex inside PyCharm through JetBrains AI Assistant, what each login option costs, and how to boost developer productivity with other AI tools.

KiraKiraOct 30, 2025
GPT 5.1: A breakdown of OpenAI's smarter, more conversational AI
Guides

GPT 5.1: A breakdown of OpenAI's smarter, more conversational AI

OpenAI's GPT 5.1 isn't just another jump in raw intelligence. It's a big step toward making AI feel more intuitive, reliable, and human. Here’s a look at what’s new, from its dual-model architecture to what it means for you.

Kenneth PanganKenneth PanganJan 6, 2026
GPT realtime mini: A practical guide to OpenAI's voice AI model
Guides

GPT realtime mini: A practical guide to OpenAI's voice AI model

OpenAI’s new GPT realtime mini model is making waves, but what is it and how can you use it? This guide explains its speech-to-speech capabilities, complex pricing, and how to leverage it for customer support without the engineering overhead.

Kenneth PanganKenneth PanganOct 6, 2025
Illustration of two support teammates and an AI robot with the OpenAI mark, next to the Zendesk logo
Guides

Does Zendesk use OpenAI? The full 2026 story

Wondering if Zendesk uses OpenAI? The short answer is yes, though OpenAI is one of several model providers behind it. I break down how Zendesk's native AI uses OpenAI, the options for custom setups, and how a plug-and-play solution can further enhance your support team's workflow.

Kenneth PanganKenneth PanganOct 6, 2025
OpenAI safety best practices: A practical guide (2025)
Guides

OpenAI safety best practices: A practical guide (2026)

Implementing OpenAI's powerful models in customer-facing roles comes with risks. This guide breaks down the essential OpenAI safety best practices for moderation, accuracy, and data security, and shows you how to implement them without a dedicated engineering team.

Stevia PutriStevia PutriOct 12, 2025

Ready to hire your AI teammate?

Set up in minutes. No credit card required.

Get started free