Agent loops, the Model Context Protocol, function calling with structured output, and orchestration frameworks.
An LLM agent is a loop around a model: the model chooses a tool and its arguments, ordinary code runs the tool, the result is appended to the conversation, and the model decides what to do next. This section covers the protocol layer, the reliability of tool arguments, and the frameworks that structure longer workflows.
An "agent" in 2026 is just a loop: the model proposes a tool call, your code executes it, you feed the result back, repeat until the model emits a fin
Most production LLM bugs are not "the model is dumb" — they're "the model returned when downstream code expected a number." This page c
Two ways to build LLM apps in 2026 beyond linear LangChain chains: LangGraph , which models your app as a stateful graph with conditional edges and…
Three concerns recur in every agent. First, how tools are described and connected: the Model Context Protocol (MCP) standardises tool and resource discovery so one server can be reused across clients. Second, how the model's output is made machine-readable: function calling and structured output constrain responses to a JSON schema so downstream code does not have to parse prose. Third, how multi-step control flow is organised: graph frameworks make branching, retries and human approval explicit, while prompt-optimisation frameworks tune the prompts inside each step.
| Situation | Start with |
|---|---|
| Extract fields from text into a fixed shape | Structured output, no agent loop |
| Model must look things up or take actions | Function calling in a simple loop |
| Same tools shared across several apps or clients | An MCP server |
| Branching, retries, human approval steps | LangGraph-style state graph |
| Prompt quality must be tuned against a metric | DSPy optimisers |
Use the smallest structure that works. A single structured-output call is easier to test than an agent, and a plain while-loop with a step limit is easier to debug than a framework. Add a graph or an optimiser only when the control flow or the prompt tuning becomes the hard part.
Agents usually need retrieval; see Retrieval and RAG. Running agents reliably is covered in Production, and Agent Zero describes a complete agent framework.