Function calling lets a model output structured arguments matching a user-defined schema, which the application then executes against real APIs, databases, or code, returning results for the model to use. It solves two problems at once: LLMs cannot directly act in the world, and downstream systems need strictly typed data. Toolformer-style training teaches the model to insert API calls into its text output and fold results back into its reasoning; at inference, structured outputs guarantee parseable JSON through constrained decoding.
Agentic prompting turns the model into a planner that decides the next action—calling tools, reading results, planning steps—rather than following a fixed prompt sequence. The agentic loop interleaves reasoning with action until a goal is met, bounded by max steps, tool scopes, and a stop condition to prevent runaway loops and excessive cost. ReAct (Reason + Act) interleaves natural-language reasoning traces with external actions like tool calls or searches: the model thinks step by step, decides an action, observes the result, and continues reasoning. Plan-and-execute agents instead draft a full plan first and then execute it, gaining transparency and fewer redundant steps at the risk of committing to a plan that may become stale.
For computational problems, program-aided language models (PAL) prompt the model to emit executable code—typically Python—that is then run by a deterministic interpreter, offloading arithmetic and logic. Self-debugging prompts the model to run its generated code, interpret error messages, and iteratively fix bugs without human intervention. Speculative decoding accelerates inference by using a small draft model to propose several tokens that a larger model verifies in parallel, while prefix caching stores key-value attention states for repeated prompt prefixes to cut latency and cost on long system prompts and RAG contexts. Semantic caching takes a similar idea further by indexing cached responses by embedding similarity so paraphrased queries can return stored answers.