Explore how function calling and tool use empower AI to interact with APIs and databases. Learn to integrate Ultralytics YOLO26 into agentic workflows today.
Function calling, frequently referred to as tool use, is a powerful paradigm in modern artificial intelligence (AI) that allows models to extend their capabilities beyond static text or image generation. Instead of just answering a prompt based on internal training data, the model can output structured commands to trigger external programming functions, query databases, or interact with REST APIs. This approach effectively gives AI the ability to take tangible actions in digital environments.
When an AI system utilizes function calling, developers provide the model with a list of available tools described using JSON Schema. If the user's prompt requires real-time data or a specific action, the model pauses its standard generation process and outputs a highly structured JSON format payload matching the required parameters of the selected tool. Frameworks like OpenAI's function calling API and Anthropic's tool use framework have popularized this technique, turning conversational agents into capable problem solvers.
Integrating tool use into workflows transforms how software operates. Evaluated by benchmarks like the Berkeley Function Calling Leaderboard, these capabilities are driving a shift toward highly autonomous systems.
You can expose a computer vision model as a functional tool for an overarching AI agent. In this architecture, you define a Python method that performs inference, which a reasoning model can trigger when visual data is needed.
from ultralytics import YOLO
# Define a specific tool function for an AI agent to call
def count_objects_in_scene(image_url: str) -> str:
# Load the highly efficient YOLO26 model
model = YOLO("yolo26n.pt")
# Perform inference to analyze the visual data
results = model(image_url)
object_count = len(results[0].boxes)
# Return structured context back to the calling AI system
return f"Vision Analysis: Detected {object_count} objects in the scene."
# Simulated function call executed by an AI system
print(count_objects_in_scene("https://ultralytics.com/images/bus.jpg"))
To fully grasp modern AI architectures, it is helpful to understand how function calling relates to and differs from similar concepts: