Urgent.News

What's breaking now, across thousands of outlets.

AI

AI Tool Calling: The Model Never Runs Your Code

A customer types one sentence into a food app's support chat: Where is order 4472? Cancel it if no rider is assigned yet. The app checks the order, cancels it, and replies. Here is the strange part. No code was ever written for that sentence. An AI model read it, looked at the functions the app offered it, and decided which ones to call. That is called tool calling . Some vendors call it function…

The headline "AI Tool Calling: The Model Never Runs Your Code" explains how artificial intelligence can understand and execute actions on behalf of users without actually running code itself. Here's a summary of the key points:

1. A customer interacts with a food app's support chat by typing a request to cancel their order 4472 if no rider is assigned yet. The app uses AI to process the request.

2. No custom code was written for this specific request. Instead, an AI model reads the customer's sentence and determines which functions to call within the app's own code.

3. This process is called "tool calling" or "function calling." It allows the AI model to understand the task it needs to perform and then delegate the execution to the app's code.

4. Tools are described in the app's code as functions with a name, a description of what they do, and the inputs they require. For example, the app provides a function called "get_order" that fetches an order by its ID.

5. When the AI model receives a customer's request, it sends a "tool call" to the app, specifying the tool to use and the necessary arguments. In this case, it sends a "get_order" tool call with the order ID 4472.

6. The app's code receives the tool call, checks if the requested tool is available, and then executes the corresponding function using the provided arguments. In this example, it calls the "get_order" function to fetch the order details.

7. The app then processes the fetched order information and, in this case, determines that the order has no assigned rider. Since the customer requested cancellation, the app updates the order status to "CANCELLED."

8. The model sends a follow-up tool call to cancel the order using the "cancel_order" function with the same order ID.

9. The app executes the cancellation, updates the order status in the database, and sends a message to a queue to notify the restaurant about the cancellation.

10. Finally, the model replies to the customer with plain text, confirming that the order has been cancelled.

The article highlights how AI models can leverage existing code without writing new code for every possible user request. By defining tools and providing necessary inputs, the model can understand the task and delegate the execution to the app's code, resulting in a more efficient and flexible system.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Let the model read the invoice, not approve it: an n8n pattern for AP automation

Most "AI invoice automation" demos stop at the fun part: a model reads a PDF and spits out JSON. The hard part is what happens next. Who decides the invoice gets paid?

  • Model only reads invoice data, separate code node handles approvals
  • Workflow triggered by Gmail for each PDF invoice attachment
  • Claude converts PDF to JSON, functions normalize extracted fields

The Model Changed. My Skill Didn't. The Score Still Dropped.

What agent evals taught me about moving model floors, noisy LLM judges, and treating the evaluator as part of the instrument My rule for evaluating an agent skill is deliberately asymmetric: Test the…

  • The author emphasizes testing agent skills on the weakest model for consistent measurement.
  • A change in the LLM judge caused a significant drop in scores for the agent.

More from Wednesday 7 October →