## Definition A **native function** is a deterministic, code-executed tool — a Python function, a shell command, an API call — that the host runs when the model requests it. A **semantic function** is a prompt executed by an LLM: a call that *looks* like a tool call in the loop but resolves to another (or the same) model doing language work. Both types present an identical interface to the [[Agentic Loop]]; the loop cannot distinguish them from the stop-condition perspective. ## The Two Types | Dimension | Native function | Semantic function | |---|---|---| | Execution | Deterministic code on the host | LLM inference call | | Output | Exact, schema-typed | Probabilistic, language-shaped | | Latency | Microseconds–milliseconds | Tens of milliseconds–seconds | | Cost | Compute + I/O | Token cost | | Failure mode | Exceptions, timeout | Hallucination, refusal, drift | | Composability | Easily tested, mocked | Requires eval harness | ## Why the Distinction Matters Because both types look identical in the loop, engineers sometimes reach for a semantic function when a native one would be cheaper, faster, and more reliable — or vice versa. The heuristic: use a native function whenever the operation is **deterministic and expressible in code** (arithmetic, regex, API call, file I/O). Reserve a semantic function for operations that are **inherently linguistic** (rewrite this paragraph, extract named entities, classify sentiment) where code cannot replicate the flexibility of language understanding. A secondary risk: nesting semantic functions inside an agentic loop multiplies token cost and [[Compounding Error]]. Each semantic function call is another turn in some sub-loop, and its probability of failure compounds with the outer loop's own reliability. ## Relationship to [[Function Calling]] [[Function Calling]] defines the wire protocol (name + JSON arguments → result). The native-vs-semantic distinction lives one level above: it is a design decision about what the host does when it receives the call. The loop does not care; the cost model and the reliability model care a great deal. ## Skill Libraries Advanced systems blur the distinction productively: a **skill library** stores frequently-composed tool-call sequences as reusable primitives (the Voyager pattern). A skill may wrap native functions, semantic functions, or both — but from the calling agent's view it is still just a tool. This is the conceptual foundation of MCP servers and Skills authoring in orchestrator frameworks. ## Related - [[Function Calling]] - [[Tool Use]] - [[Agentic Loop]] - [[Compounding Error]] - [[Tool Taxonomy]] ## Sources - [[Modern AI Software Engineering - The Orchestrators Playbook]]