Prompting techniques
Function calling
Definition
Function calling lets a model request that your code run a specific function with specific arguments. You expose tool definitions; the model returns a structured call, your code executes it, and the result goes back into the conversation.
Function calling (also called tool use) is the mechanism behind most AI agents. You describe available functions with names, descriptions and JSON-schema parameters. The model decides when a function is needed and emits a structured request rather than prose.
Critically, the model does not execute anything. It produces a request; your application validates and runs it, then returns the result. That separation is where your security boundary lives — never pass model-generated arguments straight into a shell, a database query, or a payment API without validation.
Good tool descriptions matter as much as good prompts. The model chooses tools based on their descriptions, so vague descriptions cause wrong tool selection.
Related terms
AI agent
An AI agent is a system where a model plans and takes actions through tools in a loop, rather than producing a single response. It decides what to do next, does it, observes the result, and continues until the goal is met.
Structured output
Structured output means constraining a model to return data in a machine-readable shape such as JSON, usually by specifying the exact schema in the prompt or using a provider feature that enforces it.
MCP (Model Context Protocol)
MCP is an open standard for connecting AI models to external tools and data sources. It replaces bespoke per-integration code with one protocol any compatible client can use.
ReAct pattern
ReAct (Reason + Act) is the core agent loop: the model reasons about what to do, takes an action via a tool, observes the result, then reasons again. It repeats until it can answer.
Zero-shot prompting
Zero-shot prompting means asking a model to do a task with no worked examples — just an instruction. It works well for common tasks the model has seen extensively in training.
Few-shot prompting
Few-shot prompting means including two to five worked examples of the input-output pattern you want before making your real request. It is the fastest way to lock in a consistent format, tone or edge-case behaviour.
Put this into practice
Understanding the term is step one. Our free courses and tools let you actually use it.