Key takeaway
- Large language models in AI agents explained for enterprise leaders: architecture, tool calling, patterns, evaluation and the controls agents need.
What do large language models do inside an AI agent?
A large language model (LLM) is the reasoning and language component of an AI agent. The agent is the system built around it: tools, memory, a control loop and the rules that decide what it may do. Anthropic draws the line this way: workflows are "systems where LLMs and tools are orchestrated through predefined code paths", while agents are "systems where LLMs dynamically direct their own processes and tool usage". For an enterprise, the practical question is how much of that direction you hand to the model.
This guide covers the LLM as the core of an agent: its architecture, tool calling, which pattern fits which task, how to evaluate it and which controls to add. For the wider category, see our guides to AI agents and large language models. For the build sequence, see building custom AI agents; this post stays on the model-as-core question.
How is an LLM-based agent put together?
The survey The Rise and Potential of Large Language Model Based Agents (arXiv, September 2023, 29 authors) proposes a general framework with three components: a brain, perception and action. It then reviews single-agent, multi-agent and human-agent cooperation settings. Anthropic describes the building block in practical terms as an "augmented LLM": a model enhanced with retrieval, tools and memory, which can generate its own search queries, select tools and decide what to retain.
| Component | What it does | Enterprise question |
|---|---|---|
| Brain (the LLM) | Interprets the goal, reasons, plans and chooses the next step | Which model, and what happens when it is wrong? |
| Perception | Brings in text, retrieved documents or other inputs the agent can read | Which sources is it allowed to read? |
| Memory | Keeps what the agent should retain between steps | What is stored, for how long, and who can inspect it? |
| Tools and action | Lets the agent call functions and change something outside the model | Which actions need approval? |
The research on reasoning and acting supports this design. The ReAct paper (October 2022) prompts a model to interleave reasoning steps with actions, so that it can plan, adjust its plan and gather information from external sources such as a knowledge base. On question answering and fact verification, the authors report that querying a simple Wikipedia API reduced the hallucination and error propagation seen with chain-of-thought prompting alone.
How does tool calling work, and who stays in control?
According to OpenAI's function calling guide, the flow has five steps. Your application sends a request with a list of tools. The model returns a tool call instead of a final answer when it decides it needs one. Your application runs the matching function with the arguments from that call. Your application sends the tool output back in a second request. The model returns a final response or further tool calls, and the loop can repeat.
The point for governance is that the model only requests the call. Your code executes it, so your code is where permissions, validation and logging belong. The same guide notes that function definitions count against the context limit and are billed as input tokens, and suggests keeping the number of initially available functions small. The Model Context Protocol is an open-source standard for connecting AI applications to external data sources, tools and workflows, which reduces custom integration work.
Which agent pattern fits which task?
Anthropic's advice in Building effective agents is to start with the simplest solution and add complexity only when it clearly improves outcomes. Often a single LLM call with retrieval and examples is enough.
| Pattern | When it fits | Control and cost |
|---|---|---|
| Single LLM call with retrieval | Question answering and drafting with known context | Lowest cost, easiest to test |
| Prompt chaining | A task that splits into fixed sequential steps, with checks between them | Trades latency for accuracy |
| Routing | Distinct input types that need different handling | Can send simple queries to smaller models |
| Orchestrator-workers | Subtasks that cannot be predicted in advance | A central model delegates at runtime |
| Evaluator-optimizer | Clear evaluation criteria where iteration adds value | One model generates, another critiques |
| Autonomous agent | Open-ended problems where the number of steps cannot be hardcoded | Higher cost and potential for compounding errors |
Workflows suit well-defined tasks that need predictability; agents suit open-ended problems where you can trust the model's decisions. See our post on agentic workflows for how these patterns are sequenced in practice, and agentic AI, automation and AI agents for the differences between the terms.
How do autonomy, reactivity, pro-activeness and social ability map onto LLMs?
Agent research has long described four qualities of an intelligent agent. An LLM supplies each only in part, and the rest comes from the system around it.
| Quality | What the LLM contributes | What the surrounding system must add |
|---|---|---|
| Autonomy | Chooses its next step without step-by-step instructions | Stopping conditions, such as a maximum number of iterations |
| Reactivity | Interprets new inputs, including tool results | Reliable tools, retries and handling of failed calls |
| Pro-activeness | Plans and reformulates goals, as in reasoning-and-acting loops | Limits on which goals it may pursue |
| Social ability | Communicates in natural language with people and other agents | Clear roles and an audit trail for multi-agent exchanges |
How should people and agents work together?
Two models are common. In the instructor-executor model, people give clear instructions or feedback and the agent acts on them. This suits tasks with a specific, directed outcome. In the equal-partnership model, the agent and the person interact more as peers, which works for exploratory tasks. Whichever you choose, Anthropic recommends human checkpoints and human review, especially for coding tasks, and agents that can pause for human input.
How do you evaluate an LLM-based agent?
A model benchmark does not tell you whether an agent is ready. Evaluate the agent as a system on four dimensions.
- Utility: the success rate on real tasks, plus cost and time per task.
- Tool-call correctness: whether the right function is called with valid arguments, and whether retries are safe.
- Sociability: clarity of communication and how well agents coordinate where several are involved.
- Values: honest, harmless behaviour and compliance with your policies.
Run these tests in a sandbox before go-live and repeat them after changes. AgentEvaluation describes itself as a way to "score and benchmark enterprise AI agents before and after they go live". Do not rely on published benchmark scores without reading the source for the task and model you plan to use.
What governance, security and cost controls does an agent need?
OWASP lists Excessive Agency as an LLM risk. It arises when a model's unexpected, ambiguous or manipulated outputs trigger damaging actions, and it has three root causes: excessive functionality, excessive permissions and excessive autonomy. Its mitigations translate directly into controls.
| Risk | Control | Where it sits |
|---|---|---|
| Excessive functionality | Give the agent only the tools it needs; avoid open-ended tools such as shell access | Tool registry |
| Excessive permissions | Scoped, least-privilege access, such as read-only database access | Downstream systems |
| Excessive autonomy | Human approval for high-impact actions | Approval step |
| Model decides what is allowed | Enforce authorisation downstream, not in the model | Application code |
| Runaway cost or loops | Stopping conditions and a cap on iterations | Agent loop |
OWASP adds that logging and monitoring will not prevent excessive agency but can limit the damage. For the full control set, see our agentic AI risk management framework and security AI agents. AgentGRC provides, in its own words, "governance, risk and compliance controls for autonomous agent actions across the enterprise", and ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents.
When should you not use an LLM agent?
Do not use an autonomous agent when the steps are known, the task needs a repeatable result or an error would be costly and hard to reverse. Anthropic notes that agentic systems often trade latency and cost for better task performance, and that autonomy raises costs and creates the potential for compounding errors. A fixed workflow, or a single call with retrieval, is usually the better first choice. If your task is automation with predefined rules, our guide to custom AI for autonomous operations covers that route.
In what order should an enterprise adopt LLM agents?
- Pick one well-defined task with a measurable outcome, and try a single LLM call with retrieval first.
- Move to a workflow pattern if the task needs several steps, and add checks between them.
- Add tools one at a time, each with scoped permissions and clear descriptions with examples.
- Test in a sandbox, then add stopping conditions, logging and human approval for high-impact actions.
- Allow more autonomy only where evaluation shows the agent is reliable, and review it after every model or tool change.
To map one decision your agents should make, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is the difference between an LLM and an AI agent?
An LLM generates text from a prompt. An AI agent is a system in which an LLM directs its own process and tool use, with memory, tools and a control loop around it.
Does the model run the tools it calls?
No. According to OpenAI's guide, the model returns a tool call and your application runs the function and returns the result. Permissions and validation therefore belong in your code.
When is a workflow better than an agent?
Anthropic recommends workflows for well-defined tasks that need predictability, and agents for open-ended problems where the number of steps cannot be hardcoded.
What is the main security risk of an LLM agent?
OWASP names Excessive Agency: damaging actions triggered by unexpected or manipulated model output, caused by excessive functionality, permissions or autonomy.
How do I evaluate an LLM agent before go-live?
Test task success, tool-call correctness, communication and policy compliance in a sandbox, and repeat the tests after every model or tool change.
Next Steps with Large Language Model
Talk to our experts about implementing compound AI system, How Industries and different departments use Agentic Workflows and Decision Intelligence to Become Decision Centric. Utilizes AI to automate and optimize IT support and operations, improving efficiency and responsiveness.
Ready to put AI agents to work? Explore ElixirClaw, the agentic OS platform to build, orchestrate and govern AI agents.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE