Tool Use / Function Calling
What is Tool Use / Function Calling?
Tool Use, also called Function Calling, is the mechanism by which an LLM produces a structured request to invoke an external function instead of replying with prose. It is the foundational primitive that turns a language model into an actor inside a composable stack, because every read or write to the Commerce Engine, the CMS or third-party APIs flows through such calls.
Definition
Developers register functions with a JSON Schema describing arguments and return types. At inference time the model decides whether to answer directly or to emit a tool-call message with the function name and JSON arguments. The runtime parses the call, validates the arguments, executes the function and feeds the result back as a tool-result message, which the model then incorporates into the next step. Modern models support parallel calls, streaming arguments and constrained decoding so the JSON stays syntactically valid. Tool definitions count against the context window, so teams curate small, well-named tool sets per agent rather than exposing the entire backend.
Why it matters
Tool Use is what makes agents auditable and safe. Every side effect is a typed call that can be logged, rate-limited and reviewed, in contrast to brittle approaches that parse the model's free-text output. It also enables clean separation of concerns: the model handles language and reasoning, while business rules live in the function body where they can be unit-tested. In a Composable Commerce setting, tools usually wrap existing services such as the Storefront API, webhooks or search endpoints, so the AI layer remains a thin orchestrator rather than a parallel implementation.
Use cases
A search-tuning agent calls a get_query_stats tool, a propose_synonym tool and a write_synonym tool to iteratively improve relevance. A customer-service agent uses lookup_order, issue_refund and create_ticket tools, with the refund tool gated by Guardrails for amount limits. A content agent uses fetch_brand_voice, draft_section and publish_to_cms tools to ship landing pages, and a separate eval tool scores the draft before publication.
Related
Explore Agentic Frontend Management Platform · Composable Digital Experience Platform.